:root {
    --azul-oscuro: #010047;
    --azul-medio: #010047;
    --gris-claro: #f4f4f4;
    --gris-medio: #757575;
    --texto: #1a1a1a;
    --naranja: #f28b30;
    --header-fonts: 'Genos', sans-serif;
    --text-fonts: 'Quicksand', sans-serif;
}

body {
    background-color: #f8f9fa;
    font-family: var(--text-fonts);
    color: var(--texto);
    margin: 0;
    overflow-x: hidden;
}

/* Scroll lock when mobile sidebar is open */
body.no-scroll {
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--header-fonts);
}

.main-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--azul-oscuro);
    color: white;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s ease, width 0.3s ease, background 0.3s ease;
    border-radius: 0 20px 20px 0;
    margin: 15px 15px 15px 0px;
    height: calc(100vh - 30px);
    position: sticky;
    top: 15px;
    
    /* Permite scroll si excede la altura */
    overflow-y: auto;
}

/* Barra de scroll premium ultra-fina para el sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--text-fonts);
    font-weight: 500;
    padding: 12px 25px;
    border-left: 4px solid transparent;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--naranja);
}

.sidebar .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border-left-color: var(--naranja);
    font-weight: 700;
}

.sidebar .text-warning {
    color: var(--naranja) !important;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Glassmorphism Cards */
.glass-card {
    background: white;
    border: 1px solid rgba(1, 0, 71, 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(1, 0, 71, 0.05);
}

/* Dashboard Summary Cards */
.resume-card {
    background: var(--azul-medio);
    border-radius: 12px;
    color: #fff;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
    border: none;
}

.resume-card:hover {
    transform: translateY(-5px);
}

.resume-card h3 {
    font-size: 2.5rem;
    margin-bottom: 0;
    font-family: var(--header-fonts);
}

.resume-card .card-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    opacity: 0.8;
}


/* Buttons */
.btn-primary-gradient {
    background: var(--azul-oscuro);
    border: none;
    color: white;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-primary-gradient:hover {
    background: var(--gris-medio);
    color: white;
}

.btn-outline-warning {
    color: var(--naranja);
    border-color: var(--naranja);
}

.btn-outline-warning:hover {
    background: var(--naranja);
    color: white;
}

/* Tables */
.table thead th {
    background: var(--azul-medio);
    color: white;
    font-family: var(--text-fonts);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 15px;
    border: none;
}

.table tbody td {
    padding: 15px;
    vertical-align: middle;
    color: var(--azul-medio);
    font-weight: 500;
}

/* Forms */
.form-label {
    color: var(--azul-oscuro);
    font-weight: 600;
    font-family: var(--text-fonts);
}

.form-control:focus {
    border-color: var(--azul-medio);
    box-shadow: 0 0 0 0.2rem rgba(1, 0, 71, 0.1);
}

/* Utility */
.text-primary { color: var(--azul-medio) !important; }
.bg-primary { background-color: var(--azul-medio) !important; }

/* Login Page Specific */
.login-page-bg {
    background-color: var(--azul-oscuro);
    margin: -30px;
    min-height: 100vh;
}

/* Sidebar Sync Animation */
.bi-arrow-clockwise {
    transition: transform 0.5s ease;
    display: inline-block;
}
a:hover .bi-arrow-clockwise {
    transform: rotate(180deg);
}

/* Sidebar Dropdown Animation */
.sidebar .nav-link[aria-expanded="true"] .caret-icon {
    transform: rotate(180deg);
}

/* Custom Pagination Styling */
.pagination {
    margin-bottom: 0;
    gap: 5px;
}

.pagination .page-item .page-link {
    background: white;
    border: 1px solid rgba(1, 0, 71, 0.1);
    color: var(--azul-oscuro);
    border-radius: 8px !important;
    padding: 8px 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.pagination .page-item.active .page-link {
    background: var(--azul-oscuro) !important;
    border-color: var(--azul-oscuro) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(1, 0, 71, 0.15);
}

.pagination .page-item.disabled .page-link {
    background: #fdfdfd;
    border-color: #eee;
    color: #bbb;
}

.pagination .page-item .page-link:hover:not(.active) {
    background: #f4f4ff;
    color: var(--azul-oscuro);
    border-color: var(--azul-oscuro);
    transform: translateY(-1px);
}

/* Collapsible Chevron Animation */
button[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform 0.3s ease;
    display: inline-block;
}

button[data-bs-toggle="collapse"][aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

/* Collapsible Button Text Toggle (Desplegar / Plegar) */
button[data-bs-toggle="collapse"] .collapse-text-plegar {
    display: none !important;
}
button[data-bs-toggle="collapse"][aria-expanded="true"] .collapse-text-desplegar {
    display: none !important;
}
button[data-bs-toggle="collapse"][aria-expanded="true"] .collapse-text-plegar {
    display: inline !important;
}

/* ==========================================================================
   SISTEMA COMPLETAMENTE RESPONSIVO (MÓVILES Y TABLETS)
   ========================================================================== */

/* Reglas automáticas para que las tablas en tarjetas de cristal no desborden */
@media (max-width: 767px) {
    .glass-card {
        overflow-x: auto;
    }
    
    /* Pequeño ajuste para formularios dentro de tarjetas para que no se apiñen */
    .glass-card form {
        min-width: 100%;
    }
}

@media (max-width: 991px) {
    /* Stack vertical del layout */
    .main-wrapper {
        display: block !important;
        position: relative;
    }

    /* Sidebar: drawer oculto fuera de pantalla */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100dvh !important;   /* full device height (no browser chrome) */
        margin: 0 !important;
        border-radius: 0 !important;
        width: 280px !important;
        transform: translateX(-100%);
        z-index: 1050 !important;
        box-shadow: 10px 0 25px rgba(0,0,0,0.3) !important;
    }

    /* Sidebar visible */
    .sidebar.show-sidebar {
        transform: translateX(0) !important;
    }

    /* Backdrop: behind sidebar, never on top */
    #sidebar-backdrop {
        position: fixed !important;
        inset: 0 !important;
        z-index: 1040 !important;    /* sidebar is 1050, backdrop is 1040 */
        background: rgba(0,0,0,0.5) !important;
        backdrop-filter: blur(3px) !important;
        -webkit-backdrop-filter: blur(3px) !important;
        pointer-events: none;
        opacity: 0;
        display: block !important;   /* always in flow, toggled by opacity+pointer-events */
        transition: opacity 0.3s ease !important;
    }

    #sidebar-backdrop.visible {
        opacity: 1 !important;
        pointer-events: auto;
    }

    /* Disable zoom on mobile */
    body { zoom: 1 !important; }

    /* Content: full width */
    .content-wrapper {
        padding: 15px !important;
        width: 100% !important;
    }

    /* Top bar: stacks vertically */
    .top-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 15px !important;
        text-align: center;
    }
    .top-bar div {
        display: flex;
        flex-direction: column;
        gap: 4px;
        align-items: center;
    }
    .top-bar .d-flex {
        justify-content: center !important;
        width: 100%;
    }

    /* Footer */
    footer.glass-card {
        margin: 20px 10px 10px 10px !important;
        padding: 20px 10px !important;
    }

    /* Dashboard resume cards */
    .resume-card {
        margin-bottom: 15px !important;
        padding: 1.2rem !important;
    }
    .resume-card .card-icon {
        opacity: 0.15;
        right: 15px !important;
        font-size: 2.2rem !important;
    }
}

/* ── Call list checkboxes ── */
.call-list-check.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    border: 1.5px solid var(--azul-medio, #f28b30) !important;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.call-list-check.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(242, 139, 48, 0.2);
    border-color: var(--azul-medio, #f28b30) !important;
}
.call-list-check.form-check-input:checked {
    background-color: var(--azul-medio, #f28b30);
    border-color: var(--azul-medio, #f28b30) !important;
}

/* ── Queue checkbox list (multi-select queues) ── */
.queue-checkbox-list {
    display: grid !important;
    grid-template-columns: auto 1fr;
    gap: 0.6rem 0.8rem;
    align-items: center;
    padding: 0.5rem 0;
}
.queue-checkbox-list input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0 !important;
    border: 1.5px solid var(--azul-medio, #f28b30) !important;
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--naranja, #f28b30);
    transition: transform 0.1s ease;
}
.queue-checkbox-list input[type="checkbox"]:hover {
    transform: scale(1.05);
}
.queue-checkbox-list label {
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    user-select: none;
    color: var(--azul-oscuro, #010047);
    margin: 0;
    padding: 2px 0;
    transition: color 0.15s ease;
}
.queue-checkbox-list label:hover {
    color: var(--naranja, #f28b30);
}
.queue-checkbox-list:empty::after {
    content: 'No hay colas disponibles aún. Se cargarán automáticamente tras la primera importación de llamadas.';
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

/* Auto-scale layout for laptop screens (typically between 992px and 1500px width) */
@media (min-width: 992px) and (max-width: 1500px) {
    body {
        zoom: 0.8;
    }
}

/* Small mobile: reduce table font and padding */
@media (max-width: 575.98px) {
    .table { font-size: 0.82rem; }
    .table thead th { padding: 10px 8px; }
    .table tbody td { padding: 10px 8px; }
    .content-wrapper { padding: 10px 8px !important; }
    .glass-card { border-radius: 8px; }
}
