/* ==========================================================================
   IESP Control de Sesiones Pedagógicas - Premium Design System Theme
   ========================================================================== */


:root {
    /* Color Tokens */
    --iesp-primary: #4f46e5;
    --iesp-primary-light: #6366f1;
    --iesp-primary-dark: #4338ca;
    --iesp-secondary: #7c3aed;
    --iesp-secondary-light: #8b5cf6;
    --iesp-accent: #0891b2;
    --iesp-accent-light: #06b6d4;
    
    --iesp-bg: #f8fafc;
    --iesp-card: rgba(255, 255, 255, 0.95);
    --iesp-card-solid: #ffffff;
    --iesp-border: rgba(226, 232, 240, 0.85);
    --iesp-border-subtle: rgba(203, 213, 225, 0.5);
    
    --iesp-text: #0f172a;
    --iesp-text-muted: #64748b;
    --iesp-text-light: #94a3b8;
    
    --iesp-success: #10b981;
    --iesp-success-bg: rgba(16, 185, 129, 0.1);
    --iesp-danger: #ef4444;
    --iesp-danger-bg: rgba(239, 68, 68, 0.1);
    --iesp-warn: #f59e0b;
    --iesp-warn-bg: rgba(245, 158, 11, 0.1);
    --iesp-info: #3b82f6;
    --iesp-info-bg: rgba(59, 130, 246, 0.1);

    /* Admin Specific Theme Overrides */
    --admin-primary: #7c3aed;
    --admin-secondary: #4f46e5;
    --admin-accent: #f59e0b;
    --admin-bg: #f8fafc;
    --admin-card: #ffffff;
    --admin-border: rgba(226, 232, 240, 0.85);
    --admin-hover: rgba(124, 58, 237, 0.06);

    /* Elevation Shadows */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
    --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
    --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
    --shadow-glow: 0 8px 24px -4px rgba(79, 70, 229, 0.25);
    
    /* Transitions */
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Global Reset & Base Typography */
* {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    box-sizing: border-box;
}

body {
    background: var(--iesp-bg);
    color: var(--iesp-text);
    line-height: 1.6;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Override bootstrap dark text rule to prevent pure black */
.text-dark {
    color: var(--iesp-text) !important;
}

/* Smooth Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Sidebar Layout */
.sidebar {
    width: 260px;
    width: 260px;
    max-width: 260px;
    box-sizing: border-box;
    height: 100vh;
    max-height: 100vh;
    background: #ffffff;
    border-right: 1px solid rgba(226, 232, 240, 0.85);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.035);
    display: flex;
    flex-direction: column;
}

.sidebar-scrollable {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(203, 213, 225, 0.6) transparent;
    padding-bottom: 1.25rem;
}

.sidebar-scrollable::-webkit-scrollbar {
    width: 4px;
}
.sidebar-scrollable::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scrollable::-webkit-scrollbar-thumb {
    background: rgba(203, 213, 225, 0.6);
    border-radius: 4px;
}
.sidebar-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.8);
}

.sidebar-logo {
    padding: 1.1rem 1.15rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    flex-shrink: 0;
}

.sidebar-logo .badge-icon, .badge-icon, .admin-badge {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--iesp-primary), var(--iesp-secondary));
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    flex-shrink: 0;
}

.sidebar-section-header, .nav-section {
    padding: 0.85rem 1.15rem 0.3rem;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}
.sidebar-section-header:hover {
    color: var(--iesp-primary);
}

.sidebar-section-header .chevron-icon {
    font-size: 0.65rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #94a3b8;
}

[data-bs-toggle="collapse"]:not(.collapsed) .chevron-icon,
[data-bs-toggle="collapse"][aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

.sidebar .nav-item {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.sidebar .nav-link {
    color: #475569 !important;
    border-radius: 10px;
    margin: 2px 10px;
    padding: 0.52rem 0.8rem !important;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
}

.sidebar .nav-link .nav-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar .nav-link i {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.sidebar .nav-link:hover {
    background: rgba(241, 245, 249, 0.9) !important;
    color: var(--iesp-primary) !important;
    transform: translateX(3px);
}

.sidebar .nav-link:hover i {
    transform: scale(1.15);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.12) 0%, rgba(124, 58, 237, 0.08) 100%) !important;
    color: var(--iesp-primary) !important;
    font-weight: 700;
    box-shadow: inset 3.5px 0 0 0 var(--iesp-primary), 0 2px 8px rgba(79, 70, 229, 0.06);
}
.sidebar .nav-link.active i {
    color: var(--iesp-primary) !important;
}

.sidebar-footer-widget {
    padding: 0.85rem 1.15rem;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    flex-shrink: 0;
    margin-top: auto;
}

.cursor-pointer {
    cursor: pointer !important;
}

/* Main Content Wrapper */
.main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 2rem 2.25rem;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Header & Page Containers */
.page-header {
    background: #ffffff;
    border: 1px solid var(--iesp-border);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-sm);
    background-image: radial-gradient(circle at 95% 20%, rgba(79, 70, 229, 0.03) 0%, transparent 40%);
}

/* Card Modern Components */
.card-stat, .metric-card {
    background: #ffffff;
    border: 1px solid var(--iesp-border);
    border-radius: 16px;
    padding: 1.35rem 1.5rem;
    transition: var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.card-stat:hover, .metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(79, 70, 229, 0.25);
}

.stat-icon, .metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    transition: var(--transition-bounce);
}

.card-stat:hover .stat-icon, .metric-card:hover .metric-icon {
    transform: scale(1.08);
}

/* Detailed Dark/Light Container Cards */
.card-dark {
    background: #ffffff;
    border: 1px solid var(--iesp-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.card-dark:hover {
    box-shadow: var(--shadow-md);
}

.card-dark-header, .card-header-dark {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--iesp-border);
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    font-weight: 700;
}

/* Modern Tables & Table-Dark Override */
.table-dark,
.table-dark th,
.table-dark td,
.table-dark thead th {
    background-color: #ffffff !important;
    color: var(--iesp-text) !important;
    border-color: var(--iesp-border) !important;
}

.table-dark tbody tr:hover td {
    background-color: rgba(79, 70, 229, 0.04) !important;
}

.table-dark-custom {
    background: #ffffff;
    border: 1px solid var(--iesp-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-dark-custom thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--iesp-border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--iesp-text-muted);
    font-weight: 700;
    padding: 1rem 1.25rem;
}

.table-dark-custom tbody tr {
    border-bottom: 1px solid var(--iesp-border);
    transition: background 0.15s ease;
}

.table-dark-custom tbody tr:hover {
    background: rgba(79, 70, 229, 0.025) !important;
}

.table-dark-custom tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

/* Badges & Chips */
.badge-estado, .estado-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.45em 0.85em;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.2px;
}

.badge-tiempo-ok {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-tiempo-late {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Pagination Styles */
.pagination .page-link {
    color: var(--iesp-text-muted);
    border-color: var(--iesp-border);
    border-radius: 8px !important;
    margin: 0 3px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    transition: var(--transition-fast);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--iesp-primary), var(--iesp-secondary)) !important;
    border-color: transparent !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.pagination .page-link:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--iesp-primary);
}

/* Buttons */
.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    transition: var(--transition-fast);
}

.btn-primary-custom, .btn-login {
    background: linear-gradient(135deg, var(--iesp-primary), var(--iesp-secondary));
    border: none;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.28);
}

.btn-primary-custom:hover, .btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.38);
}

.btn-primary-custom:active, .btn-login:active {
    transform: translateY(0);
}

/* Inputs & Form Control */
.form-control, .form-select {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: var(--iesp-text) !important;
    border-radius: 10px !important;
    padding: 0.65rem 0.9rem !important;
    font-size: 0.88rem;
    transition: var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    border-color: var(--iesp-primary) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
    background: #ffffff !important;
}

/* Modal Polish */
.modal-content {
    background: #ffffff;
    border: 1px solid var(--iesp-border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--iesp-border);
    padding: 1.25rem 1.75rem;
    background: #f8fafc;
}

.modal-footer {
    border-top: 1px solid var(--iesp-border);
    padding: 1rem 1.75rem;
    background: #f8fafc;
}

.modal-backdrop.show {
    opacity: 0.4;
    backdrop-filter: blur(4px);
}

/* ── Estilos de Calendario Semanal y Sombreado de Clase Activa ── */
.tr-dictando-ahora {
    background: rgba(79, 70, 229, 0.08) !important;
    border-left: 4px solid var(--iesp-primary) !important;
}

.calendar-card-class {
    border-radius: 10px;
    padding: 0.75rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    margin-bottom: 0.6rem;
}

.calendar-card-class.active-now {
    border: 2px solid var(--iesp-primary) !important;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.14), rgba(99, 102, 241, 0.22)) !important;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.25) !important;
    position: relative;
}

.calendar-card-class.active-now::after {
    content: 'En Curso';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.64rem;
    font-weight: 700;
    color: var(--iesp-primary);
    background: #ffffff;
    padding: 2px 7px;
    border-radius: 12px;
    border: 1px solid rgba(79, 70, 229, 0.3);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* ── Administrative & Specific Utility Classes ── */
.crud-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.crud-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-admin {
    margin: 0;
}

.table-admin thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--admin-border) !important;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    font-weight: 600;
    padding: 0.8rem 1rem;
}

.table-admin tbody tr {
    border-bottom: 1px solid var(--admin-border) !important;
}

.table-admin tbody tr:hover td {
    background: rgba(124, 58, 237, 0.03);
}

.table-admin tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.83rem;
}

.btn-admin-primary {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    border: none;
    color: #ffffff !important;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    transition: all 0.15s ease;
}

.btn-admin-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-xs {
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    border-radius: 6px;
}

.badge-rol {
    font-size: 0.68rem;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.badge-admin      { background: rgba(124, 58, 237, 0.1); color: #6d28d9; border-color: rgba(124, 58, 237, 0.25); }
.badge-secretaria { background: rgba(236, 72, 153, 0.1); color: #be185d; border-color: rgba(236, 72, 153, 0.25); }
.badge-academica  { background: rgba(8, 145, 178, 0.1);  color: #0369a1; border-color: rgba(8, 145, 178, 0.25); }
.badge-coord      { background: rgba(59, 130, 246, 0.1); color: #1d4ed8; border-color: rgba(59, 130, 246, 0.25); }
.badge-docente    { background: rgba(16, 185, 129, 0.1); color: #059669; border-color: rgba(16, 185, 129, 0.25); }
.badge-estudiante { background: rgba(2, 132, 199, 0.1); color: #0284c7; border-color: rgba(2, 132, 199, 0.25); }
.badge-activo    { background: rgba(16, 185, 129, 0.1); color: #059669; border-color: rgba(16, 185, 129, 0.2); font-size: 0.65rem; border-radius: 6px; }
.badge-inactivo  { background: rgba(239, 68, 68, 0.1);  color: #dc2626; border-color: rgba(239, 68, 68, 0.2);  font-size: 0.65rem; border-radius: 6px; }

.badge-omiso   { background: rgba(239, 68, 68, 0.1);  color: #dc2626; border: 1px solid rgba(239, 68, 68, 0.25);  font-size: 0.72rem; border-radius: 8px; }
.badge-nula    { background: rgba(239, 68, 68, 0.15); color: #b91c1c; border: 1px solid rgba(239, 68, 68, 0.3);   font-size: 0.72rem; border-radius: 8px; }
.badge-tarde   { background: rgba(245, 158, 11, 0.1);  color: #b45309; border: 1px solid rgba(245, 158, 11, 0.25); font-size: 0.72rem; border-radius: 8px; }

.btn-aprobar {
    background: linear-gradient(135deg, #059669, #10b981);
    border: none;
    border-radius: 8px;
    color: #ffffff !important;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    transition: all 0.2s ease;
}

.btn-aprobar:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    color: #ffffff !important;
}

.btn-observar {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 8px;
    color: #b45309;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    transition: all 0.2s ease;
}

.btn-observar:hover {
    background: rgba(245, 158, 11, 0.2);
}

.tab-pill {
    background: none;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    color: #64748b;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tab-pill.active, .tab-pill:hover {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.35);
    color: #7c3aed;
}

.alert-admin {
    border-radius: 10px;
    font-size: 0.83rem;
    padding: 0.7rem 1rem;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success-dark { background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.25); color: #059669; }
.alert-danger-dark  { background: rgba(239, 68, 68, 0.08);  border-color: rgba(239, 68, 68, 0.25);  color: #dc2626; }

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50%      { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.row-omiso {
    animation: pulse-red 2s infinite;
}

/* Pestañas de Navegación del Portal / Modern Tab Buttons */
.tab-btn {
    background: #f8fafc;
    border: 1px solid var(--iesp-border, #e2e8f0);
    border-radius: 12px;
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    outline: none !important;
}

.tab-btn:hover {
    background: #ffffff;
    color: var(--iesp-primary, #4f46e5);
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.tab-btn.active {
    background: #ffffff;
    color: var(--iesp-primary, #4f46e5) !important;
    border-color: var(--iesp-primary, #4f46e5) !important;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.15) !important;
    font-weight: 700;
}

