/* ========================================
   GLOBAL STYLES
   ======================================== */

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

:root {
    --navy: #0f766e;
    --navy-dark: #0f3d3a;
    --navy-light: #14b8a6;
    --red: #dc2626;
    --red-dark: #991b1b;
    --red-light: #ef4444;
    --sky: #2563eb;
    --violet: #7c3aed;
    --white: #ffffff;
    --gray-light: #f8f9fa;
    --gray: #6b7280;
    --gray-dark: #374151;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #2dd4bf;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: rgba(255, 255, 255, 0.94);
    --surface-muted: rgba(248, 250, 252, 0.82);
    --shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.08);
    --shadow-strong: 0 24px 60px rgba(15, 23, 42, 0.16);
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --text-primary: #f3f4f6;
        --text-secondary: #d1d5db;
        --border-color: #404040;
    }
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --border-color: #404040;
    --surface: rgba(24, 24, 27, 0.82);
    --surface-strong: rgba(17, 24, 39, 0.92);
    --surface-muted: rgba(31, 41, 55, 0.82);
}

html, body {
    min-height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    color: var(--gray-dark);
    background:
        radial-gradient(circle at top left, rgba(20, 184, 166, 0.12), transparent 30%),
        radial-gradient(circle at top right, rgba(124, 58, 237, 0.08), transparent 28%),
        linear-gradient(135deg, #f8fafc 0%, #ffffff 48%, #eff6ff 100%);
    letter-spacing: -0.5px;
}

[data-theme="dark"] {
    color: var(--text-primary);
    background:
        radial-gradient(circle at top left, rgba(20, 184, 166, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(124, 58, 237, 0.12), transparent 28%),
        linear-gradient(135deg, #050816 0%, #0f172a 48%, #111827 100%);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--navy);
    margin: 0.5em 0;
    font-weight: 700;
    letter-spacing: -0.5px;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: #5eead4;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.85rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }

p { line-height: 1.7; }

a {
    color: var(--navy-light);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

a:hover {
    color: var(--navy);
    text-decoration: underline;
}

/* ========================================
   LAYOUT
   ======================================== */

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.login-container,
.error-container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: stretch;
    justify-content: center;
    gap: 24px;
    padding: 32px 24px 48px;
    width: min(1120px, calc(100% - 32px));
}

.error-container {
    grid-template-columns: minmax(0, 560px);
    justify-items: center;
}

/* ========================================
   TOPBAR
   ======================================== */

.topbar {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.95) 0%, rgba(20, 184, 166, 0.88) 48%, rgba(37, 99, 235, 0.9) 100%);
    backdrop-filter: blur(16px) saturate(160%);
    color: var(--white);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(15, 118, 110, 0.22);
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .topbar {
    background: linear-gradient(135deg, rgba(7, 26, 38, 0.95) 0%, rgba(15, 23, 42, 0.92) 50%, rgba(17, 24, 39, 0.95) 100%);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}

.topbar-left h2 {
    color: var(--white);
    margin: 0;
    font-size: 1.8rem;
}

.topbar-title-link {
    color: var(--white);
    font-size: 1.8rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -0.04em;
}

.topbar-title-link:hover {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
}

.topbar-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-topbar {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.9) 0%, rgba(153, 27, 27, 0.9) 100%);
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.2);
}

.admin-topbar h2 {
    color: var(--white);
}

.admin-topbar .btn-outline {
    border-color: rgba(255, 255, 255, 0.5);
    color: var(--white);
}

.admin-topbar .btn-outline:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ========================================
   CARDS
   ======================================== */

.card,
.form-card,
.error-card {
    background: var(--surface);
    backdrop-filter: blur(18px) saturate(150%);
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: var(--shadow-soft), inset 0 1px 1px rgba(255, 255, 255, 0.5);
    overflow: visible;
    transition: var(--transition);
}

[data-theme="dark"] .card,
[data-theme="dark"] .form-card,
[data-theme="dark"] .error-card {
    background: var(--surface);
    border: 1px solid rgba(148, 163, 184, 0.14);
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.38), inset 0 1px 1px rgba(148, 163, 184, 0.12);
}

.card {
    margin-bottom: 24px;
}

.card:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.88) 0%, rgba(241, 245, 249, 0.9) 100%);
    backdrop-filter: blur(12px) saturate(130%);
    padding: 24px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.75);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

[data-theme="dark"] .card-header {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(17, 24, 39, 0.94) 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.card-header h1,
.card-header h2,
.card-header h3 {
    margin: 0;
}

.card-body {
    padding: 24px;
}

[data-theme="dark"] .card-body {
    color: #f3f4f6;
}

.card-description {
    color: var(--gray);
    margin-bottom: 18px;
    font-size: 0.95rem;
    line-height: 1.6;
}

[data-theme="dark"] .card-description {
    color: #d1d5db;
}

.form-card {
    padding: 36px;
    width: 100%;
    max-width: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 250, 252, 0.88) 100%);
    backdrop-filter: blur(20px) saturate(140%);
}

/* ========================================
   FORMS
   ======================================== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-item label {
    font-weight: 700;
    color: var(--navy);
    font-size: 0.9rem;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

.form-item input,
.form-item textarea,
.form-item select,
.timetable-table input,
.timetable-table textarea,
.schedule-table input,
.schedule-table textarea,
.menu-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid rgba(209, 213, 219, 0.6);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    color: inherit;
}

[data-theme="dark"] .form-item input,
[data-theme="dark"] .form-item textarea,
[data-theme="dark"] .form-item select,
[data-theme="dark"] .timetable-table input,
[data-theme="dark"] .timetable-table textarea,
[data-theme="dark"] .schedule-table input,
[data-theme="dark"] .schedule-table textarea,
[data-theme="dark"] .menu-textarea {
    background: rgba(60, 60, 60, 0.8);
    border-color: rgba(100, 100, 100, 0.5);
    color: #f3f4f6;
}

.form-item input:focus,
.form-item textarea:focus,
.form-item select:focus,
.timetable-table input:focus,
.timetable-table textarea:focus,
.schedule-table input:focus,
.schedule-table textarea:focus,
.menu-textarea:focus {
    outline: none;
    border-color: var(--navy-light);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1), inset 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.help-text {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 4px;
    line-height: 1.4;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    border: none;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--navy-light) 0%, var(--sky) 100%);
    color: var(--white);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--sky) 0%, var(--violet) 100%);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.32);
}

/* ========================================
   MODALS
   ======================================== */

.modal-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(75, 85, 99, 0.78);
    backdrop-filter: blur(10px) grayscale(0.15);
    -webkit-backdrop-filter: blur(10px) grayscale(0.15);
    animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-shell {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: slideUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-shell-large {
    width: min(1100px, 100%);
}

.modal-toggle:checked ~ .modal-overlay {
    display: flex;
}

/* Specific modal targeting to prevent overlaps */
#schedule-modal-toggle:checked ~ .schedule-modal {
    display: flex !important;
}
#day-schedule-modal-toggle:checked ~ .day-schedule-modal {
    display: flex !important;
}
#day-timetable-modal:checked ~ .day-timetable-modal {
    display: flex !important;
}
#period-timetable-modal:checked ~ .period-timetable-modal {
    display: flex !important;
}
#menu-modal-toggle:checked ~ .menu-modal {
    display: flex !important;
}
#more-info-toggle:checked ~ .info-modal {
    display: flex !important;
}

.modal-header,
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 20px 26px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.4);
}

.modal-footer {
    border-top: 1px solid rgba(229, 231, 235, 0.4);
    border-bottom: 0;
    justify-content: flex-end;
}

.modal-body {
    padding: 26px;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(107, 114, 128, 0.1);
    color: var(--navy);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(107, 114, 128, 0.2);
    text-decoration: none;
}

.modal-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.modal-trigger-btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
}

.more-info-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    position: relative;
    max-width: 320px;
    margin: 0 auto;
}

.more-info-trigger {
    width: auto;
    min-width: 180px;
    max-width: 100%;
}

.homework-feature {
    overflow: hidden;
}

.homework-link-card {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.homework-link-card:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
}

.homework-summary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
}

.homework-next {
    background: linear-gradient(180deg, rgba(236, 253, 245, 0.72) 0%, rgba(255, 255, 255, 0.92) 100%);
    border: 1px solid rgba(20, 184, 166, 0.16);
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.homework-next-title {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    margin-bottom: 10px;
}

.homework-next-title h4 {
    margin: 0;
}

.homework-details {
    margin-top: 14px;
}

.homework-details summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.homework-details summary::-webkit-details-marker {
    display: none;
}

.homework-list {
    margin-top: 16px;
    display: grid;
    gap: 12px;
}

.homework-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-soft);
}

.homework-item.completed {
    opacity: 0.72;
    filter: saturate(0.75);
}

.homework-item.completed .homework-item-main strong,
.homework-item.completed .homework-item-main p,
.homework-item.completed .homework-item-meta {
    color: var(--gray);
}

.homework-item-main p {
    margin-top: 6px;
    color: var(--gray-dark);
}

.homework-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    text-align: right;
    white-space: nowrap;
}

.homework-settings-note {
    margin-top: 10px;
}

.homework-settings-note p {
    margin-top: 6px;
}

.status-card {
    padding: 0;
}

.status-summary {
    list-style: none;
    cursor: pointer;
}

.status-summary::-webkit-details-marker {
    display: none;
}

.status-summary h3 {
    margin: 0;
}

.status-summary .badge {
    margin-left: auto;
}

.status-card[open] .card-header {
    border-bottom-color: rgba(148, 163, 184, 0.2);
}

.login-container {
    align-items: center;
}

.login-hero,
.settings-hero,
.homework-hero {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-hero-copy {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.hero-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.12);
    color: var(--navy-dark);
    font-weight: 700;
    border: 1px solid rgba(20, 184, 166, 0.18);
}

.login-feature-list {
    display: grid;
    gap: 12px;
}

.login-feature-item {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: var(--shadow-soft);
}

.dashboard-settings-grid,
.theme-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.theme-choice-card,
.settings-card,
.homework-manager-card {
    background: var(--surface-strong);
}

.theme-choice-button {
    min-height: 110px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    white-space: normal;
    border-radius: 18px;
}

.theme-choice-button.active {
    outline: 3px solid rgba(37, 99, 235, 0.25);
}

.schedule-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

.timetable-days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.schedule-day-panel {
    border: 1px solid rgba(229, 231, 235, 0.7);
    border-radius: 14px;
    padding: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 250, 252, 0.92) 100%);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.schedule-day-panel h5 {
    margin: 0 0 12px 0;
    color: var(--navy);
    font-size: 1rem;
}

.menu-editor-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.schedule-week-panel {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.schedule-table,
.timetable-table {
    width: 100%;
    border-collapse: collapse;
}

.schedule-table th,
.schedule-table td,
.timetable-table th,
.timetable-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 8px;
    vertical-align: top;
}

.schedule-table th,
.timetable-table th {
    text-align: left;
    color: var(--navy);
    font-size: 0.85rem;
}

.schedule-table textarea {
    min-height: 62px;
    resize: vertical;
}

.schedule-preview ul {
    padding-left: 18px;
    margin: 8px 0;
}

.schedule-preview li {
    margin-bottom: 6px;
    line-height: 1.5;
}

.card ul {
    margin: 12px 0;
    padding-left: 20px;
}

.card li {
    margin-bottom: 8px;
    line-height: 1.6;
    color: var(--gray-dark);
}

[data-theme="dark"] .card li {
    color: var(--text-secondary);
}

.markdown-content {
    color: var(--gray-dark);
    line-height: 1.7;
}

.markdown-content > :first-child {
    margin-top: 0;
}

.markdown-content > :last-child {
    margin-bottom: 0;
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content blockquote,
.markdown-content pre,
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin: 0 0 12px;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 22px;
}

.markdown-content li {
    margin-bottom: 6px;
}

.markdown-content a {
    word-break: break-word;
}

.markdown-content code {
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    background: rgba(15, 118, 110, 0.08);
    color: var(--navy-dark);
    font-size: 0.92em;
}

.markdown-content pre {
    padding: 14px 16px;
    overflow-x: auto;
    border-radius: 10px;
    background: #f3f4f6;
}

.markdown-content pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    color: var(--navy-dark);
    line-height: 1.3;
}

.notice-history-entry {
    margin-top: 8px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.6);
    color: var(--navy-dark);
    border: 1.5px solid rgba(148, 163, 184, 0.38);
    backdrop-filter: blur(12px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(37, 99, 235, 0.32);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.35);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.35);
}

.btn-info {
    background: linear-gradient(135deg, var(--info) 0%, #0891b2 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(45, 212, 191, 0.25);
}

.btn-info:hover {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
    box-shadow: 0 8px 25px rgba(45, 212, 191, 0.35);
}

.btn-admin {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.25);
}

.btn-admin:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.35);
    transform: translateY(-2px);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.16);
    color: var(--white);
    border: 1.5px solid rgba(255, 255, 255, 0.34);
    backdrop-filter: blur(12px);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn-large { width: 100%; padding: 13px 24px; font-size: 1rem; }
.btn-small { padding: 7px 14px; font-size: 0.85rem; }
.btn-tiny { padding: 5px 10px; font-size: 0.75rem; }

/* ========================================
   ALERTS & BADGES
   ======================================== */

.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin: 0 20px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
    border-left: 4px solid;
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateX(-20px);
    }
    to { 
        opacity: 1; 
        transform: translateX(0);
    }
}

.alert-success { 
    background: rgba(209, 250, 229, 0.6);
    color: #065f46;
    border-left-color: var(--success);
}

[data-theme="dark"] .alert-success {
    background: rgba(20, 80, 60, 0.6);
    color: #a7f3d0;
}

.alert-danger { 
    background: rgba(254, 226, 226, 0.6);
    color: #7f1d1d;
    border-left-color: var(--danger);
}

[data-theme="dark"] .alert-danger {
    background: rgba(80, 20, 20, 0.6);
    color: #fca5a5;
}

.alert-warning { 
    background: rgba(254, 243, 199, 0.6);
    color: #78350f;
    border-left-color: var(--warning);
}

[data-theme="dark"] .alert-warning {
    background: rgba(80, 60, 20, 0.6);
    color: #fcd34d;
}

.alert-info { 
    background: rgba(207, 250, 254, 0.6);
    color: #164e63;
    border-left-color: var(--info);
}

[data-theme="dark"] .alert-info {
    background: rgba(20, 60, 80, 0.6);
    color: #a5f3fc;
}

.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-secondary { background: #e5e7eb; color: #374151; }
.badge-warning { background: #fef3c7; color: #78350f; }
.badge-danger { background: #fee2e2; color: #7f1d1d; }

/* ========================================
   TABS
   ======================================== */

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 6px;
    background: rgba(241, 245, 249, 0.84);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 999px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 16px;
    color: var(--gray);
    font-weight: 600;
    cursor: pointer;
    border-radius: 999px;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--white);
    background: linear-gradient(135deg, var(--navy-light) 0%, var(--sky) 100%);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.tab-btn:hover { color: var(--navy); }

.tab-content { display: none; }

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   TABLES
   ======================================== */

.table-responsive { overflow-x: auto; }

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

.users-table thead { background: var(--gray-light); }

.users-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--navy);
    border-bottom: 2px solid #d1d5db;
}

.users-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.users-table tbody tr:hover { background: var(--gray-light); }

.id-cell { color: var(--gray); font-weight: 600; }
.email-cell { color: var(--navy); }
.status-cell { font-weight: 600; }
.date-cell { font-size: 0.9rem; color: var(--gray); }

.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.actions-cell .btn { white-space: nowrap; }

/* ========================================
   DASHBOARD / ADMIN SECTIONS
   ======================================== */

.info-box,
.profile-summary,
.menu-current,
.holiday-alert,
.pin-info,
.error-details {
    background: linear-gradient(180deg, rgba(236, 253, 245, 0.7) 0%, rgba(239, 246, 255, 0.72) 100%);
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(20, 184, 166, 0.16);
    border-left: 5px solid var(--navy-light);
    backdrop-filter: blur(12px);
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
}

.info-box:hover {
    transform: translateY(-1px);
}

.info-box h4,
.profile-summary h4 { 
    margin-top: 0; 
    color: var(--navy);
    font-weight: 700;
}

.info-box ul,
.error-details ul { 
    margin: 12px 0 0 24px;
}

.info-box li,
.error-details li { 
    margin: 8px 0;
    color: var(--gray-dark);
    line-height: 1.6;
}

.holiday-alert { 
    border-left-color: var(--warning);
    background: linear-gradient(180deg, rgba(254, 243, 199, 0.68) 0%, rgba(255, 251, 235, 0.78) 100%);
    color: #78350f;
}

.pin-info p { 
    margin: 0;
    color: var(--navy);
    font-size: 0.95rem;
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 18px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.82) 0%, rgba(255, 255, 255, 0.92) 100%);
    backdrop-filter: blur(12px);
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.85);
}

.setting-info p { 
    margin: 0;
}

.setting-label { 
    font-weight: 700;
    color: var(--navy);
    letter-spacing: 0.3px;
}

.setting-form {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.status-item {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.82) 0%, rgba(255, 255, 255, 0.92) 100%);
    padding: 18px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-soft);
}

.status-label { 
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-value { 
    font-size: 1.3rem;
    color: var(--navy);
    font-weight: 700;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
}

.info-row:last-child { border-bottom: none; }

.label { font-weight: 600; color: var(--gray); font-size: 0.9rem; }
.value { color: var(--navy); font-weight: 600; }

.week-display {
    padding: 20px;
    text-align: center;
    background: var(--gray-light);
    border-radius: 8px;
    margin: 15px 0;
}

.week-badge {
    display: inline-block;
    background: var(--navy-light);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
}

.account-grid,
.menu-grid,
.timetable-grid,
.prompt-actions {
    display: grid;
    gap: 15px;
}

.account-grid,
.menu-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.timetable-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.prompt-actions { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: center; }

.timetable-panel {
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(248, 250, 252, 0.86);
}

.timetable-panel h4 {
    margin: 0;
    padding: 12px 15px;
    color: var(--white);
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
}

.admin-page .timetable-panel h4 {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
}

.admin-page .info-box,
.admin-page .profile-summary,
.admin-page .menu-current,
.admin-page .holiday-alert {
    border-left-color: var(--red);
    background: #fee2e2;
}

.admin-page .week-badge {
    background: var(--red);
}

.mailing-lists-page {
    display: grid;
    gap: 24px;
}

.mailing-list-summary {
    cursor: pointer;
    align-items: flex-start;
}

.mailing-list-summary::-webkit-details-marker {
    display: none;
}

.mailing-list-summary-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mailing-list-layout {
    display: grid;
    grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.1fr);
    gap: 18px;
    margin-top: 18px;
}

.mailing-list-section {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 18px;
    padding: 16px;
}

[data-theme="dark"] .mailing-list-section {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.18);
}

.mailing-list-section-members {
    grid-row: span 2;
}

.mailing-textarea {
    width: 100%;
}

.mailing-member-list {
    display: grid;
    gap: 10px;
    max-height: 420px;
    overflow: auto;
    padding-right: 4px;
}

.mailing-member-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: rgba(248, 250, 252, 0.92);
    cursor: pointer;
    transition: var(--transition);
}

.mailing-member-item:hover {
    transform: translateY(-1px);
    border-color: rgba(20, 184, 166, 0.35);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] .mailing-member-item {
    background: rgba(17, 24, 39, 0.92);
    border-color: rgba(148, 163, 184, 0.22);
}

[data-theme="dark"] .mailing-member-item:hover {
    border-color: rgba(94, 234, 212, 0.45);
}

.mailing-member-item input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--navy-light);
    flex: 0 0 auto;
}

.mailing-member-label-text {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.mailing-member-label-text strong {
    color: var(--text-primary);
}

.mailing-member-label-text .help-text {
    margin-top: 0;
}

.mailing-textarea {
    min-height: 180px;
    margin-bottom: 14px;
}

.mailing-html {
    min-height: 240px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.mailing-footer {
    min-height: 140px;
}

.mailing-list-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.mailing-list-actions-row .btn {
    min-width: 140px;
}

.mailing-list-overview-card .card-body {
    display: grid;
    gap: 18px;
}

.timetable-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.92);
}

.timetable-table th,
.timetable-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

.timetable-table th {
    color: var(--navy);
    background: rgba(236, 253, 245, 0.86);
    font-size: 0.9rem;
}

.timetable-table .period-cell {
    width: 80px;
    font-weight: 700;
    color: var(--navy);
}

.menu-textarea {
    min-height: 140px;
    resize: vertical;
}

.timetable-save { margin-top: 10px; }

.prompt-card { text-align: center; }
.profile-summary { margin-bottom: 15px; }

.choice-card {
    max-width: 760px;
    margin-inline: auto;
}

.choice-info {
    margin-bottom: 24px;
}

.choice-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.choice-button {
    min-height: 190px;
    padding: 22px 18px !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 22px;
    white-space: normal;
}

.choice-button span {
    line-height: 1.35;
}

.prompt-card .prompt-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: stretch;
}

.prompt-card .prompt-actions .btn,
.prompt-card .prompt-actions form {
    width: 100%;
}

.error-card {
    padding: 42px;
    max-width: 560px;
    text-align: center;
}

.error-icon {
    font-size: 3.5rem;
    margin-bottom: 18px;
}

.error-card h1 {
    font-size: 3.2rem;
    margin: 10px 0 6px 0;
}

.error-message {
    font-size: 1rem;
    margin-bottom: 15px;
}

.error-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.more-info {
    width: 100%;
    max-width: 520px;
    padding: 0;
}

.more-info summary {
    list-style: none;
    cursor: pointer;
}

.more-info summary::-webkit-details-marker { display: none; }
.more-info-content { margin-top: 12px; }

/* ========================================
   ADMIN STYLING
   ======================================== */

.admin-card {
    border-left: 4px solid var(--red);
}

.admin-card .card-header {
    background: linear-gradient(135deg, rgba(254, 226, 226, 0.7) 0%, rgba(254, 202, 202, 0.7) 100%);
    border-left: 4px solid var(--red);
    backdrop-filter: blur(10px);
}

.admin-card .card-header h2,
.admin-card .card-header h3 {
    color: var(--red-dark);
}

/* ========================================
   FOOTER / MISC
   ======================================== */

.page-footer {
    text-align: center;
    padding: 20px;
    color: var(--gray);
    font-size: 0.9rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 40px;
}

[data-theme="dark"] .page-footer {
    border-top-color: #404040;
    color: #9ca3af;
}

.page-footer a { color: var(--navy-light); }

.form-footer {
    text-align: center;
    margin-top: 15px;
    color: var(--gray);
    font-size: 0.9rem;
}

.form-footer.small { font-size: 0.8rem; }
.form-footer a { color: var(--navy-light); font-weight: 600; }

.subtitle {
    color: var(--gray);
    font-size: 0.9rem;
    margin: 5px 0 0 0;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.error-card {
    padding: 40px;
    max-width: 420px;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.error-card h1 {
    font-size: 3rem;
    margin: 10px 0 5px 0;
}

.error-message {
    font-size: 1rem;
    margin-bottom: 15px;
}

.error-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ========================================
   FEEDBACK BANNER
   ======================================== */

.feedback-banner {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.96) 0%, rgba(37, 99, 235, 0.9) 100%);
    padding: 12px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    display: flex;
    justify-content: center;
    align-items: center;
}

[data-theme="dark"] .feedback-banner {
    background: linear-gradient(135deg, #0a4d45 0%, #073735 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.feedback-btn {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.feedback-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
    text-decoration: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .container { 
        width: min(100%, calc(100% - 24px));
        padding: 18px 0 28px;
    }

    .form-card { 
        padding: 24px;
    }

    .card-header,
    .card-body { 
        padding: 18px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 18px;
    }

    .topbar-right { 
        width: 100%;
    }

    .choice-buttons {
        grid-template-columns: 1fr;
    }

    .mailing-list-layout {
        grid-template-columns: 1fr;
    }

    .mailing-list-section-members {
        grid-row: auto;
    }

    .mailing-list-actions-row {
        flex-direction: column;
    }

    .login-container {
        grid-template-columns: 1fr;
    }

    .setting-row { 
        grid-template-columns: 1fr;
    }

    .setting-form { 
        width: 100%;
    }

    .error-card { 
        padding: 30px 20px;
    }

    .error-actions { 
        flex-direction: column;
    }

    .btn { 
        width: 100%;
    }

    .modal-shell {
        width: 95vw;
        border-radius: 16px;
    }

    .modal-shell-large {
        width: 95vw;
    }

    .feedback-banner {
        padding: 10px 15px;
    }

    .feedback-btn {
        font-size: 13px;
        padding: 6px 14px;
    }
}

@media (max-width: 480px) {
    h1 { 
        font-size: 1.6rem;
    }
    h2 { 
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    .form-card {
        padding: 18px;
        border-radius: 12px;
    }

    .tabs { 
        flex-wrap: wrap;
    }

    .actions-cell { 
        flex-direction: column;
    }

    .users-table th,
    .users-table td { 
        padding: 10px 6px;
    }

    .topbar-left h2 {
        font-size: 1.4rem;
    }

    .modal-body {
        padding: 18px;
    }

    .feedback-banner {
        padding: 8px 10px;
    }

    .feedback-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
}
