/* =========================================
   1. VARIABLES GLOBALES & RESET — TerabitCom
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* ── Paleta TerabitCom ── */
    --brand-blue:       #0066FF;   /* Azul Eléctrico Principal */
    --brand-blue-dark:  #0047CC;   /* Azul Profundo */
    --brand-orange:     #FF7A00;   /* Naranja Cobrizo (acento 10%) */
    --brand-cyan:       #00E5FF;   /* Cian Neón */
    --brand-gold:       #FFAE00;   /* Amarillo Oro */
    --brand-bg:         #030712;   /* Fondo Nocturno (60%) */
    --brand-surface:    #0D1526;   /* Superficie de tarjetas */
    --brand-surface2:   #111C35;   /* Superficie secundaria */
    --brand-white:      #E5E9F0;   /* Blanco Titanio (30%) */
    --brand-muted:      #6B7A99;   /* Texto secundario */
    --brand-border:     rgba(0, 102, 255, 0.18);

    --radius-md:   12px;
    --radius-lg:   18px;
    --radius-pill: 50px;
    --sidebar-width: 280px;
}

/* =========================================
   2. RESET & TIPOGRAFÍA
   ========================================= */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
    background-color: var(--brand-bg);
    color: var(--brand-white);
    margin: 0;
    overflow-x: hidden;
}

/* =========================================
   3. ESTRUCTURA DEL LAYOUT (ESCRITORIO)
   ========================================= */
body:not(.login-page) {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    background: linear-gradient(180deg, #0D1A3A 0%, var(--brand-bg) 100%) !important;
    border-right: 1px solid var(--brand-border);
    box-shadow: 4px 0 30px rgba(0, 102, 255, 0.12);
    color: var(--brand-white);
    flex-shrink: 0;
    overflow-y: auto;
    z-index: 1050;
    transition: transform 0.3s ease-in-out;
}

/* Brand gradient text en sidebar */
#sidebar > a span {
    background: linear-gradient(90deg, var(--brand-blue) 0%, var(--brand-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* Contenido Principal */
.main-content {
    flex-grow: 1;
    padding: 30px;
    width: calc(100% - var(--sidebar-width));
    overflow-y: auto;
    background-color: var(--brand-bg);
    transition: margin-left 0.3s ease-in-out;
}

/* =========================================
   4. MENÚ DE NAVEGACIÓN
   ========================================= */
.nav-pills .nav-link {
    color: rgba(229, 233, 240, 0.75) !important;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 4px;
    border-radius: var(--radius-md);
    padding: 10px 15px;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.nav-pills .nav-link:hover {
    background-color: rgba(0, 102, 255, 0.15);
    border-color: rgba(0, 102, 255, 0.3);
    color: var(--brand-cyan) !important;
    transform: translateX(5px);
}

.nav-pills .nav-link.active {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%) !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(0, 102, 255, 0.45);
    border-color: rgba(0, 229, 255, 0.3);
}

#sidebar hr {
    border-color: rgba(0, 102, 255, 0.2);
    opacity: 1;
}

#sidebar .text-white-50 {
    color: var(--brand-muted) !important;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
}

/* =========================================
   5. TARJETAS / CARDS
   ========================================= */
.card {
    background-color: var(--brand-surface) !important;
    border: 1px solid var(--brand-border) !important;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    margin-bottom: 20px;
    color: var(--brand-white);
}

.card-header {
    background: linear-gradient(135deg, var(--brand-surface2) 0%, #0A1630 100%) !important;
    border-bottom: 1px solid var(--brand-border) !important;
    color: var(--brand-white) !important;
    font-weight: 600;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card-body { color: var(--brand-white); }

/* =========================================
   6. BOTONES
   ========================================= */
.btn-primary {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
    border: none;
    border-radius: var(--radius-pill);
    padding: 9px 22px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 102, 255, 0.35);
    transition: all 0.25s ease;
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--brand-cyan) 0%, var(--brand-blue) 100%);
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.4);
    transform: translateY(-2px);
    border: none;
}

/* Naranja — acento exclusivo para CTAs urgentes (10%) */
.btn-warning {
    background: linear-gradient(135deg, var(--brand-orange) 0%, var(--brand-gold) 100%) !important;
    border: none !important;
    color: #030712 !important;
    font-weight: 700;
    border-radius: var(--radius-pill);
    box-shadow: 0 4px 14px rgba(255, 122, 0, 0.35);
    transition: all 0.25s ease;
}

.btn-warning:hover {
    box-shadow: 0 6px 20px rgba(255, 174, 0, 0.45) !important;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #00C566 0%, #009B4E 100%);
    border: none;
    border-radius: var(--radius-pill);
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0, 197, 102, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #FF3355 0%, #CC0022 100%);
    border: none;
    border-radius: var(--radius-pill);
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(255, 51, 85, 0.3);
}

.btn-secondary {
    background: var(--brand-surface2);
    border: 1px solid var(--brand-border);
    color: var(--brand-white);
    border-radius: var(--radius-pill);
}

.btn-secondary:hover {
    background: rgba(0, 102, 255, 0.15);
    border-color: var(--brand-blue);
    color: var(--brand-cyan);
}

/* =========================================
   7. FORMULARIOS / INPUTS
   ========================================= */
.form-control, .form-select {
    background-color: var(--brand-surface2) !important;
    border: 1px solid var(--brand-border) !important;
    color: var(--brand-white) !important;
    border-radius: 10px;
    padding: 9px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-cyan) !important;
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.18) !important;
    background-color: var(--brand-surface) !important;
    outline: none;
}

.form-control::placeholder { color: var(--brand-muted); }
.form-label { color: var(--brand-white); font-weight: 500; font-size: 0.9rem; }

/* =========================================
   8. TABLAS
   ========================================= */
.table { color: var(--brand-white) !important; }

.table thead th {
    background-color: var(--brand-surface2) !important;
    color: var(--brand-cyan) !important;
    border-bottom: 2px solid var(--brand-border) !important;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.table tbody tr {
    border-bottom: 1px solid rgba(0, 102, 255, 0.08);
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background-color: rgba(0, 102, 255, 0.08) !important;
}

.table td, .table th {
    border-color: rgba(0, 102, 255, 0.1) !important;
    vertical-align: middle;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background-color: var(--brand-surface2) !important;
    border: 1px solid var(--brand-border) !important;
    color: var(--brand-white) !important;
    border-radius: 8px;
    padding: 5px 10px;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
    color: var(--brand-muted) !important;
}

.dataTables_wrapper .page-link {
    background-color: var(--brand-surface2);
    border-color: var(--brand-border);
    color: var(--brand-blue);
}

.dataTables_wrapper .page-item.active .page-link {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
    color: #fff;
}

/* =========================================
   9. BADGES / ALERTAS
   ========================================= */
.badge.bg-primary { background-color: var(--brand-blue) !important; }
.badge.bg-warning { background-color: var(--brand-orange) !important; color: #030712 !important; }
.badge.bg-info    { background-color: var(--brand-cyan) !important;   color: #030712 !important; }

.alert { border-radius: var(--radius-md); border-left: 4px solid; }
.alert-success { background-color: rgba(0, 197, 102, 0.12); border-color: #00C566; color: #00E57A; }
.alert-danger  { background-color: rgba(255, 51, 85, 0.12);  border-color: #FF3355; color: #FF6680; }
.alert-warning { background-color: rgba(255, 122, 0, 0.12);  border-color: var(--brand-orange); color: var(--brand-gold); }
.alert-info    { background-color: rgba(0, 229, 255, 0.10);  border-color: var(--brand-cyan);   color: var(--brand-cyan); }

/* =========================================
   10. MODAL
   ========================================= */
.modal-content {
    background-color: var(--brand-surface) !important;
    border: 1px solid var(--brand-border) !important;
    color: var(--brand-white) !important;
    border-radius: var(--radius-lg);
}
.modal-header { border-bottom: 1px solid var(--brand-border); }
.modal-footer { border-top:    1px solid var(--brand-border); }
.btn-close { filter: invert(1); }

/* =========================================
   11. LOGIN PAGE
   ========================================= */
body.login-page {
    background: radial-gradient(ellipse at 70% 30%, rgba(0, 102, 255, 0.15) 0%, var(--brand-bg) 60%),
                var(--brand-bg);
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-layout { display: flex; width: 100%; height: 100%; }

.login-left {
    width: 50%;
    background: linear-gradient(135deg, #0047CC 0%, #0066FF 50%, #00AACC 100%);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: white; text-align: center;
    clip-path: ellipse(120% 100% at 0% 50%);
    z-index: 10;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(0,229,255,0.2) 0%, transparent 70%);
    top: 10%; left: 20%;
    border-radius: 50%;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255,174,0,0.15) 0%, transparent 70%);
    bottom: 15%; right: 10%;
    border-radius: 50%;
}

.illustration-icon {
    font-size: 10rem;
    margin-bottom: 20px;
    animation: floatAnimation 4s infinite;
    filter: drop-shadow(0 0 30px rgba(0, 229, 255, 0.6));
    position: relative; z-index: 1;
}

.login-welcome-title {
    font-size: 2.5rem;
    font-weight: 800;
    position: relative; z-index: 1;
}

.login-welcome-text {
    font-size: 1rem; opacity: 0.9;
    position: relative; z-index: 1;
    max-width: 320px;
}

.login-right {
    width: 50%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: var(--brand-surface);
}

.login-form-container { width: 100%; max-width: 400px; padding: 0 30px; }

.login-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--brand-white);
    margin-bottom: 8px;
}

.form-control-custom {
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--radius-pill);
    background: var(--brand-surface2);
    border: 1px solid var(--brand-border);
    color: var(--brand-white);
    font-size: 0.95rem;
    margin-bottom: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-control-custom:focus {
    border-color: var(--brand-cyan);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.18);
}

.form-control-custom::placeholder { color: var(--brand-muted); }

.input-group-custom { position: relative; margin-bottom: 16px; }

.btn-login-blue {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
    color: white;
    border-radius: var(--radius-pill);
    border: none;
    margin-top: 8px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
    transition: all 0.25s ease;
}

.btn-login-blue:hover {
    background: linear-gradient(135deg, var(--brand-cyan) 0%, var(--brand-blue) 100%);
    box-shadow: 0 8px 28px rgba(0, 229, 255, 0.4);
    transform: translateY(-2px);
}

@keyframes floatAnimation {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-20px); }
}

/* =========================================
   12. MOBILE HEADER
   ========================================= */
.mobile-header {
    background: linear-gradient(90deg, #0D1A3A 0%, #0A1226 100%) !important;
    border-bottom: 1px solid var(--brand-border);
}

/* =========================================
   13. SIDEBAR OVERLAY
   ========================================= */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(3, 7, 18, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* =========================================
   14. DROPDOWN DEL USUARIO
   ========================================= */
.dropdown-menu-dark {
    background-color: var(--brand-surface) !important;
    border: 1px solid var(--brand-border) !important;
}

.dropdown-item:hover {
    background-color: rgba(0, 102, 255, 0.15) !important;
    color: var(--brand-cyan) !important;
}

.rounded-circle.bg-white {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-cyan) 100%) !important;
}

.rounded-circle.bg-white i { color: #fff !important; }

/* =========================================
   15. SCROLLBAR PERSONALIZADO
   ========================================= */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--brand-bg); }
::-webkit-scrollbar-thumb { background: rgba(0, 102, 255, 0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-blue); }

/* =========================================
   16. RESPONSIVE (MÓVIL Y TABLET)
   ========================================= */
@media (max-width: 991.98px) {
    body:not(.login-page) { flex-direction: column; }

    #sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        width: 260px !important;
        transform: translateX(-100%);
        box-shadow: none;
    }

    #sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 102, 255, 0.3);
    }

    .main-content {
        width: 100%;
        padding: 20px 15px;
        margin-left: 0;
    }

    .login-layout { flex-direction: column; }
    .login-left {
        width: 100%; min-height: 35vh;
        clip-path: none;
        border-radius: 0 0 40px 40px;
        padding: 20px;
    }
    .login-right { width: 100%; min-height: 65vh; padding: 20px; }
    .illustration-icon { font-size: 5rem; }
    .login-welcome-title { font-size: 1.8rem; }
    .login-title { font-size: 1.6rem; margin-bottom: 20px; }
}