/* --- 1. Enhanced Variables & Base Styles --- */
@import url('https://fonts.googleapis.com/css2?family=Atma:wght@300;400;500;600;700&display=swap');

:root {
    --font-sans: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --transition-speed: 0.25s;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #003aff, #7100ff);
}

[data-theme="light"] {
    --primary-bg: #ffffff;
    --secondary-bg: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-primary: #4f46e5;
    --accent-primary-hover: #4338ca;
    --accent-secondary: #e0e7ff;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --error-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --card-bg: #ffffff;
    --card-hover: #f1f5f9;
}

[data-theme="dark"] {
    --primary-bg: #000000;
    --secondary-bg: #121212;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-primary: #2b1cff;  /* Purple accent for better visibility on black */
    --accent-primary-hover: #0b009e;
    --accent-secondary: #1f1f1f;
    --border-color: #2a2a2a;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --error-color: #cf6679;
    --success-color: #03dac6;
    --warning-color: #ffb45b;
    --card-bg: #1e1e1e;
    --card-hover: #2a2a2a;
}

/* --- Animation Keyframes --- */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--secondary-bg);
    color: var(--text-primary);
    transition: background-color var(--transition-speed) ease, 
                color var(--transition-speed) ease;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- 2. Auth & App Container Visibility --- */
#auth-container[hidden],
#app-container[hidden] {
    display: none;
}

#auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100vh;
    overflow: hidden;
}

.auth-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    transition: background-color var(--transition-speed) ease;
}

.auth-info {
    position: relative;
}

.auth-info-content {
    max-width: 450px;
    text-align: left;
    animation: slideUp 0.7s ease-out forwards;
}

.auth-tagline {
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
}

.feature-list {
    list-style: none;
    padding: 0;
    text-align: left;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
}

.feature-list li .fa-check {
    color: var(--success-color);
}

.auth-action {
    background-color: var(--primary-bg);
}

.auth-card {
    background-color: var(--card-bg);
    padding: 2.5rem 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid var(--border-color);
    opacity: 0; /* For animation */
    animation: slideUp 0.7s 0.2s ease-out forwards;
}

.auth-card h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.auth-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.auth-card .btn {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 0.85rem 1.5rem;
}

/* --- THEME-SPECIFIC AUTH STYLES --- */
[data-theme="light"] .auth-info {
    background-color: var(--secondary-bg);
}

[data-theme="light"] .auth-info .app-title {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .auth-tagline {
    color: var(--text-secondary);
}

[data-theme="light"] .feature-list {
    color: var(--text-secondary);
}

[data-theme="light"] .feature-list li {
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .auth-info {
    background: var(--gradient-primary);
    color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h4v-9H0v-1h4v-9H0v-1h4v-9H0v-1h4v-9H0v-1h4v-9H0v-1h4v-9H0v-1h4v-9H0v-1h4v-9H0v-1h4v-9h1v4h9v-4h1v4h9v-4h1v4h9v-4h1v4h9v-4h1v4h9v-4h1v4h9v-4h1v4h9v-4h1v4h9v-4h1v-1h-4v-9h4v-1h-4v-9h4v-1h-4v-9h4v-1h-4v-9h4v-1h-4v-9h4v-1h-4v-9h4v-1h-4v-9h4v-1h-4v-9h4v-1H96v4h-9v-4h-1v4h-9v-4h-1v4h-9v-4h-1v4h-9v-4h-1v4h-9v-4h-1v4h-9v-4h-1v4h-9v-4h-1v4h-9v-4h-1v4h-9v-4H4v1h9v9H4v1h9v9H4v1h9v9H4v1h9v9H4v1h9v9H4v1h9v9H4v1h9v9H4v1h9v9zm-1 9v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9H5v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9H5v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9H5v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9H5v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 6h9v9H6z'/%3E%3C/g%E3C/g%3E%3C/svg%3E");
}

[data-theme="dark"] .auth-info .app-title {
    background: #ffffff; /* Solid white text */
    -webkit-background-clip: initial;
    background-clip: initial;
    -webkit-text-fill-color: initial;
}

[data-theme="dark"] .auth-tagline {
    opacity: 0.9;
}

[data-theme="dark"] .feature-list li {
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- 3. Main App Layout --- */
#app-container {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main";
    grid-template-columns: 260px 1fr;
    grid-template-rows: 70px 1fr;
    height: 100vh;
    overflow: hidden;
}

.topbar, .sidebar, .main-content {
    transition: all var(--transition-speed) ease;
}

.topbar {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    background-color: var(--primary-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 100;
    position: relative;
}

.topbar__left, .topbar__right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar__right {
    position: relative; /* For positioning the profile popup */
}

.sidebar {
    grid-area: sidebar;
    background-color: var(--primary-bg);
    padding: 1.5rem 0;
    border-right: 1px solid var(--border-color);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    z-index: 99;
    overflow-y: auto;
    display: flex; 
    flex-direction: column; 
    scrollbar-width: none; /* For Firefox */
}

.sidebar::-webkit-scrollbar {
    display: none; /* For Chrome, Safari, and Opera */
}

.main-content {
    grid-area: main;
    padding: 2rem;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.page-content {
    animation: fadeInUp 0.5s ease-out;
}

/* --- 4. Enhanced UI Elements --- */
.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.select-group {
    padding: 1.25rem;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
}

.select-group:hover {
    box-shadow: var(--shadow-md);
}

.custom-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-bg);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: all var(--transition-speed) ease;
    min-width: 200px;
}

.custom-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* --- 5. Enhanced List & Table Styles --- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
}

.data-table:hover {
    box-shadow: var(--shadow-md);
}

.data-table th, .data-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--secondary-bg);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.data-table tbody tr {
    opacity: 0; /* Start hidden for animation */
    transform: translateY(15px);
    animation: fadeInUp 0.5s ease-out forwards;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr {
    transition: background-color var(--transition-speed) ease, transform 0.2s ease;
}

.data-table.interactive-table tbody tr:hover {
    background-color: var(--card-hover);
    transform: translateY(0) scale(1.02); /* Pop effect on hover */
}

.data-table .actions-cell {
    text-align: right;
    width: 120px;
}

.data-table .actions-cell .icon-btn {
    color: var(--text-secondary);
}

.data-table tr:hover .actions-cell .icon-btn {
    color: var(--accent-primary);
}

.data-table tr:hover .actions-cell .icon-btn.delete-btn {
    color: var(--error-color);
}


.data-table tr.student-marks-row {
    cursor: pointer;
}

/* --- 6. Enhanced Page Specific Styles --- */

.manual-promo-box {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.manual-promo-box:hover {
    border-color: var(--accent-primary);
    background-color: var(--secondary-bg);
    box-shadow: var(--shadow-md);
}
.manual-promo-box .fa-book-open { color: var(--accent-primary); }
.manual-promo-box .fa-arrow-right { color: var(--text-secondary); margin-left: auto; transition: transform 0.3s ease; }
.manual-promo-box:hover .fa-arrow-right { transform: translateX(5px); }
.manual-promo-text h3 { margin: 0 0 0.25rem 0; }
.manual-promo-text p { margin: 0; color: var(--text-secondary); }

.manual-header-left { display: flex; align-items: center; gap: 1rem; }
#manual-content-container { margin-top: 1.5rem; }
.manual-step {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    overflow: hidden;
}
.manual-step-header {
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}
.manual-step-header:hover { background-color: var(--secondary-bg); }
.manual-step-header h3 { margin: 0; font-size: 1.2rem; }
.manual-step-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    padding: 0 1.5rem;
}
.manual-step-content-inner { padding: 1rem 0; }
.manual-step-content p, .manual-step-content li, .manual-step-content ul { color: var(--text-secondary); line-height: 1.7; }
.manual-step-content ol, .manual-step-content ul { padding-left: 20px; }
.manual-step.active .manual-step-header { background-color: var(--accent-secondary); }

.bengali-text {
    font-family: "Atma", system-ui;
    font-weight: 500;
}
.bengali-text h3, .bengali-text strong {
    font-weight: 600;
}

.marks-entry-container {
    margin-top: 2rem;
}

.marks-table input[type="number"] {
    width: 80px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    font-size: 1rem;
    color: var(--text-primary);
    text-align: center;
    transition: all var(--transition-speed) ease;
}

.marks-table input[type="number"]:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    outline: none;
}

.placeholder-message {
    text-align: center;
    padding: 3rem 2rem;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
    animation: fadeInUp 0.4s ease-out;
}

.placeholder-message:hover {
    box-shadow: var(--shadow-md);
}

.placeholder-message p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.sms-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.sms-list {
    display: grid;
    gap: 1.25rem;
}

.sms-preview-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    transition: all var(--transition-speed) ease;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(15px);
    animation: fadeInUp 0.5s ease-out forwards;
}

.sms-preview-item:hover {
    transform: translateY(0) scale(1.02);
    box-shadow: var(--shadow-md);
}

.sms-recipient {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sms-recipient::before {
    content: "→";
    color: var(--accent-primary);
}

.sms-message {
    background-color: var(--accent-secondary);
    padding: 1rem;
    border-radius: calc(var(--border-radius) - 2px);
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-line;
}

/* --- 7. Enhanced Settings Page Styles --- */
.settings-menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.settings-menu-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.settings-menu-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.settings-menu-item .fa-2x {
    margin-bottom: 1.25rem;
    color: var(--accent-primary);
    transition: transform 0.3s ease;
}

.settings-menu-item:hover .fa-2x {
    transform: scale(1.1);
}

.settings-menu-item h3 {
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.settings-menu-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.settings-page-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
}

.settings-page-container:hover {
    box-shadow: var(--shadow-md);
}

.settings-page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.settings-page-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.settings-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.template-info {
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 1rem;
}

.template-info h4 {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.template-info .variable-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
}

.template-info .variable-item:hover {
    background-color: var(--accent-secondary);
    border-color: var(--accent-primary);
}

.template-info .variable-item code {
    background-color: var(--accent-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 600;
}

.template-info .variable-item span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.settings-actions {
    margin-top: 2rem;
}

/* --- 8. Enhanced Modal & Form Styles --- */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
}

.modal-container.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--primary-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    position: relative;
    width: 90%;
    max-width: 500px;
    transform: translateY(-20px) scale(0.98);
    transition: all var(--transition-speed) cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-container.active .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    background-color: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close-btn {
    position: static;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.modal-close-btn:hover {
    color: var(--error-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background-color: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #2b1cffa6;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    font-size: 1rem;
    color: var(--text-primary);
    transition: all var(--transition-speed) ease;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* --- 9. Enhanced Component Styles --- */
.sidebar__nav ul {
    list-style: none;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-left: 4px solid transparent;
    transition: all var(--transition-speed) ease;
    margin: 0.25rem 0;
}

.sidebar__link:hover {
    background-color: var(--secondary-bg);
    color: var(--text-primary);
    padding-left: 1.75rem;
}

.sidebar__link.active {
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
    background-color: var(--accent-secondary);
    font-weight: 600;
}

.sidebar__link i {
    width: 24px;
    text-align: center;
}

#user-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
}

#user-display img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    object-fit: cover;
}

.profile-popup {
    position: absolute;
    top: 65px; /* Position below the topbar */
    right: 1.5rem;
    background-color: var(--primary-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    width: 220px;
    z-index: 101; /* Above topbar and sidebar overlay */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease, visibility var(--transition-speed) ease;
    overflow: hidden; /* Ensures children conform to border-radius */
}

.profile-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-popup-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: background-color var(--transition-speed) ease;
    color: var(--text-primary);
}

.profile-popup-item:first-child {
    border-bottom: 1px solid var(--border-color);
}

.profile-popup-item:hover {
    background-color: var(--secondary-bg);
}

.profile-popup-item .icon-sun,
.profile-popup-item .icon-moon,
[data-theme="dark"] .profile-popup-item .icon-sun,
[data-theme="light"] .profile-popup-item .icon-moon {
    display: none;
}
[data-theme="dark"] .profile-popup-item .icon-sun,
[data-theme="light"] .profile-popup-item .icon-moon {
    display: inline-block;
}

.profile-popup-item i {
    width: 20px;
    text-align: center;
    color: var(--accent-primary);
}


.icon-btn {
    font-size: 1.2rem;
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: all var(--transition-speed) ease;
    color: var(--accent-primary);
}

.icon-btn:hover {
    background-color: var(--secondary-bg);
    color: var(--accent-primary);
    transform: scale(1.1);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(0);
    filter: brightness(1);
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    margin: 2rem 0;
}

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

.btn-secondary {
    background-color: #ff6b6b;
    color: white;
}

.btn-secondary:hover {
    background-color: #f00;
}

.theme-toggle-btn .icon-sun,
.theme-toggle-btn .icon-moon,
[data-theme="dark"] .theme-toggle-btn .icon-sun,
[data-theme="light"] .theme-toggle-btn .icon-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle-btn .icon-sun,
[data-theme="light"] .theme-toggle-btn .icon-moon {
    display: block;
}

/* --- Loading Spinner --- */
.fa-spinner {
    color: var(--accent-primary);
}

/* --- 10. Responsive Design --- */
@media (min-width: 769px) {
    .profile-popup {
        display: none; /* Hide popup on desktop */
    }
}

@media (max-width: 992px) {
    #app-container {
        grid-template-columns: 80px 1fr;
    }
    
    .sidebar {
        width: 80px;
        padding: 1rem 0;
    }
    
    .sidebar__link span {
        display: none;
    }
    
    .sidebar__link {
        justify-content: center;
        padding: 0.75rem;
    }
    
    .sidebar__link:hover {
        padding-left: 0.75rem;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .settings-container {
        grid-template-columns: 1fr;
    }
    
    .template-info {
        position: static;
    }
}

@media (max-width: 850px) {
    #auth-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
        min-height: 100vh;
    }
    .auth-info {
        padding: 4rem 2rem;
        text-align: center;
    }
    .auth-info-content {
        text-align: center;
    }
    .feature-list {
        text-align: left;
    }
}

@media (max-width: 768px) {
    #app-container {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "header"
            "main";
    }
    
    .sidebar {
        position: fixed;
        top: 70px;
        left: 0;
        height: calc(100vh - 70px);
        transform: translateX(-100%);
        box-shadow: 5px 0 15px var(--shadow-color);
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 10px 0 20px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar__link span {
        display: inline;
    }
    
    .sidebar__link {
        justify-content: flex-start;
        padding: 0.75rem 1.5rem;
    }
    
    .sidebar__link:hover {
        padding-left: 1.75rem;
    }
    
    .hamburger-btn {
        display: grid;
    }
    
    .main-content {
        padding: 1.25rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #user-display span {
        display: none;
    }
    
    .topbar__right .theme-toggle-btn, 
    .topbar__right #logout-btn {
        display: none;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .select-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .custom-select {
        width: 100%;
    }
    
    .sms-preview-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .auth-panel {
        padding: 2rem 1.5rem;
    }
    .auth-card {
        padding: 2rem 1.5rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .settings-menu {
        grid-template-columns: 1fr;
    }
}

/* --- Sidebar Overlay --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spanofred{
    color:red;
    font-weight: bold;
}


/* --- Enhanced Auth Styles --- */
#auth-container {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 1rem;
}

.auth-background {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.auth-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.2;
    animation: float 15s infinite ease-in-out;
}

.auth-blob:nth-child(1) {
    background: var(--accent-primary);
    width: 300px;
    height: 300px;
    top: -50px;
    left: -50px;
    animation-delay: 0s;
}

.auth-blob:nth-child(2) {
    background: var(--success-color);
    width: 400px;
    height: 400px;
    bottom: -100px;
    right: -100px;
    animation-delay: 5s;
}

.auth-card {
    position: relative;
    background: var(--primary-bg);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    animation: fadeInUp 0.6s 0.2s forwards;
    border: 1px solid var(--border-color);
}

.auth-card-content {
    padding: 2.5rem;
    position: relative;
    z-index: 2;
}

.auth-card-decoration {
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: var(--accent-primary);
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    opacity: 0.1;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.app-logo span {
    font-size: 2.5rem;
}

.app-logo h1 {
    font-size: 1.8rem;
    margin: 0;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-tagline {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.auth-demo-note {
    text-align: center;
    color: var(--text-secondary);
    margin: -1rem 0 1.5rem;
    font-size: 0.9rem;
}

.google-btn {
    width: 100%;
    background: #4285F4;
    color: white;
    padding: 0.85rem;
    border-radius: 12px;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.google-btn:hover {
    background: #3367D6;
    transform: translateY(-2px);
}

.google-btn i {
    margin-right: 10px;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 1rem;
    font-size: 0.85rem;
}

.auth-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 12px;
    background: var(--secondary-bg);
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
}

.feature-item i {
    font-size: 1.2rem;
    color: var(--accent-primary);
}

.feature-item span {
    font-size: 0.8rem;
    text-align: center;
    color: var(--text-secondary);
}

/* New Animations */
@keyframes float {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(20px, 20px);
    }
}

/* Enhanced Profile Popup for Mobile */
@media (max-width: 768px) {
    .profile-popup {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
    }

    .profile-popup.active {
        transform: translateY(0);
    }

    .profile-popup-item {
        padding: 1.25rem 1.5rem;
    }

    .profile-popup-item:first-child {
        border-bottom: none;
    }

    /* Backdrop effect */
    .profile-popup::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .profile-popup.active::before {
        opacity: 1;
    }
}

/* Add these styles to your existing CSS */

/* Enhanced Modal Styles */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-container.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--primary-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
}

.modal-container.active .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    background-color: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background-color: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Popup specific styles */
.student-marks-popup,
.exam-results-popup {
    padding: 0.5rem;
}

.student-info {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.student-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.student-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive modal adjustments */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 12px 12px 0 0;
        margin-bottom: 0;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}


/* Confirmation and Alert Modals */
.confirmation-modal,
.alert-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.confirmation-modal-content,
.alert-modal-content {
    background-color: var(--primary-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.3s ease-out;
}

.confirmation-modal h3,
.alert-modal h3 {
    margin-top: 0;
    color: var(--text-primary);
}

.confirmation-modal p,
.alert-modal p {
    margin: 1rem 0 2rem;
    color: var(--text-secondary);
}

.confirmation-modal-actions,
.alert-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.alert-modal-actions {
    justify-content: center;
}

/* Error message styling */
.error-message {
    color: var(--error-color);
    padding: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}


/* in style.css */

.sidebar__footer {
    margin-top: auto; /* Pushes the footer to the bottom */
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sidebar__footer a {
    color: var(--accent-primary);
    font-weight: 500;
    text-decoration: none;
    transition: text-decoration var(--transition-speed) ease;
}

.sidebar__footer a:hover {
    text-decoration: underline;
}

/* Hide text in collapsed sidebar on medium screens */
@media (max-width: 992px) {
    .sidebar__footer {
        display: none;
    }
}

/* Ensure footer is visible in mobile slide-out sidebar */
@media (max-width: 768px) {
    .sidebar__footer {
        display: block;
    }
}


/* --- Export Page Styles --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.export-accordion {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.export-accordion-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.3s ease;
}

.export-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
}
.export-accordion-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.export-accordion-header .toggle-icon {
    transition: transform 0.3s ease;
}

.export-accordion-item.active .export-accordion-header .toggle-icon {
    transform: rotate(180deg);
}

.export-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.export-accordion-item.active .export-accordion-content {
    max-height: 500px; /* Adjust as needed */
    transition: max-height 0.5s ease-in;
}

.export-card {
    padding: 0 1.5rem 1.5rem 1.5rem;
}
.export-card p {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.export-card .btn {
    width: 100%;
    justify-content: center;
}

/* --- PDF Template Styles --- */
/* This class hides the content that will be rendered for the PDF */
.pdf-template {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 8.5in; /* Standard letter width */
}

.pdf-report-container {
    padding: 0.5in;
    font-family: Arial, sans-serif;
    color: #333;
}

.pdf-header {
    text-align: center;
    border-bottom: 2px solid #ccc;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.pdf-header h1 {
    margin: 0;
    color: var(--accent-primary);
}
.pdf-header h2 {
    margin: 0.25rem 0 0 0;
    font-weight: normal;
    color: #666;
}

.pdf-student-info {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
}

.pdf-batch-title {
    margin-top: 1.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #eee;
}

.pdf-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.pdf-table th, .pdf-table td {
    border: 1px solid #ddd;
    padding: 0.75rem;
    text-align: left;
}

.pdf-table th {
    background-color: #f8f8f8;
}

.pdf-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ccc;
    font-size: 0.8rem;
    color: #999;
}



/* --- Errors --- */


#all-exams-btn {
  margin: auto;
  height: auto;
}

#modal-cancel-btn{
  margin: auto;
  height: auto;
}

/* --- Quick Access Grid on Dashboard --- */
.quick-access-grid {
    margin-top: 2.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
}

.quick-access-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.quick-access-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.quick-access-item i {
    color: var(--accent-primary);
    transition: color 0.3s ease;
}

.quick-access-item span {
    font-weight: 500;
    color: var(--text-primary);
}

.quick-access-item:hover span {
    color: var(--accent-primary);
}
