/**
 * Estilos adicionales — Sistema de Calificaciones
 */

/* ========================================
   LOGIN / AUTH
   ======================================== */

html:has(.auth-container),
html:has(.auth-container) body {
    margin: 0;
    padding: 0;
}

.auth-container {
    min-height: 100vh;
    display: flex;
}

@media (min-width: 993px) {
    html:has(.auth-container),
    html:has(.auth-container) body {
        height: 100%;
        overflow: hidden;
    }
    .auth-container {
        height: 100%;
    }
}

.auth-branding {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    color: white;
    position: relative;
    overflow: hidden;
}

.auth-branding::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.auth-branding h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.auth-branding p {
    font-size: 18px;
    opacity: 0.9;
    max-width: 400px;
    text-align: center;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

.auth-branding .features-list {
    list-style: none;
    margin-top: 40px;
    position: relative;
    z-index: 1;
}

.auth-branding .features-list li {
    padding: 8px 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-branding .features-list li i {
    color: #4ade80;
    font-size: 18px;
}

.auth-form-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--gray-50);
}

.auth-form-wrapper {
    width: 100%;
    max-width: 440px;
}

.auth-form-wrapper .logo-text {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}

.auth-form-wrapper h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.auth-form-wrapper .subtitle {
    color: var(--gray-500);
    margin-bottom: 32px;
    font-size: 15px;
}

.password-toggle {
    position: relative;
}

.password-toggle .toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
}

.password-toggle .toggle-btn:hover {
    color: var(--gray-600);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--gray-500);
    font-size: 14px;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 992px) {
    .auth-branding {
        display: none;
    }

    .auth-form-container {
        align-items: flex-start;
        padding: 20px 20px 40px;
        min-height: 100vh;
        overflow-y: auto;
    }
}

/* ========================================
   HEADER
   ======================================== */

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    flex-shrink: 0;
}

.header-brand i {
    font-size: 24px;
}

.header-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
}

@media (max-width: 767px) {
    .main-header {
        position: relative;
    }
    .header-brand {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    /* El header es position:relative en móvil → ya ocupa espacio en el flujo.
       El padding-top del main-wrapper (que compensa el header fixed en desktop)
       genera un espacio blanco vacío. Se anula aquí. */
    .main-wrapper {
        padding-top: 0;
    }
}


.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.header-action-btn:hover {
    background: var(--gray-200);
    color: var(--primary);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--border-radius-md);
    transition: background 0.2s;
}

.user-menu:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.user-info {
    line-height: 1.3;
}

.user-info .name {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-800);
}

.user-info .role {
    font-size: 12px;
    color: var(--gray-500);
}

/* ========================================
   SIDEBAR
   ======================================== */

.main-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    z-index: 999;
    padding: 20px 0;
    transition: width 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f9fafb;
}


.main-sidebar::-webkit-scrollbar {
    width: 5px;
}
.main-sidebar::-webkit-scrollbar-track {
    background: #f9fafb;
}
.main-sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}
.main-sidebar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-title {
    padding: 4px 24px;
    font-size: 15px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    color: #1e3a5f;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}
.sidebar-section-title:hover { opacity: 0.8; }

/* Chevron — Alpine añade/quita .rotated */
.sidebar-chev {
    font-size: 9px;
    opacity: 0.55;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}
.sidebar-chev.rotated { transform: rotate(-90deg); }

/* Contenedor animable de cada sección — Alpine añade/quita .sec-hidden */
.sidebar-nav-wrap {
    overflow: hidden;
    max-height: 1500px;
    opacity: 1;
    transition: max-height 0.35s ease, opacity 0.22s ease;
}
.sidebar-nav-wrap.sec-hidden {
    max-height: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Sidebar icon-only: forzar secciones abiertas y ocultar chevrons */
body.sidebar-collapsed .sidebar-chev          { display: none !important; }
body.sidebar-collapsed .sidebar-section-title { cursor: default; }
body.sidebar-collapsed .sidebar-nav-wrap,
body.sidebar-collapsed .sidebar-nav-wrap.sec-hidden {
    max-height: 600px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.dark-mode .sidebar-section-title       { color: #a0aec0 !important; }
body.dark-mode .sidebar-section-title i     { color: var(--primary-light) !important; }
body.dark-mode .sidebar-section-title:hover { opacity: 0.75; }

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: var(--gray-50);
    color: var(--primary);
}

.sidebar-nav li a.active {
    background: rgba(43, 92, 138, 0.08);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-nav li a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* Botón logout dentro del sidebar-nav */
.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 24px;
    color: var(--gray-600);
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.6;
}

.sidebar-logout-btn:hover {
    background: var(--gray-50);
    color: var(--primary);
}

.sidebar-logout-btn i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

body.sidebar-collapsed .sidebar-logout-btn {
    font-size: 0 !important;
    justify-content: center !important;
    padding: 11px 0 !important;
    border-left: 3px solid transparent !important;
}

body.sidebar-collapsed .sidebar-logout-btn i {
    font-size: 18px !important;
    width: auto !important;
    margin: 0 !important;
}

body.dark-mode .sidebar-logout-btn {
    color: #9ca3af;
}

body.dark-mode .sidebar-logout-btn:hover {
    background: #252836;
    color: #f3f4f6;
}

/* Scrollbar del sidebar en dark mode */
body.dark-mode .main-sidebar {
    scrollbar-color: #374151 #1a1d27;
}
body.dark-mode .main-sidebar::-webkit-scrollbar {
    width: 5px;
}
body.dark-mode .main-sidebar::-webkit-scrollbar-track {
    background: #1a1d27;
}
body.dark-mode .main-sidebar::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
}
body.dark-mode .main-sidebar::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

/* ========================================
   SIDEBAR TOGGLE
   ======================================== */

.btn-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: none;
    background: none;
    color: var(--gray-600);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.btn-sidebar-toggle:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.btn-sidebar-toggle i {
    font-size: 17px;
    pointer-events: none;
}

/* ========================================
   SIDEBAR COLAPSADO (desktop)
   ======================================== */

body.sidebar-collapsed .main-sidebar {
    width: var(--sidebar-collapsed-width) !important;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width) !important;
}

body.sidebar-collapsed .sidebar-section-title { display: none !important; }
body.sidebar-collapsed .sidebar-centro-info   { display: none !important; }

body.sidebar-collapsed .sidebar-nav li a {
    font-size: 0 !important;
    justify-content: center !important;
    padding: 11px 0 !important;
    border-left: 3px solid transparent !important;
}

body.sidebar-collapsed .sidebar-nav li a.active {
    background: rgba(43, 92, 138, 0.08);
    border-left-color: var(--primary) !important;
}

body.sidebar-collapsed .sidebar-nav li a i {
    font-size: 18px !important;
    width: auto !important;
    margin: 0 !important;
}

/* Tooltip flotante */
#sidebar-tooltip {
    position: fixed;
    background: #1e293b;
    color: #fff;
    padding: 5px 11px;
    border-radius: 7px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    display: none;
    transform: translateY(-50%);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

#sidebar-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #1e293b;
}

/* Backdrop mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1049;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-backdrop.show { display: block; }

/* Responsive sidebar */
@media (max-width: 991.98px) {
    .main-sidebar {
        transform: translateX(-100%);
        z-index: 1050;
        width: var(--sidebar-width) !important;
        transition: transform 0.28s ease;
        box-shadow: none;
    }
    .main-sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    }
    .main-content { margin-left: 0 !important; }
    body.sidebar-collapsed .main-content { margin-left: 0 !important; }
}

/* Responsive header */
@media (max-width: 576px) {
    .main-header {
        padding: 0 6px;
        height: 56px;
    }
    .header-actions { margin-left: auto; gap: 4px; }
    .header-action-btn { width: 32px; height: 32px; }
    .user-avatar { width: 30px; height: 30px; font-size: 12px; }
    .user-menu { padding: 4px 6px; gap: 6px; }

    :root { --header-height: 56px; }

    .dropdown-menu {
        position: fixed !important;
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        transform: none !important;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
        padding: 8px 0;
        width: 100% !important;
    }
    .dropdown-item { padding: 12px 20px; font-size: 15px; }
}

/* ========================================
   TOAST CONTAINER
   ======================================== */

.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-item {
    padding: 14px 20px;
    border-radius: var(--border-radius-md);
    color: white;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s ease;
    min-width: 300px;
}

.toast-item.success { background: var(--success); }
.toast-item.error   { background: var(--danger); }
.toast-item.warning { background: var(--warning); }
.toast-item.info    { background: var(--info); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

