/* ============================================
   EDUNOTE - Theme System (Light / Dark)
   ============================================ */

/* --- Light Theme (default) --- */
:root {
    --side-bg: #181f2c;
    --side-text: #cfd6ee;
    --side-heading: #77cfff;
    --side-accent: #49f0bd;
    --side-hover: #242f49;
    --side-divider: #2a3547;
    --side-brand-border: #202f47;

    --main-bg: #ffffff;
    --main-text: #1f2937;
    --main-title: #11305e;

    --table-header-bg: #181f2c;
    --table-subheader-bg: #f1f3f5;
    --table-cell-bg: #ffffff;
    --table-hover: #f0f4ff;
    --table-shadow: rgba(0,0,0,0.08);
}

/* --- Dark Theme --- */
[data-bs-theme="dark"] {
    --main-bg: #111318;
    --main-text: #e2e8f0;
    --main-title: #93c5fd;

    --table-header-bg: #1e293b;
    --table-subheader-bg: #1e293b;
    --table-cell-bg: #0f172a;
    --table-hover: #1e293b;
    --table-shadow: rgba(0,0,0,0.5);
}

/* --- Base --- */
body {
    background: var(--main-bg);
    color: var(--main-text);
    transition: background 0.2s, color 0.2s;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    background: var(--main-bg);
    min-height: 100vh;
    transition: background 0.2s;
    overflow-x: auto;
}

[x-cloak] {
    display: none !important;
}

.main-title {
    font-weight: 700;
    color: var(--main-title);
}

/* --- Login --- */
.login-body {
    min-height: 100vh;
    background: #f4f8fa;
}

.login-header {
    background: #11305e;
}

.login-card {
    border: 0;
    border-radius: 12px;
    overflow: hidden;
}

.brand-panel {
    background: #ffffff;
}

.login-logo,
.logo-icon {
    background: linear-gradient(135deg, #388cff 40%, #4abff9 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.login-logo {
    width: 82px;
    height: 82px;
    border-radius: 24px;
    font-size: 2.4rem;
}

/* === SIDEBAR (always dark) === */
.sidebar {
    background: var(--side-bg);
    color: var(--side-text);
    min-height: 100vh;
}

.sidebar-wrapper {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1rem 1.2rem 0.8rem;
    font-weight: 600;
    color: #ffffff;
    border-bottom: 2px solid var(--side-brand-border);
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.sidebar-menu-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0.8rem 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--side-divider) transparent;
}

.sidebar-menu-wrapper::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu-wrapper::-webkit-scrollbar-thumb {
    background: var(--side-divider);
    border-radius: 4px;
}

.sidebar-section-title {
    padding: 0.45rem 0.8rem 0.3rem;
    font-weight: 600;
    color: var(--side-heading);
    margin-top: 12px;
    margin-bottom: 2px;
    border-left: 3px solid #4abff9;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    transition: background 0.15s;
}

.sidebar-section-title:hover {
    background: #1e2a3d;
}

.sidebar-section-title .accordion-arrow {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
    color: #4abff9;
}

.sidebar-section-title.collapsed .accordion-arrow {
    transform: rotate(-90deg);
}

.sidebar-group-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.sidebar-group-list.sidebar-group-open {
    max-height: 600px;
    transition: max-height 0.25s ease-in;
}

.sidebar .nav-link {
    color: var(--side-text) !important;
    font-weight: 500;
    padding: 0.55rem 0.8rem 0.55rem 1.6rem;
    border-radius: 6px;
    margin: 1px 0;
    border-left: 2px solid transparent;
    display: flex;
    align-items: center;
    font-size: 0.83rem;
    transition: all 0.15s;
}

.sidebar .nav-link .feather {
    margin-right: 0.7rem;
    opacity: 0.83;
    width: 16px;
    height: 16px;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    color: #ffffff !important;
    background: var(--side-hover);
    border-left: 2px solid var(--side-accent);
}

.sidebar-bottom {
    flex-shrink: 0;
    padding: 0.8rem 1rem 0.6rem;
    border-top: 1px solid var(--side-divider);
    background: var(--side-bg);
}

.sidebar-user {
    color: #ffffff !important;
    padding: 0.5rem 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.sidebar-logout .nav-link {
    background: linear-gradient(90deg, #0ba360 0%, #3cba92 100%);
    color: #fff !important;
    font-weight: 500;
    border-radius: 6px;
    padding: 0.55rem 1rem;
    font-size: 0.82rem;
    justify-content: center;
}

/* Theme toggle in sidebar */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.5rem;
    background: #1e2a3d;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    font-size: 0.78rem;
    color: #cfd6ee;
}

.theme-toggle:hover {
    background: #242f49;
}

.theme-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

.theme-toggle-track {
    width: 36px;
    height: 20px;
    background: #2a3547;
    border-radius: 10px;
    position: relative;
    transition: background 0.25s;
    flex-shrink: 0;
}

.theme-toggle-track.active {
    background: #4abff9;
}

.theme-toggle-thumb {
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.25s;
}

.theme-toggle-track.active .theme-toggle-thumb {
    transform: translateX(16px);
}

/* === STATS BAR === */
.stat-card {
    background: var(--stat-bg);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #388cff;
}

.stat-label {
    color: #64748b;
    font-size: 0.9rem;
}

.stat-value {
    color: var(--main-title);
    font-weight: 700;
    font-size: 2rem;
}

/* === CENTRALIZADOR TABLE === */
/* (Styles now inline in ver.php for speed and simplicity) */

/* Badge sizing */
.badge.rounded-pill {
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* === MODAL === */
.modal {
    z-index: 2000;
}

.modal-backdrop {
    z-index: 1990;
}



/* === SIDEBAR COLLAPSE === */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--side-bg);
    color: var(--side-text);
    transition: width 0.3s ease, min-width 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

/* Toggle button inside sidebar header */
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: #cfd6ee;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
    margin-left: auto;
    opacity: 0.6;
    transition: opacity 0.15s, transform 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
}

.sidebar-toggle-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

/* Collapsed header: logo on top, toggle below */
.sidebar.collapsed .sidebar-brand {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 0 0.5rem;
    gap: 0.5rem;
}

.sidebar.collapsed .sidebar-brand .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
}

.sidebar.collapsed .sidebar-toggle-btn {
    margin-left: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 1.1rem;
    transform: none;
}

/* Hide text labels when collapsed */
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .toggle-label,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .accordion-arrow,
.sidebar.collapsed .sidebar-user {
    display: none;
}

/* Menu links in collapsed rail */
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.6rem 0;
    border-radius: 0;
}

.sidebar.collapsed .nav-link .feather {
    margin-right: 0;
    width: 18px;
    height: 18px;
}

.sidebar.collapsed .nav-link:hover,
.sidebar.collapsed .nav-link.active {
    background: var(--side-hover);
}

/* Bottom section in collapsed rail */
.sidebar.collapsed .sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0;
    gap: 0.25rem;
}

/* Theme toggle collapsed */
.sidebar.collapsed .theme-toggle {
    justify-content: center;
    padding: 0.55rem 0;
    width: 100%;
    margin-bottom: 0.2rem;
    border-radius: 0;
}

.sidebar.collapsed .theme-toggle:hover {
    background: var(--side-hover);
}

.sidebar.collapsed .theme-toggle-icon {
    font-size: 1.1rem;
    margin: 0;
}

.sidebar.collapsed .theme-toggle-track,
.sidebar.collapsed .theme-toggle-thumb {
    display: none;
}

/* Logout collapsed */
.sidebar.collapsed .sidebar-logout {
    width: 100%;
}

.sidebar.collapsed .sidebar-logout .nav-link {
    justify-content: center;
    padding: 0.6rem 0;
    border-radius: 0;
    background: transparent;
}

.sidebar.collapsed .sidebar-logout .nav-link:hover {
    background: var(--side-hover);
}

.sidebar.collapsed .sidebar-logout .nav-link .feather {
    width: 18px;
    height: 18px;
}

/* Responsive: rail always on mobile */
@media (max-width: 991px) {
    .sidebar {
        width: 60px;
        min-width: 60px;
    }
    .sidebar .sidebar-brand {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0.75rem 0 0.5rem;
        gap: 0.5rem;
    }
    .sidebar .sidebar-brand .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
    .sidebar .sidebar-toggle-btn {
        margin-left: 0;
        width: 32px;
        height: 32px;
        padding: 0;
        font-size: 1.1rem;
        transform: none;
    }
    .sidebar .brand-text,
    .sidebar .nav-label,
    .sidebar .toggle-label,
    .sidebar .sidebar-section-title,
    .sidebar .accordion-arrow,
    .sidebar .sidebar-user {
        display: none;
    }
    .sidebar .nav-link {
        justify-content: center;
        padding: 0.6rem 0;
        border-radius: 0;
    }
    .sidebar .nav-link .feather {
        margin-right: 0;
        width: 18px;
        height: 18px;
    }
    .sidebar .nav-link:hover,
    .sidebar .nav-link.active {
        background: var(--side-hover);
    }
    .sidebar .sidebar-bottom {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.5rem 0;
        gap: 0.25rem;
    }
    .sidebar .theme-toggle {
        justify-content: center;
        padding: 0.55rem 0;
        width: 100%;
        margin-bottom: 0.2rem;
        border-radius: 0;
    }
    .sidebar .theme-toggle-icon {
        font-size: 1.1rem;
        margin: 0;
    }
    .sidebar .theme-toggle-track,
    .sidebar .theme-toggle-thumb {
        display: none;
    }
    .sidebar .sidebar-logout {
        width: 100%;
    }
    .sidebar .sidebar-logout .nav-link {
        justify-content: center;
        padding: 0.6rem 0;
        border-radius: 0;
        background: transparent;
    }
    .sidebar .sidebar-logout .nav-link .feather {
        width: 18px;
        height: 18px;
    }
}

