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

:root {
    --sidebar-width: 255px;
    --sidebar-collapsed-width: 68px;
    --primary-color: #0253ac;
    --secondary-color: #0073e6;
    --accent-color: #5c6bc0;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 10px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --transition-speed: 0.3s;
    --sidebar-bg: #ffffff;
    --sidebar-text: #0253ac;
    --sidebar-hover-bg: rgba(2, 83, 172, 0.07);
    --sidebar-active-bg: rgba(2, 83, 172, 0.15);
    --submenu-indent: 14px;
}

/* ===== BASE STYLES ===== */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background-color: #f0f4f8;
    overflow-x: hidden;
    color: #333;
}

html {
    scroll-behavior: smooth;
}

/* Eliminar sombra (glow) de enfoque de Bootstrap */
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus {
    box-shadow: none !important;
    border-color: var(--primary-color) !important;
}


/* ══════════════════════════════════════════════════════════
   SIDEBAR — Contenedor principal
══════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 3px 0 6px rgba(0, 0, 0, 0.08);
    transition: width var(--transition-speed) ease, transform var(--transition-speed) ease;
    overflow: hidden;
}

/* ── Estado colapsado (desktop) ── */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* ── Estado abierto (mobile) ── */
.sidebar.mobile-open {
    transform: translateX(0) !important;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR HEADER
══════════════════════════════════════════════════════════ */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 12px 16px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    min-height: 80px;
}

.sidebar-logo {
    width: 190px;
    height: 64px;
    object-fit: contain;
    cursor: pointer;
    transition: opacity var(--transition-speed), max-width var(--transition-speed);
    flex-shrink: 0;
}

/* Logo oculto al colapsar */
.sidebar.collapsed .sidebar-logo {
    max-width: 0;
    opacity: 0;
}

.hide-menu {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition-speed);
}

.hide-menu:hover {
    background: var(--sidebar-hover-bg);
}


/* ══════════════════════════════════════════════════════════
   SIDEBAR MENU — Scroll wrapper
══════════════════════════════════════════════════════════ */
.sidebar-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, .15) transparent;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .15);
    border-radius: 4px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

/* Separador inferior del menú */
.sidebar-footer {
    border-top: 1px solid rgba(0, 0, 0, .08);
    padding-top: 6px !important;
    flex-shrink: 0;
}

.sidebar-footer-item .sidebar-link {
    opacity: .7;
    font-size: .875rem;
}


/* ══════════════════════════════════════════════════════════
   SIDEBAR LINKS — Estilo base compartido
══════════════════════════════════════════════════════════ */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 14px;
    margin: 1px 8px;
    width: calc(100% - 16px);
    border-radius: 8px;
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: .9rem;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    transition: background var(--transition-speed), color var(--transition-speed),
        transform .15s ease;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
}

.sidebar-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--primary-color);
    transform: translateX(3px);
}

.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--primary-color);
    font-weight: 600;
}

/* Barra lateral izquierda al hacer hover / active */
.sidebar-link::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 20%;
    height: 60%;
    width: 3px;
    background: var(--primary-color);
    border-radius: 0 3px 3px 0;
    transform: scaleY(0);
    transition: transform .2s ease;
}

.sidebar-link:hover::before,
.sidebar-link.active::before {
    transform: scaleY(1);
}

/* ── Ícono ── */
.sidebar-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

/* ── Etiqueta de texto ── */
.sidebar-label {
    flex: 1;
    transition: opacity var(--transition-speed), width var(--transition-speed);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ocultar labels al colapsar */
.sidebar.collapsed .sidebar-label {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed .grupo-chevron {
    opacity: 0;
    width: 0;
}


/* ══════════════════════════════════════════════════════════
   GRUPO — Botón de título con submenú
══════════════════════════════════════════════════════════ */
.sidebar-group-btn {
    text-align: left;
}

/* Separador visual sobre cada grupo */
.grupo-item+.grupo-item>.sidebar-group-btn,
li:not(.grupo-item)+.grupo-item>.sidebar-group-btn {
    /* pequeño espacio arriba */
    margin-top: 4px;
}

/* Chevron ─ gira cuando está expandido */
.grupo-chevron {
    margin-left: auto;
    font-size: .8rem;
    flex-shrink: 0;
    transition: transform var(--transition-speed), opacity var(--transition-speed);
}

.sidebar-group-btn[aria-expanded="true"] .grupo-chevron {
    transform: rotate(180deg);
}

/* Grupo activo (tiene un hijo activo) */
.sidebar-group-btn.active-group {
    color: var(--primary-color);
    font-weight: 600;
}


/* ══════════════════════════════════════════════════════════
   SUBMENÚ — Lista colapsable
══════════════════════════════════════════════════════════ */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
    padding-left: var(--submenu-indent);
}

.submenu.open {
    max-height: 600px;
}

/* Línea guía vertical */
.submenu {
    border-left: 2px solid rgba(2, 83, 172, .15);
    margin-left: 22px;
    padding-left: 10px;
}

.sidebar-sublink {
    font-size: .865rem;
    padding: 8px 12px;
    font-weight: 400;
}

.sidebar-sublink.active {
    font-weight: 600;
}

/* En modo colapsado, ocultar submenús */
.sidebar.collapsed .submenu {
    max-height: 0 !important;
}


/* ══════════════════════════════════════════════════════════
   OVERLAY — Fondo oscuro en mobile
══════════════════════════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 999;
    backdrop-filter: blur(2px);
    transition: opacity .3s ease;
}

.sidebar-overlay.active {
    display: block;
}


/* ══════════════════════════════════════════════════════════
   BOTÓN HAMBURGUESA — integrado en el navbar (visible solo en mobile)
══════════════════════════════════════════════════════════ */
.btn-hamburguesa {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    /* Ya no es fixed/position absolute — vive dentro del navbar */
    position: static;
}

.btn-hamburguesa:hover {
    background: #f1f5f9;
    color: var(--primary-color);
    border-color: var(--primary-color);
}


/* ══════════════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════════════ */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: all var(--transition-speed) ease;
    position: relative;
}

/* Cuando sidebar está colapsado */
.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width) !important;
    width: calc(100% - var(--sidebar-collapsed-width)) !important;
}

/* ══════════════════════════════════════════════════════════
   TOP NAVBAR — Barra superior con breadcrumb y acciones
══════════════════════════════════════════════════════════ */
.top-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 52px;
    background: #ffffff;
    border-bottom: 1px solid #e8edf2;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Breadcrumb */
.top-navbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #64748b;
}

.top-navbar-breadcrumb a {
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.top-navbar-breadcrumb a:hover {
    color: var(--primary-color);
}

.top-navbar-breadcrumb .sep {
    color: #cbd5e1;
    font-size: 0.75rem;
}

.top-navbar-breadcrumb .current {
    color: #1e293b;
    font-weight: 600;
}

/* Acciones del navbar */
.top-navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-navbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.top-navbar-btn:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

.top-navbar-btn .nav-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 1.5px solid white;
}

.top-navbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid #e2e8f0;
    transition: border-color 0.15s;
    letter-spacing: 0.5px;
}

.top-navbar-avatar:hover {
    border-color: var(--primary-color);
}

.top-navbar-divider {
    width: 1px;
    height: 22px;
    background: #e2e8f0;
    margin: 0 4px;
}

/* Buscador integrado en el top-navbar */
.top-navbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: 6px 12px;
    flex: 1;
    max-width: 420px;
    margin: 0 20px;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.top-navbar-search:focus-within {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(2, 83, 172, 0.08);
}

.top-navbar-search i {
    color: #94a3b8;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.top-navbar-search input {
    border: none;
    background: transparent;
    color: #1e293b;
    font-size: 0.82rem;
    outline: none;
    flex: 1;
    min-width: 0;
}

.top-navbar-search input::placeholder {
    color: #94a3b8;
}

.top-navbar-search-kbd {
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.68rem;
    color: #64748b;
    font-family: monospace;
    white-space: nowrap;
    flex-shrink: 0;
}



/* ══════════════════════════════════════════════════════════
   MAIN HEADER
══════════════════════════════════════════════════════════ */
.main-header {
    background: linear-gradient(135deg, #0253ac 0%, #1a73e8 60%, #4a90e2 100%);
    border-radius: 0px 0px 10px 10px;
    padding: 16px 30px 36px;
    margin-bottom: 0;
    box-shadow: 0 4px 20px rgba(2, 83, 172, 0.25);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

/* Decoración de fondo del banner */
.main-header::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px;
    height: 220px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    pointer-events: none;
}

.main-header::after {
    content: '';
    position: absolute;
    bottom: -40px;
    right: 180px;
    width: 140px;
    height: 140px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    pointer-events: none;
}

.header-title h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.header-title .subtitle {
    color: rgba(255, 255, 255, .8);
    font-size: 0.88rem;
}

/* Búsqueda global en el banner */
.header-search-bar {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    padding: 8px 14px;
    gap: 10px;
    min-width: 280px;
    max-width: 360px;
    backdrop-filter: blur(8px);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.header-search-bar:focus-within {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.6);
}

.header-search-bar input {
    border: none;
    background: transparent;
    color: white;
    font-size: 0.85rem;
    outline: none;
    flex: 1;
    min-width: 0;
}

.header-search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.header-search-bar i {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.header-search-kbd {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    padding: 1px 6px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.75);
    font-family: monospace;
    white-space: nowrap;
}

/* Botones de acción del banner */
.banner-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
}

.banner-actions .btn-banner {
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
    text-decoration: none;
}

.banner-actions .btn-banner:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.85);
    color: white;
    transform: translateY(-1px);
}

.banner-actions .btn-banner-primary {
    background: white;
    color: var(--primary-color);
    border-color: white;
}

.banner-actions .btn-banner-primary:hover {
    background: #f0f6ff;
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


/* ══════════════════════════════════════════════════════════
   HEADER ACTIONS (botones arriba derecha)
══════════════════════════════════════════════════════════ */
.header-actions {
    position: absolute;
    top: 5px;
    right: 50px;
    display: flex;
    gap: 10px;
    z-index: 1001;
    flex-wrap: wrap;
}

.header-actions .btn {
    border-radius: 50%;
    padding: 8px 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-speed);
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
    position: relative;
    overflow: hidden;
}

.header-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, .15);
}

.btn-notifications {
    background-color: #dde7f2;
    color: var(--primary-color);
}

.btn-notifications:hover {
    background-color: var(--primary-color);
    color: #dde7f2;
}

.btn-helpercenter {
    background-color: var(--primary-color);
    color: white;
}

.btn-helpercenter:hover {
    background-color: white;
    color: var(--primary-color);
}

.btn-profile {
    background-color: #b3b7bb;
    color: white;
}

.btn-logout {
    background-color: white;
    color: var(--danger-color);
    border: 1px solid #dee2e6 !important;
}

.btn-logout:hover {
    background-color: var(--danger-color);
    color: white;
}

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: .7rem;
    padding: 3px 6px;
    animation: pulse 2s infinite;
}

/* Tooltip usuario */
.tooltip-text {
    position: absolute;
    bottom: -35px;
    right: -47px;
    background-color: #a0a2a3;
    color: white;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: .75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

.btn-profile:hover+.tooltip-text {
    opacity: 1;
    visibility: visible;
}


/* ══════════════════════════════════════════════════════════
   MAIN PANEL
══════════════════════════════════════════════════════════ */
.main-panel {
    background: white;
    border-radius: 14px;
    padding: 25px;
    margin: 0 20px 20px;
    min-height: 500px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
    transition: all var(--transition-speed);
    position: relative;
}

/* Margen negativo para solapar con el banner */
.main-panel.with-banner {
    margin-top: 10px;
    border-radius: 16px 16px 14px 14px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 15px;
}

.panel-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-actions {
    display: flex;
    gap: 10px;
}

.panel-actions .btn {
    border-radius: 6px;
    padding: 8px 16px;
    font-size: .9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-speed);
}

.panel-actions .btn:hover {
    transform: translateY(-2px);
}

.panel-content {
    color: #555;
    padding: 10px 0;
    min-height: 400px;
    overflow: visible;
}

/* ══════════════════════════════════════════════════════════
   STATS CARDS — Tarjetas de resumen sobre el panel
══════════════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f4f8;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-card-icon.blue {
    background: #eff6ff;
    color: #2563eb;
}

.stat-card-icon.green {
    background: #f0fdf4;
    color: #16a34a;
}

.stat-card-icon.orange {
    background: #fff7ed;
    color: #ea580c;
}

.stat-card-icon.purple {
    background: #faf5ff;
    color: #9333ea;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card-sub {
    font-size: 0.72rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-card-sub .trend-up {
    color: #16a34a;
    font-weight: 700;
}

.stat-card-sub .trend-down {
    color: #dc2626;
    font-weight: 700;
}

/* ══════════════════════════════════════════════════════════
   TABLE TABS — Pestañas de filtro rápido
══════════════════════════════════════════════════════════ */
.table-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    border-bottom: 2px solid #f1f5f9;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.table-tab {
    padding: 8px 14px;
    border-radius: 8px 8px 0 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border: none;
    background: transparent;
    position: relative;
    bottom: -2px;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.table-tab:hover {
    color: var(--primary-color);
    background: #f8fafc;
}

.table-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: #f0f6ff;
}

.table-tab .tab-count {
    background: #e2e8f0;
    color: #475569;
    border-radius: 20px;
    padding: 1px 7px;
    font-size: 0.7rem;
    font-weight: 700;
}

.table-tab.active .tab-count {
    background: var(--primary-color);
    color: white;
}


/* ══════════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════════ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.table-hover tbody tr {
    transition: all .2s ease;
    position: relative;
}

.table-custom thead th {
    white-space: nowrap !important;
    vertical-align: middle !important;
    background-color: #f8fafc !important;
    color: #475569 !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.025em !important;
    font-size: 0.7rem !important;
    padding: 12px 15px !important;
}

/* Nuevos estilos para la tabla de usuarios (Premium) */
.user-avatar {
    width: 35px;
    height: 35px;
    background-color: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.7rem;
    margin-right: 12px;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
}

.status-badge {
    padding: 5px 10px;
    border-radius: 30px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

.status-active {
    background-color: #ecfdf5;
    color: #10b981;
}

.status-inactive {
    background-color: #f1f5f9;
    color: #94a3b8;
}

.status-private {
    background-color: #eff6ff;
    color: #2563eb;
}

.status-link {
    background-color: #fff7ed;
    color: #ea580c;
}

.status-hidden {
    background-color: #faf5ff;
    color: #9333ea;
}

.table-custom thead th {
    background-color: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 15px !important;
}

.table-custom tbody td {
    padding: 12px 15px !important;
    vertical-align: middle;
    color: #334155;
    font-size: 0.8rem;
    border-bottom: 1px solid #f1f5f9;
}

.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

/* Custom Search Box for DataTables */
.div.dt-container div.dt-search input {
    width: 550px !important;
}

.dataTables_filter {
    margin-bottom: 0 !important;
    display: flex;
    align-items: center;
}

.dataTables_filter input {
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 6px 12px 6px 35px !important;
    width: 400px !important;
    max-width: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' class='bi bi-search' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    transition: all 0.2s ease !important;
}

.dataTables_filter label {
    font-size: 0;
    /* Ocultar "Buscar:" */
    position: relative;
}

/* Botón Primario Personalizado */
.btn-primary-custom {
    background-color: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
}

.btn-primary-custom:hover {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    opacity: 0.9;
}

.btn-secondary-custom {
    background-color: #f8f9fa !important;
    color: #64748b !important;
    border-color: #e2e8f0 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
}

.btn-secondary-custom:hover {
    background-color: white !important;
    color: #333333 !important;
    opacity: 0.9;
}

/* DataTables Footer (Info & Paginate - Bootstrap 5 Style) */
.dataTables_info {
    font-size: 0.75rem !important;
    color: #64748b !important;
    padding-top: 15px !important;
}

.dataTables_info b {
    color: #334155 !important;
}

.pagination {
    margin-bottom: 0 !important;
    gap: 4px !important;
}

.pagination .page-link {
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    color: #64748b !important;
    padding: 4px 10px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    background-color: #ffffff !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important;
}

.pagination .page-item.disabled .page-link {
    background-color: #f8fafc !important;
    color: #94a3b8 !important;
    opacity: 0.6;
}

.pagination .page-link:hover:not(.active) {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

/* Forzar separación de botones en el Header */
.dt-buttons {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px !important;
    align-items: center !important;
}

.dt-buttons .btn {
    width: auto !important;
}

/* Estilo específico para botones secundarios del header (Filtros, Columnas, Exportar) */
.dt-buttons .btn-light {
    font-size: 0.75rem !important;
    color: #64748b !important;
    font-weight: 600 !important;
    border-color: #e2e8f0 !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
}

.dt-buttons .btn-light i {
    color: #94a3b8 !important;
    font-size: 0.85rem !important;
}

.dt-buttons .btn-light:hover {
    background-color: #f8fafc !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
}

.dt-buttons .ms-auto {
    margin-left: auto !important;
}

/* ══════════════════════════════════════════════════════════
   MENÚ DESPLEGABLE DE COLUMNAS (COLVIS)
══════════════════════════════════════════════════════════ */
.dt-button-collection {
    border-radius: 8px !important;
    padding: 4px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
}

.dt-button-collection .dropdown-item,
.dt-button-collection .dt-button {
    font-size: 0.75rem !important;
    /* ← Ajusta este valor para el tamaño de la fuente */
    padding: 6px 8px !important;
    /* ← Ajusta este valor para el espaciado interno */
    color: #475569 !important;
    border-radius: 6px !important;
    margin-bottom: 2px !important;
    transition: all 0.2s ease;
}

.dt-button-collection .dropdown-item.active,
.dt-button-collection .dt-button.active {
    background-color: #f1f5f9 !important;
    color: var(--primary-color) !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.dt-button-collection .dropdown-item:hover:not(.active),
.dt-button-collection .dt-button:hover:not(.active) {
    background-color: #f8fafc !important;
    color: #1e293b !important;
}

/* Empujar botones de acción a la derecha en escritorio */
@media (min-width: 769px) {
    .btn-action-right {
        margin-left: auto !important;
    }
}

/* Ajuste fino del buscador fue consolidado más arriba */


.table-hover tbody tr:hover {
    background-color: rgba(26, 35, 126, .05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    z-index: 1002;
}

.table-actions {
    white-space: nowrap;
    width: 120px;
}

.table-checkbox {
    width: 40px;
    text-align: center;
}


/* ══════════════════════════════════════════════════════════
   PROFILE PANEL
══════════════════════════════════════════════════════════ */
.profile-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 280px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, .15);
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px);
    visibility: hidden;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.profile-panel.active {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    animation: slideDown .3s ease;
}

.profile-header {
    padding: 20px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.profile-info h6 {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
}

.profile-info small {
    opacity: .9;
    font-size: .85rem;
}

.profile-menu {
    padding: 10px 0;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: all .2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.profile-menu-item:hover {
    background: #f5f5f5;
    color: var(--primary-color);
    transform: translateX(5px);
}

.profile-menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.profile-menu-item.logout-btn {
    color: var(--danger-color);
}

.profile-menu-item.logout-btn:hover {
    background: rgba(220, 53, 69, .1);
    color: #c82333;
}

.profile-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}


/* ══════════════════════════════════════════════════════════
   NOTIFICATIONS
══════════════════════════════════════════════════════════ */
.notifications-panel {
    position: absolute;
    top: 30px;
    right: 100px;
    width: 380px;
    max-height: 500px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
    z-index: 9998;
    opacity: 0;
    transform: translateY(-10px) scale(.95);
    visibility: hidden;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    border: 1px solid #e0e0e0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notifications-panel.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    animation: notificationSlideDown .3s ease;
}

.notifications-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.notifications-header h6 {
    margin: 0;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1rem;
}

.notifications-header .mark-all-read {
    font-size: .8rem;
    padding: 4px 8px;
    color: var(--primary-color);
    text-decoration: none;
    transition: all .2s ease;
}

.notifications-header .mark-all-read:hover {
    background: rgba(26, 35, 126, .1);
    border-radius: 4px;
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    padding: 10px 0;
}

.notifications-list::-webkit-scrollbar {
    width: 6px;
}

.notifications-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    transition: all .2s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item.unread {
    background: rgba(26, 35, 126, .05);
    border-left-color: var(--primary-color);
}

.notification-item.unread::after {
    content: '';
    position: absolute;
    top: 15px;
    right: 15px;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: pulseDot 2s infinite;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    font-size: 1rem;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-content h6 {
    margin: 0 0 4px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: .9rem;
}

.notification-content p {
    margin: 0 0 4px;
    color: #666;
    font-size: .85rem;
    line-height: 1.4;
}

.notification-content small {
    color: #999;
    font-size: .75rem;
}

.notification-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all .2s ease;
    opacity: 0;
    transform: translateX(5px);
}

.notification-item:hover .notification-close {
    opacity: 1;
    transform: translateX(0);
}

.notification-close:hover {
    color: var(--danger-color);
    background: rgba(220, 53, 69, .1);
}

.notifications-footer {
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    background: #f8f9fa;
}

.view-all-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: all .2s ease;
}

.view-all-link:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.notifications-empty {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.notifications-empty i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: .5;
}


/* ══════════════════════════════════════════════════════════
   WELCOME / QUICK CARDS
══════════════════════════════════════════════════════════ */
.welcome-message {
    max-width: 800px;
    margin: 60px auto;
    text-align: center;
}

.welcome-icon {
    font-size: 5rem;
    color: #e0e0e0;
    margin-bottom: 25px;
    opacity: .7;
}

.welcome-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 600;
}

.welcome-text {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #666;
    margin-bottom: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.quick-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 3px 10px rgba(0, 0, 0, .08);
    transition: all var(--transition-speed);
    height: 100%;
    cursor: pointer;
    border: 2px solid transparent;
    animation: cardFloat 3s ease-in-out infinite;
}

.quick-card:hover {
    animation: none;
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 6px 15px rgba(0, 0, 0, .1);
    border-color: var(--primary-color);
}

.quick-card .card-body {
    padding: 25px;
    text-align: center;
}

.quick-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.quick-card h5 {
    color: var(--dark-color);
    margin-bottom: 10px;
    font-weight: 600;
}

.quick-card p {
    color: #666;
    font-size: .9rem;
    margin-bottom: 0;
}


/* ══════════════════════════════════════════════════════════
   BULK ACTIONS / FORMS / VALIDATION
══════════════════════════════════════════════════════════ */
.bulk-actions {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
    display: none;
}

.bulk-actions.active {
    display: block;
}

.bulk-selection-info {
    font-size: .9rem;
    color: #6c757d;
    margin-left: 15px;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-modal {
    max-width: 800px;
    z-index: 4000;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: .5rem;
}

.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: .5rem .75rem;
    transition: border-color .15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 .25rem rgba(26, 35, 126, .25);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -5px;
}

.form-col {
    padding: 0 5px;
    flex: 1 0 0%;
}

.form-modal .modal-content {
    border-radius: 10px;
    border: none;
}

.form-modal .modal-header {
    background: var(--primary-color);
    color: white;
    border-radius: 10px 10px 0 0;
}

.form-modal .modal-title {
    font-weight: 600;
}

.form-modal .modal-footer {
    background: #f8f9fa;
    border-radius: 0 0 10px 10px;
    padding: 15px 20px;
}

.form-modal .btn-primary {
    background: var(--primary-color);
    border: none;
    padding: 10px 25px;
    font-weight: 500;
    transition: all .3s ease;
}

.form-modal .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, .3);
}

.form-modal .btn-secondary {
    background: #6c757d;
    border: none;
    padding: 10px 25px;
    transition: all .3s ease;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #198754;
}


/* ══════════════════════════════════════════════════════════
   STUDENT VIEW / STAT CARDS
══════════════════════════════════════════════════════════ */
.student-detail-view {
    padding: 15px;
}

.student-avatar {
    width: 120px;
    height: 120px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin: 0 auto 20px;
}

.student-stats {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.stat-card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
    transition: transform .3s ease;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, .1);
}

.stat-card .card-body {
    padding: 20px 10px;
}

.stat-card h3 {
    margin: 10px 0;
    font-weight: bold;
}

.stat-card h6 {
    color: #666;
    font-size: .9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}


/* ══════════════════════════════════════════════════════════
   LOADING OVERLAY / MODAL GLOBAL
══════════════════════════════════════════════════════════ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 100000;
    display: none;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active,
.loading-overlay.activo {
    display: flex;
}

#overlayCargando {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f4f8;
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: none;
}

#overlayCargando.activo {
    opacity: 1;
    pointer-events: all;
}

#overlayCargando .loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

#overlayCargando .spinner-border {
    width: 4.5rem;
    height: 4.5rem;
    color: var(--primary-color);
    border-width: 0.35em;
}

#overlayCargando .cargando-texto {
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: pulseText 1.5s ease-in-out infinite;
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Ocultar navegación durante la carga */
body.loading-active .header-actions,
body.loading-active .sidebar,
body.loading-active .sidebar-overlay,
body.loading-active .btn-hamburguesa,
body.loading-active .tooltip-text {
    display: none !important;
}

#modalGlobal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#modalGlobal #mgContenidoB:empty {
    display: none;
}

.modal.fade .modal-dialog {
    animation: modalSlideUp .3s ease-out;
}

.confirmation-modal .modal-body {
    text-align: center;
    padding: 2rem;
}

.confirmation-icon {
    font-size: 4rem;
    color: var(--danger-color);
    margin-bottom: 1rem;
}

.spinner-border {
    animation: spin 1s linear infinite;
}


/* ══════════════════════════════════════════════════════════
   UTILITY
══════════════════════════════════════════════════════════ */
.text-primary {
    color: var(--primary-color) !important;
}

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

.border-primary {
    border-color: var(--primary-color) !important;
}

.shadow-sm {
    box-shadow: 0 2px 4px rgba(0, 0, 0, .05) !important;
}

.shadow-md {
    box-shadow: 0 4px 8px rgba(0, 0, 0, .1) !important;
}

.rounded-lg {
    border-radius: var(--border-radius) !important;
}

.fade-in {
    animation: none;
}


/* ══════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════ */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes notificationSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cardFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, .7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

@keyframes badgePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

@keyframes pulseDot {
    0% {
        opacity: 1;
    }

    50% {
        opacity: .7;
    }

    100% {
        opacity: 1;
    }
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: .5;
    }

    20% {
        transform: scale(25, 25);
        opacity: .3;
    }

    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes notificationSlideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}


/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Tablet  (≤ 992px)
══════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 220px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-search-bar {
        min-width: 200px;
    }
}


/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Mobile  (≤ 768px)
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Sidebar oculto fuera de pantalla por defecto */
    .sidebar {
        transform: translateX(-100%);
        width: 280px !important;
        /* Más ancho en móvil */
        z-index: 1200;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1150;
        display: none;
        backdrop-filter: blur(2px);
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Main content ocupa todo el ancho */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Top navbar en móvil */
    .top-navbar {
        padding: 0 10px;
        height: 52px;
        gap: 8px;
    }

    /* Hamburguesa visible e integrada al navbar */
    .btn-hamburguesa {
        display: flex;
    }

    /* Buscador: ocupa el espacio disponible entre hamburguesa y acciones */
    .top-navbar-search {
        flex: 1;
        margin: 0;
        min-width: 0;
        max-width: none;
        padding: 5px 10px;
    }

    .top-navbar-search-kbd {
        display: none;
    }

    /* Ocultar breadcrumb completamente en mobile */
    .top-navbar-breadcrumb {
        display: none;
    }

    /* Ocultar botón de ayuda y separador en mobile */
    .top-navbar-btn[title="Ayuda"] {
        display: none;
    }

    .top-navbar-divider {
        display: none;
    }

    /* Acciones del navbar: solo bell + avatar */
    .top-navbar-actions {
        gap: 6px;
        flex-shrink: 0;
    }

    .top-navbar-btn {
        width: 34px;
        height: 34px;
    }

    .top-navbar-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }

    /* Header ajustado */
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 15px 90px;
        margin-bottom: 0;
        gap: 12px;
        height: 10px;
    }

    .header-search-bar {
        width: 100%;
        max-width: 100%;
        min-width: unset;
    }

    .header-actions {
        position: absolute;
        top: 12px;
        right: 15px !important;
    }

    .header-title {
        width: 100%;
        margin-top: 5px;
    }

    .header-title h1 {
        font-size: 1.2rem;
        line-height: 1.3;
    }

    .header-title .subtitle {
        font-size: .85rem;
        opacity: 0.8;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }

    .main-panel.with-banner {
        margin-top: 10px !important;
        margin-left: 8px !important;
        margin-right: 8px !important;
    }

    .table-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* Ajustes para DataTables en móvil */
    .dt-custom-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    /* El wrapper interno ms-auto que contiene los botones debe ocupar todo el ancho */
    .dt-custom-header>div {
        width: 100% !important;
        margin: 0 !important;
    }

    .dataTables_filter,
    .dataTables_filter input {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .dt-buttons {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .dt-buttons .btn,
    .dt-buttons .btn-group {
        width: 100% !important;
        margin: 0 !important;
        display: flex !important;
        justify-content: center !important;
    }

    .dt-buttons .btn-group .btn {
        width: 100% !important;
    }

    .btn-primary-custom {
        width: 100% !important;
    }

    /* Panel principal en móvil */
    .main-panel {
        margin: 0 10px 15px !important;
        padding: 15px !important;
        border-radius: 0 !important;
        /* Aprovechar más espacio */
    }

    .panel-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .panel-actions {
        justify-content: center;
    }

    /* Welcome */
    .welcome-message {
        margin: 30px auto;
    }

    .welcome-icon {
        font-size: 3.5rem;
    }

    .welcome-title {
        font-size: 1.4rem;
    }

    .welcome-text {
        font-size: .95rem;
    }

    /* Paneles deslizables desde abajo */
    .profile-panel,
    .notifications-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: var(--border-radius) var(--border-radius) 0 0;
        transform: translateY(100%);
    }

    .profile-panel.active {
        transform: translateY(0);
        animation: slideUp .3s ease;
    }

    .notifications-panel.active {
        transform: translateY(0);
        animation: notificationSlideUp .3s ease;
    }

    .notifications-header,
    .notifications-footer {
        padding: 12px 15px;
    }

    .notification-item {
        padding: 12px 15px;
    }

    /* Stackable Table desactivado temporalmente para priorizar scroll horizontal estándar */
    .table-responsive {
        border: none !important;
    }

    .table-custom td,
    .table-custom th {
        padding: 8px 6px !important;
        font-size: 0.65rem !important;
    }

    /* Permitir que las celdas de contenido se ajusten, pero evitar que rompa palabras cortas */
    .table-custom tbody td {
        white-space: normal !important;
        word-break: normal;
        /* Cambiado de break-word a normal para evitar roturas feas */
    }

    .status-badge {
        padding: 3px 8px !important;
        font-size: 0.6rem !important;
        white-space: nowrap !important;
        /* Evitar que el badge se rompa */
    }

    /* Forzar que la tabla ocupe todo el ancho disponible */
    .dataTables_scrollHeadInner,
    .dataTables_scrollHeadInner table,
    .dataTables_scrollBody table {
        width: 100% !important;
    }
}


/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Small  (≤ 576px)
══════════════════════════════════════════════════════════ */
@media (max-width: 576px) {
    .header-title h1 {
        font-size: 1.1rem;
    }

    .main-panel {
        padding: 15px;
    }

    .quick-card .card-body {
        padding: 18px;
    }
}


/* ══════════════════════════════════════════════════════════
DARK MODE (notificaciones)
══════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
    .notifications-panel {
        background: #fff;
        border-color: #4a5568;
    }

    .notifications-header,
    .notifications-footer {
        background: #fff;
        border-color: #000;
    }

    .notification-item:hover {
        background: #f0f4f8;
    }

    .notification-item.unread {
        background: rgba(66, 153, 225, .1);
    }

    .notification-content h6,
    .notification-content p {
        color: #000;
    }

    .view-all-link {
        color: #63b3ed;
    }

    .view-all-link:hover {
        color: #90cdf4;
    }
}

/* ══════════════════════════════════════════════════════════
Propios (notificaciones)
══════════════════════════════════════════════════════════ */
::placeholder {
    color: #adb5bd !important;
    opacity: 1;
}