/* ================================================================
   ColviajesApp — Estilos Globales
   Fuente: Poppins ExtraBold (800) + Regular (400) + Medium (500)
   Colores corporativos: Verde #28E2B1 · Gris #A7A9AD
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;800&display=swap');

/* ----------------------------------------------------------------
   Variables globales
   ---------------------------------------------------------------- */
:root {
    --verde:          #28E2B1;
    --verde-dark:     #1fc89d;
    --verde-light:    #d0faf1;
    --verde-rgb:      40, 226, 177;
    --gris:           #A7A9AD;
    --gris-light:     #f4f5f7;
    --gris-medium:    #e2e4e8;
    --dark:           #0d1b2a;
    --dark-sidebar:   #111827;
    --text-main:      #1f2937;
    --text-muted:     #6b7280;
    --white:          #ffffff;
    --shadow-xs:      0 1px 3px rgba(0,0,0,.08);
    --shadow-sm:      0 2px 8px rgba(0,0,0,.10);
    --shadow-md:      0 4px 20px rgba(0,0,0,.13);
    --shadow-lg:      0 8px 40px rgba(0,0,0,.18);
    --radius:         12px;
    --radius-sm:      8px;
    --radius-lg:      16px;
    --transition:     all .22s ease;
    --sidebar-width:  260px;

    /* Override Bootstrap primary */
    --bs-primary:                #28E2B1;
    --bs-primary-rgb:            40, 226, 177;
    --bs-primary-text-emphasis:  #1a9b7a;
    --bs-primary-bg-subtle:      #d0faf1;
    --bs-primary-border-subtle:  #a0f5e3;
    --bs-link-color:             #28E2B1;
    --bs-link-hover-color:       #1fc89d;
    --bs-border-radius:          var(--radius-sm);
    --bs-border-radius-lg:       var(--radius);
}

/* ----------------------------------------------------------------
   Base
   ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    color: var(--text-main);
    background: var(--gris-light);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.fw-bold, .fw-extrabold, .brand-name {
    font-weight: 800;
}

a { color: var(--verde); text-decoration: none; }
a:hover { color: var(--verde-dark); }

/* ----------------------------------------------------------------
   Bootstrap overrides
   ---------------------------------------------------------------- */
.btn-primary {
    background: var(--verde);
    border-color: var(--verde);
    color: var(--dark);
    font-weight: 600;
}
.btn-primary:hover,
.btn-primary:focus {
    background: var(--verde-dark);
    border-color: var(--verde-dark);
    color: var(--dark);
}
.btn-primary:active {
    background: #18b090 !important;
    border-color: #18b090 !important;
}
.btn-outline-primary {
    border-color: var(--verde);
    color: var(--verde);
}
.btn-outline-primary:hover {
    background: var(--verde);
    border-color: var(--verde);
    color: var(--dark);
}

.text-primary   { color: var(--verde) !important; }
.border-primary { border-color: var(--verde) !important; }
.bg-primary     { background-color: var(--verde) !important; }

.badge.bg-primary { color: var(--dark); }

.form-control:focus,
.form-select:focus {
    border-color: var(--verde);
    box-shadow: 0 0 0 .2rem rgba(var(--verde-rgb), .2);
}

/* ----------------------------------------------------------------
   Scrollbar personalizado
   ---------------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gris); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #888; }

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #0d1b2a 0%, #1a2e44 50%, #0d2636 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

/* Decoración de fondo */
.login-body::before,
.login-body::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: .06;
    background: var(--verde);
}
.login-body::before {
    width: 600px; height: 600px;
    top: -200px; right: -150px;
}
.login-body::after {
    width: 400px; height: 400px;
    bottom: -150px; left: -100px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 44px 40px 36px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.brand-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--verde), var(--verde-dark));
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(var(--verde-rgb), .35);
}
.brand-icon i {
    font-size: 32px;
    color: var(--dark);
}

.brand-name {
    font-size: 26px;
    font-weight: 800;
    color: var(--dark);
    margin: 0;
    letter-spacing: -.5px;
}

.brand-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
    font-weight: 500;
}

.login-form .form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
    margin-bottom: 6px;
}

.login-form .input-group-text {
    background: var(--gris-light);
    border-color: var(--gris-medium);
    color: var(--gris);
}

.login-form .form-control {
    border-color: var(--gris-medium);
    font-size: 14px;
    padding: 10px 14px;
}

.btn-login {
    padding: 12px;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    letter-spacing: .3px;
    margin-top: 4px;
}

.login-footer {
    color: rgba(255,255,255,.35);
    font-size: 12px;
    margin-top: 24px;
    text-align: center;
    z-index: 1;
}

/* ================================================================
   APP LAYOUT (Sidebar + Content)
   ================================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--dark-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--verde), var(--verde-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-brand-icon i { font-size: 20px; color: var(--dark); }

.sidebar-brand-text {
    font-size: 15px;
    font-weight: 800;
    color: var(--white);
    line-height: 1.2;
}
.sidebar-brand-sub {
    font-size: 10px;
    color: rgba(255,255,255,.4);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .8px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    margin-bottom: 8px;
}

.sidebar-avatar {
    width: 36px; height: 36px;
    background: rgba(var(--verde-rgb), .15);
    border: 2px solid rgba(var(--verde-rgb), .3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-avatar i { font-size: 16px; color: var(--verde); }

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 11px;
    color: var(--verde);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 0 12px;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 8px 6px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: rgba(255,255,255,.65);
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-bottom: 2px;
    white-space: nowrap;
}
.sidebar-nav .nav-link i {
    font-size: 17px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,.07);
    color: var(--white);
}
.sidebar-nav .nav-link.active {
    background: rgba(var(--verde-rgb), .15);
    color: var(--verde);
    font-weight: 700;
}
.sidebar-nav .nav-link.active i { color: var(--verde); }

/* Sub-menú */
.sidebar-submenu {
    padding-left: 30px;
    margin-bottom: 4px;
}
.sidebar-submenu .nav-link {
    font-size: 13px;
    padding: 8px 12px;
    color: rgba(255,255,255,.5);
}
.sidebar-submenu .nav-link::before {
    content: '•';
    margin-right: 6px;
    color: rgba(var(--verde-rgb), .4);
}
.sidebar-submenu .nav-link:hover { color: var(--white); }
.sidebar-submenu .nav-link.active { color: var(--verde); }

.sidebar-footer {
    padding: 12px 12px 20px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-footer .nav-link {
    color: rgba(255,255,255,.45);
    font-size: 13px;
}
.sidebar-footer .nav-link:hover { color: #ff6b6b; background: rgba(255,107,107,.08); }

/* --- Main content --- */
.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gris-medium);
    padding: 0 28px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

.topbar-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}
.topbar-breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.app-content {
    padding: 28px;
    flex: 1;
}

/* --- Toggle sidebar mobile --- */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 22px;
    padding: 4px;
    cursor: pointer;
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gris-medium);
    font-weight: 700;
    font-size: 15px;
    padding: 16px 20px;
}

.card-body { padding: 20px; }

/* ── Stat cards ──────────────────────────────────────────────────── */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    border: 1px solid var(--gris-medium);
    border-top: 3px solid transparent;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0) 60%, rgba(255,255,255,.6));
    pointer-events: none;
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.stat-card.accent-green  { border-top-color: var(--verde); }
.stat-card.accent-blue   { border-top-color: #3b82f6; }
.stat-card.accent-yellow { border-top-color: #f59e0b; }
.stat-card.accent-red    { border-top-color: #ef4444; }
.stat-card.accent-gray   { border-top-color: #9ca3af; }
.stat-card.accent-purple { border-top-color: #8b5cf6; }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}
.stat-icon.green  { background: var(--verde-light);  color: var(--verde-dark); }
.stat-icon.gray   { background: #f0f0f2;              color: #6b7280; }
.stat-icon.blue   { background: #dbeafe;              color: #2563eb; }
.stat-icon.yellow { background: #fef3c7;              color: #b45309; }
.stat-icon.red    { background: #fee2e2;              color: #dc2626; }
.stat-icon.purple { background: #ede9fe;              color: #7c3aed; }

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 3px;
}
.stat-label {
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Módulos / accesos rápidos en inicio ─────────────────────────── */
.dash-mod-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--gris-medium);
    border-radius: var(--radius);
    background: var(--white);
    padding: 1.35rem 1.4rem 1.2rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.dash-mod-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gris-medium);
    transition: var(--transition);
}
.dash-mod-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    color: inherit;
    border-color: rgba(40,226,177,.35);
}
.dash-mod-card:hover::before {
    background: var(--verde);
}
.dash-mod-card .dash-mod-icon {
    width: 46px;
    height: 46px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}
.dash-mod-card h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: .95rem;
    margin-bottom: .3rem;
    color: var(--text-main);
}
.dash-mod-card p {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.5;
    flex: 1;
}
.dash-mod-card .dash-mod-cta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 700;
    color: var(--verde-dark);
    margin-top: .85rem;
    transition: gap .18s ease;
}
.dash-mod-card:hover .dash-mod-cta { gap: 7px; }
.dash-mod-card .dash-mod-badge {
    position: absolute;
    top: 14px; right: 14px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}

/* ================================================================
   TABLAS
   ================================================================ */
.table-colviajes {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.table-colviajes table {
    margin: 0;
    font-size: 13.5px;
}
.table-colviajes thead th {
    background: var(--gris-light);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--gris-medium);
    padding: 12px 16px;
    white-space: nowrap;
}
.table-colviajes tbody td {
    padding: 13px 16px;
    border-color: var(--gris-medium);
    vertical-align: middle;
}
.table-colviajes tbody tr:hover { background: rgba(var(--verde-rgb), .04); }

/* ================================================================
   BADGES DE ESTADO
   ================================================================ */
.badge-estado {
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 11.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.badge-estado::before { content: '•'; font-size: 14px; line-height: 0; }

.estado-solicitado           { background: #dbeafe; color: #1d4ed8; }
.estado-asignado             { background: #ede9fe; color: #6d28d9; }
.estado-en_curso             { background: #d1fae5; color: #065f46; }
.estado-finalizado           { background: #f3f4f6; color: #374151; }
.estado-cancelacion_solicitada { background: #fef9c3; color: #92400e; }
.estado-cancelado            { background: #fee2e2; color: #991b1b; }

/* ================================================================
   FORMULARIOS
   ================================================================ */
.form-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.form-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--verde-light);
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-section-title i { color: var(--verde); }

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.form-text {
    font-size: 11.5px;
    color: var(--text-muted);
}

.required-mark { color: #ef4444; margin-left: 2px; }

/* ================================================================
   BOTONES
   ================================================================ */
.btn {
    font-weight: 600;
    font-size: 13.5px;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    transition: var(--transition);
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-icon {
    width: 36px; height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ================================================================
   ALERTAS / FLASH
   ================================================================ */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger   { background: #fee2e2; color: #991b1b; }
.alert-warning  { background: #fef9c3; color: #92400e; }
.alert-info     { background: #dbeafe; color: #1e40af; }

/* ================================================================
   TOASTS
   ================================================================ */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}
.cv-toast {
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid var(--verde);
    animation: toastIn .3s ease;
    font-size: 13.5px;
}
.cv-toast.error   { border-left-color: #ef4444; }
.cv-toast.warning { border-left-color: #f59e0b; }
.cv-toast.info    { border-left-color: #3b82f6; }

.cv-toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.cv-toast.success .cv-toast-icon { color: var(--verde); }
.cv-toast.error   .cv-toast-icon { color: #ef4444; }
.cv-toast.warning .cv-toast-icon { color: #f59e0b; }
.cv-toast.info    .cv-toast-icon { color: #3b82f6; }

.cv-toast-title   { font-weight: 700; font-size: 13px; }
.cv-toast-message { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ================================================================
   LOADING
   ================================================================ */
.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}
.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    top: 50%; left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(0,0,0,.2);
    border-top-color: var(--dark);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    backdrop-filter: blur(2px);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .app-main {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1039;
    }
    .sidebar-overlay.open { display: block; }
    .app-content { padding: 20px 16px; }
    .login-card { padding: 32px 24px 28px; }
}

@media (max-width: 576px) {
    .stat-value { font-size: 22px; }
    .app-topbar { padding: 0 16px; }
}
