/* ================================================================
   PLAVIA — Sistema de Diseño Principal
   SaaS Multi-Tenant Platform para Institutos Educativos
   ================================================================ */

/* ── Google Fonts ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ── Variables del Sistema de Diseño ─────────────────────────── */
:root,
[data-bs-theme="dark"],
[data-theme="dark"] {
    /* Colores Primarios PLAVIA */
    --plavia-primary:        #6C63FF;
    --plavia-primary-dark:   #5A52E0;
    --plavia-primary-light:  #8B85FF;
    --plavia-primary-glow:   rgba(108, 99, 255, 0.25);
    --plavia-secondary:      #FF6584;
    --plavia-secondary-dark: #E0506F;
    --plavia-accent:         #22C55E;

    /* Fondos (modo oscuro) */
    --bg-app:        #0A0918;
    --bg-sidebar:    #0F0E1A;
    --bg-card:       #151424;
    --bg-card-hover: #1C1B30;
    --bg-input:      #1A1930;
    --bg-modal:      #13122A;
    --bg-topbar:     rgba(15, 14, 26, 0.94);

    /* Bordes */
    --border-color:    #2A2850;
    --border-focus:    var(--plavia-primary);

    /* Texto */
    --text-primary:   #E2E8F0;
    --text-secondary: #94A3B8;
    --text-muted:     #64748B;
    --text-heading:   #F1F5F9;

    /* Estados */
    --color-success:  #22C55E;
    --color-warning:  #F59E0B;
    --color-danger:   #EF4444;
    --color-info:     #3B82F6;

    /* Tipografía */
    --font-sans:    'Inter', system-ui, sans-serif;
    --font-display: 'Outfit', system-ui, sans-serif;

    /* Espaciado / Tamaños */
    --sidebar-width:     260px;
    --sidebar-collapsed: 72px;
    --topbar-height:     64px;
    --border-radius:     12px;
    --border-radius-sm:  8px;
    --border-radius-lg:  16px;

    /* Transiciones */
    --transition:     all 0.2s ease;
    --transition-slow: all 0.35s ease;

    /* Sombras */
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg:   0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 24px var(--plavia-primary-glow);
}

/* ── Variables de Modo Claro (Light / White Mode) ─────────────── */
[data-bs-theme="light"],
[data-theme="light"] {
    /* Fondos (modo blanco / claro) */
    --bg-app:        #F8FAFC;
    --bg-sidebar:    #FFFFFF;
    --bg-card:       #FFFFFF;
    --bg-card-hover: #F1F5F9;
    --bg-input:      #FFFFFF;
    --bg-modal:      #FFFFFF;
    --bg-topbar:     rgba(255, 255, 255, 0.94);

    /* Bordes */
    --border-color:    #E2E8F0;
    --border-focus:    var(--plavia-primary);

    /* Texto */
    --text-primary:   #0F172A;
    --text-secondary: #334155;
    --text-muted:     #64748B;
    --text-heading:   #0F172A;

    /* Sombras */
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.06);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.07);
    --shadow-lg:   0 10px 30px rgba(0,0,0,0.09);
    --shadow-glow: 0 0 24px rgba(108, 99, 255, 0.15);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar personalizado ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-app); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--plavia-primary); }

/* ================================================================
   LAYOUT PRINCIPAL — Sidebar + Topbar + Content
   ================================================================ */

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

/* ── SIDEBAR ───────────────────────────────────────────────────── */
.plavia-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
    overflow: hidden;
}

.plavia-sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

/* Logo del sidebar */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    min-height: var(--topbar-height);
}

.sidebar-brand-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--plavia-primary), var(--plavia-secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
    box-shadow: var(--shadow-glow);
}

.sidebar-brand-text {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--plavia-primary-light), var(--plavia-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

/* Instituto badge en sidebar */
.sidebar-tenant-badge {
    margin: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-tenant-badge img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
}

.sidebar-tenant-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-tenant-role {
    font-size: 10px;
    color: var(--text-muted);
}

/* Navegación */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 20px 6px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 0;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.sidebar-nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.sidebar-nav-item.active {
    color: var(--plavia-primary-light);
    background: linear-gradient(90deg, rgba(108,99,255,0.12), transparent);
    font-weight: 600;
}

.sidebar-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--plavia-primary), var(--plavia-secondary));
    border-radius: 0 3px 3px 0;
}

.sidebar-nav-item .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}

.sidebar-nav-item.active .nav-icon { opacity: 1; }

.sidebar-nav-badge {
    margin-left: auto;
    background: var(--plavia-primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
}

/* Footer del sidebar */
.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px;
}

/* ── TOPBAR ────────────────────────────────────────────────────── */
.plavia-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-topbar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    transition: var(--transition-slow);
}

.topbar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.topbar-toggle:hover { background: var(--bg-card); color: var(--text-primary); }

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
}

.topbar-breadcrumb a { color: var(--text-muted); text-decoration: none; transition: var(--transition); }
.topbar-breadcrumb a:hover { color: var(--text-primary); }
.topbar-breadcrumb .current { color: var(--text-primary); font-weight: 500; }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Botón de iconos en topbar */
.topbar-icon-btn {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.topbar-icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--plavia-primary);
    background: var(--bg-card-hover);
}

.topbar-icon-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    border: 2px solid var(--bg-topbar);
}

/* Avatar usuario topbar */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 40px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.topbar-user:hover { border-color: var(--plavia-primary); }

.topbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--plavia-primary);
}

.topbar-user-info { display: flex; flex-direction: column; }
.topbar-user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.topbar-user-role { font-size: 10px; color: var(--text-muted); }

/* ── MAIN CONTENT ──────────────────────────────────────────────── */
.plavia-main {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
    transition: var(--transition-slow);
    flex: 1;
}

.plavia-content {
    padding: 28px 28px;
    max-width: 100%;
}

/* ================================================================
   COMPONENTES — Cards, Tables, Badges, Forms
   ================================================================ */

/* ── Stat Cards (Dashboard KPIs) ───────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 22px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--plavia-primary), var(--plavia-secondary));
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover { border-color: var(--plavia-primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card:hover::before { opacity: 1; }

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.stat-card-icon.purple  { background: rgba(108,99,255,0.15); color: var(--plavia-primary-light); }
.stat-card-icon.pink    { background: rgba(255,101,132,0.15); color: var(--plavia-secondary); }
.stat-card-icon.green   { background: rgba(34,197,94,0.15);  color: var(--color-success); }
.stat-card-icon.amber   { background: rgba(245,158,11,0.15); color: var(--color-warning); }
.stat-card-icon.blue    { background: rgba(59,130,246,0.15); color: var(--color-info); }

.stat-card-body { flex: 1; }
.stat-card-value { font-size: 28px; font-weight: 800; font-family: var(--font-display); color: var(--text-heading); line-height: 1; }
.stat-card-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.stat-card-change {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.stat-card-change.up   { color: var(--color-success); }
.stat-card-change.down { color: var(--color-danger); }

/* ── Cards generales ───────────────────────────────────────────── */
.plavia-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.plavia-card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.plavia-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-heading);
    font-family: var(--font-display);
    display: flex;
    align-items: center;
    gap: 8px;
}

.plavia-card-body { padding: 22px; }

/* ── Tablas ────────────────────────────────────────────────────── */
.plavia-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.plavia-table-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.plavia-table {
    width: 100%;
    border-collapse: collapse;
}

.plavia-table thead th {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-app);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    text-align: left;
}

.plavia-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.plavia-table tbody tr:last-child { border-bottom: none; }
.plavia-table tbody tr:hover { background: var(--bg-card-hover); }

.plavia-table tbody td {
    padding: 13px 16px;
    font-size: 13.5px;
    color: var(--text-primary);
    vertical-align: middle;
}

/* ── Badges de Estado ──────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-badge.active    { background: rgba(34,197,94,0.12);  color: #4ADE80; }
.status-badge.active::before { background: #22C55E; }
.status-badge.inactive  { background: rgba(100,116,139,0.15); color: #94A3B8; }
.status-badge.inactive::before { background: #64748B; }
.status-badge.suspended { background: rgba(239,68,68,0.12);  color: #F87171; }
.status-badge.suspended::before { background: #EF4444; }
.status-badge.pending   { background: rgba(245,158,11,0.12); color: #FCD34D; }
.status-badge.pending::before { background: #F59E0B; }
.status-badge.trial     { background: rgba(59,130,246,0.12); color: #60A5FA; }
.status-badge.trial::before { background: #3B82F6; }

/* ── Rol Badges ────────────────────────────────────────────────── */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.role-badge.super_admin     { background: rgba(108,99,255,0.2); color: var(--plavia-primary-light); border: 1px solid rgba(108,99,255,0.3); }
.role-badge.institute_owner { background: rgba(255,101,132,0.15); color: #FF8FA3; border: 1px solid rgba(255,101,132,0.3); }
.role-badge.instructor      { background: rgba(245,158,11,0.15); color: #FCD34D; border: 1px solid rgba(245,158,11,0.3); }
.role-badge.student         { background: rgba(34,197,94,0.12); color: #4ADE80; border: 1px solid rgba(34,197,94,0.3); }

/* ── Avatar ────────────────────────────────────────────────────── */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.user-avatar-sm { width: 28px; height: 28px; }
.user-avatar-lg { width: 52px; height: 52px; }

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-cell-info {}
.user-cell-name  { font-weight: 600; color: var(--text-primary); font-size: 13.5px; }
.user-cell-email { font-size: 12px; color: var(--text-muted); }

/* ── Formularios ───────────────────────────────────────────────── */
.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.form-control, .form-select {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm) !important;
    color: var(--text-primary) !important;
    font-size: 13.5px !important;
    padding: 10px 14px !important;
    transition: var(--transition) !important;
    width: 100%;
}

.form-control:focus, .form-select:focus {
    border-color: var(--plavia-primary) !important;
    box-shadow: 0 0 0 3px var(--plavia-primary-glow) !important;
    outline: none !important;
}

.form-control::placeholder { color: var(--text-muted) !important; }

textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Botones ───────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--plavia-primary), var(--plavia-primary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(108,99,255,0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(108,99,255,0.45);
    color: white;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    border-color: var(--plavia-primary);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.btn-danger  { background: rgba(239,68,68,0.15); color: #F87171; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover  { background: rgba(239,68,68,0.25); color: #FCA5A5; }
.btn-success { background: rgba(34,197,94,0.15);  color: #4ADE80; border: 1px solid rgba(34,197,94,0.3); }
.btn-success:hover { background: rgba(34,197,94,0.25); color: #86EFAC; }
.btn-warning { background: rgba(245,158,11,0.15); color: #FCD34D; border: 1px solid rgba(245,158,11,0.3); }
.btn-warning:hover { background: rgba(245,158,11,0.25); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 9px;  font-size: 11px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ── Búsqueda ──────────────────────────────────────────────────── */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input-wrapper .form-control {
    padding-left: 38px !important;
}

/* ── Page Header ───────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header-left {}
.page-title {
    font-size: 22px;
    font-weight: 800;
    font-family: var(--font-display);
    color: var(--text-heading);
    margin: 0 0 4px;
}

.page-subtitle { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ── Paginación ────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.page-link {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    transition: var(--transition);
    text-decoration: none;
}

.page-link:hover { border-color: var(--plavia-primary); color: var(--text-primary); }
.page-item.active .page-link { background: var(--plavia-primary); border-color: var(--plavia-primary); color: white; }
.page-item.disabled .page-link { opacity: 0.4; pointer-events: none; }

/* ── Alertas flash ─────────────────────────────────────────────── */
.plavia-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 13.5px;
    margin-bottom: 20px;
    border: 1px solid;
}

.plavia-alert.success { background: rgba(34,197,94,0.08);  border-color: rgba(34,197,94,0.3);  color: #4ADE80; }
.plavia-alert.error   { background: rgba(239,68,68,0.08);  border-color: rgba(239,68,68,0.3);  color: #F87171; }
.plavia-alert.warning { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.3); color: #FCD34D; }
.plavia-alert.info    { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.3); color: #60A5FA; }

/* ── Modales ───────────────────────────────────────────────────── */
.modal-content {
    background: var(--bg-modal) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-lg) !important;
    color: var(--text-primary) !important;
}

.modal-header {
    border-bottom: 1px solid var(--border-color) !important;
    padding: 18px 22px !important;
}

.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; }

.modal-footer {
    border-top: 1px solid var(--border-color) !important;
    padding: 14px 22px !important;
}

.btn-close { filter: invert(1) !important; opacity: 0.6 !important; }
.btn-close:hover { opacity: 1 !important; }

/* ── Dropdown Bootstrap override ───────────────────────────────── */
.dropdown-menu {
    background: var(--bg-modal) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 6px !important;
    box-shadow: var(--shadow-lg) !important;
}

.dropdown-item {
    color: var(--text-secondary) !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    transition: var(--transition) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.dropdown-item:hover { background: var(--bg-card-hover) !important; color: var(--text-primary) !important; }
.dropdown-item.text-danger { color: #F87171 !important; }
.dropdown-divider { border-color: var(--border-color) !important; }

/* ── Tabs ──────────────────────────────────────────────────────── */
.plavia-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.plavia-tab {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.plavia-tab:hover { color: var(--text-primary); }
.plavia-tab.active { color: var(--plavia-primary-light); border-bottom-color: var(--plavia-primary); font-weight: 600; }

/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    background: var(--bg-input);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 28px;
}

.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-desc  { font-size: 13px; margin-bottom: 20px; }

/* ── Tooltips ──────────────────────────────────────────────────── */
[data-bs-toggle="tooltip"] { cursor: pointer; }

/* ── Animaciones ───────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 var(--plavia-primary-glow); }
    50%       { box-shadow: 0 0 0 8px transparent; }
}

.fade-in-up { animation: fadeInUp 0.35s ease forwards; }

/* Aplicar delay escalonado a tarjetas */
.fade-in-up:nth-child(1) { animation-delay: 0.05s; }
.fade-in-up:nth-child(2) { animation-delay: 0.10s; }
.fade-in-up:nth-child(3) { animation-delay: 0.15s; }
.fade-in-up:nth-child(4) { animation-delay: 0.20s; }

/* ── Vista de Auth ─────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-app);
    position: relative;
    overflow: hidden;
}

.auth-bg-gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 20% 20%, rgba(108,99,255,0.15), transparent),
        radial-gradient(ellipse 50% 60% at 80% 80%, rgba(255,101,132,0.10), transparent);
    pointer-events: none;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}

.auth-logo-mark {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--plavia-primary), var(--plavia-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 20px;
    color: white;
    box-shadow: var(--shadow-glow);
}

.auth-logo-text {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--plavia-primary-light), var(--plavia-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-title { font-size: 20px; font-weight: 700; font-family: var(--font-display); color: var(--text-heading); margin-bottom: 6px; }
.auth-subtitle { font-size: 13.5px; color: var(--text-muted); margin-bottom: 28px; }
.auth-divider { color: var(--text-muted); font-size: 12px; text-align: center; margin: 16px 0; }
.auth-footer-text { font-size: 12.5px; color: var(--text-muted); text-align: center; margin-top: 20px; }
.auth-footer-text a { color: var(--plavia-primary-light); text-decoration: none; font-weight: 500; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 991px) {
    .plavia-sidebar {
        left: calc(-1 * var(--sidebar-width));
    }
    .plavia-sidebar.mobile-open {
        left: 0;
        box-shadow: var(--shadow-lg);
    }
    .plavia-topbar { left: 0; }
    .plavia-main   { margin-left: 0; }
    .plavia-content { padding: 20px 16px; }
}

@media (max-width: 576px) {
    .stat-card { padding: 16px; }
    .stat-card-value { font-size: 22px; }
    .page-title { font-size: 18px; }
    .auth-card { padding: 28px 20px; margin: 16px; }
}

/* ================================================================
   MODO CLARO (LIGHT / WHITE THEME) — Reglas y Componentes
   ================================================================ */

[data-bs-theme="light"],
[data-theme="light"] {
    color-scheme: light;
}

[data-bs-theme="light"] body,
[data-theme="light"] body {
    background-color: var(--bg-app) !important;
    color: var(--text-primary) !important;
}

/* Tablas en modo claro */
[data-bs-theme="light"] .plavia-table thead th {
    background: #F1F5F9;
    color: #475569;
    border-bottom: 1px solid var(--border-color);
}

[data-bs-theme="light"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    color: var(--text-primary);
}

[data-bs-theme="light"] .table-dark {
    --bs-table-bg: #F8FAFC !important;
    --bs-table-color: #0F172A !important;
    --bs-table-border-color: #E2E8F0 !important;
}

/* Formularios e Inputs */
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select {
    background-color: #FFFFFF !important;
    border-color: #CBD5E1 !important;
    color: #0F172A !important;
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
    border-color: var(--plavia-primary) !important;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15) !important;
}

[data-bs-theme="light"] .input-group-text {
    background-color: #F1F5F9 !important;
    border-color: #CBD5E1 !important;
    color: #475569 !important;
}

/* Tarjetas y Contenedores */
[data-bs-theme="light"] .card,
[data-bs-theme="light"] .plavia-card {
    background: #FFFFFF !important;
    border-color: #E2E8F0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="light"] .bg-dark {
    background-color: #FFFFFF !important;
}

[data-bs-theme="light"] .bg-black {
    background-color: #F8FAFC !important;
}

[data-bs-theme="light"] .border-secondary {
    border-color: #E2E8F0 !important;
}

[data-bs-theme="light"] .border-dark {
    border-color: #E2E8F0 !important;
}

/* Textos de alto contraste en modo claro */
[data-bs-theme="light"] .text-white {
    color: #0F172A !important;
}

[data-bs-theme="light"] .text-white-50 {
    color: #475569 !important;
}

[data-bs-theme="light"] .text-light {
    color: #334155 !important;
}

[data-bs-theme="light"] .text-muted {
    color: #64748B !important;
}

/* Modales y Dropdowns */
[data-bs-theme="light"] .modal-content {
    background: #FFFFFF !important;
    border-color: #E2E8F0 !important;
    color: #0F172A !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
}

[data-bs-theme="light"] .dropdown-menu {
    background: #FFFFFF !important;
    border-color: #E2E8F0 !important;
    color: #0F172A !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

[data-bs-theme="light"] .dropdown-item {
    color: #334155 !important;
}

[data-bs-theme="light"] .dropdown-item:hover {
    background: #F1F5F9 !important;
    color: var(--plavia-primary) !important;
}

[data-bs-theme="light"] .btn-close {
    filter: none !important;
    opacity: 0.5 !important;
}

[data-bs-theme="light"] .btn-close-white {
    filter: none !important;
}

[data-bs-theme="light"] .accordion-button {
    background-color: #FFFFFF !important;
    color: #0F172A !important;
}

[data-bs-theme="light"] .accordion-button:not(.collapsed) {
    background-color: #F8FAFC !important;
    color: var(--plavia-primary) !important;
}

[data-bs-theme="light"] .nav-tabs .nav-link {
    color: #64748B !important;
}

[data-bs-theme="light"] .nav-tabs .nav-link.active {
    background-color: transparent !important;
    color: var(--plavia-primary) !important;
    border-bottom-color: var(--plavia-primary) !important;
}

/* Botón de alternancia de tema */
.theme-toggle-btn {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    color: var(--plavia-primary);
    border-color: var(--plavia-primary);
    background: var(--bg-card-hover);
    transform: rotate(15deg);
}

[data-bs-theme="light"] .theme-toggle-btn .bi-sun-fill {
    display: none;
}

[data-bs-theme="light"] .theme-toggle-btn .bi-moon-stars-fill {
    display: inline-block;
    color: #6366F1;
}

[data-bs-theme="dark"] .theme-toggle-btn .bi-moon-stars-fill,
:root:not([data-bs-theme="light"]) .theme-toggle-btn .bi-moon-stars-fill {
    display: none;
}

[data-bs-theme="dark"] .theme-toggle-btn .bi-sun-fill,
:root:not([data-bs-theme="light"]) .theme-toggle-btn .bi-sun-fill {
    display: inline-block;
    color: #F59E0B;
}

