﻿:root {
    color-scheme: light;
    --bg-0: #f6f7fb;
    --bg-1: #e9eef5;
    --card: rgba(255, 255, 255, 0.9);
    --card-strong: #ffffff;
    --border: rgba(15, 23, 42, 0.12);
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
    --primary: #0ea5a3;
    --primary-dark: #0f766e;
    --accent: #f97316;
    --text: #0f172a;
    --muted: #475569;
    --muted-light: #64748b;
    --radius: 18px;
    --radius-sm: 12px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Work Sans", "Segoe UI", sans-serif;
    color: var(--text);
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at top right, #dff4f4 0%, transparent 45%),
        radial-gradient(circle at 20% 20%, #fde6d4 0%, transparent 45%),
        linear-gradient(180deg, var(--bg-0), var(--bg-1));
}

body.modal-open {
    overflow: hidden;
}

.app-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(120deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px),
        linear-gradient(60deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
    background-size: 120px 120px;
    opacity: 0.3;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.modal-overlay.is-hidden {
    display: none;
}

.modal {
    max-width: 720px;
    width: 100%;
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(15, 23, 42, 0.1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal h2 {
    margin-top: 0;
    font-size: 1.5rem;
}

.modal-header {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.logo {
    height: 50px;
    object-fit: contain;
    border-radius: 12px;
    padding: 8px;
}

.modal-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-eyebrow {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
    font-weight: 600;
}

.modal-subtitle {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 0.95rem;
}

.modal-body {
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--text);
    overflow: auto;
    max-height: 58vh;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.8) transparent;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 999px;
}

.modal-section {
    padding: 12px 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.modal-section h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--text);
}

.modal-section p {
    margin: 0 0 8px;
}

.modal-section p:last-child {
    margin-bottom: 0;
}

.modal-section ul {
    margin: 0;
    padding-left: 18px;
}

.modal-final {
    margin-top: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #ecfeff;
    border: 1px solid rgba(14, 165, 163, 0.2);
    color: #0f766e;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 4px;
}

.primary-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #0ea5a3, #14b8a6);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.app {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hero {
    display: flex;
    gap: 32px;
    justify-content: space-between;
    align-items: stretch;
    flex-wrap: wrap;
}

.hero-copy {
    flex: 1 1 420px;
    padding: 14px 0;
}

.eyebrow {
    font-family: "Work Sans", "Segoe UI", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 12px;
}

.hero h1 {
    font-family: "Work Sans", "Segoe UI", sans-serif;
    font-size: clamp(2rem, 3vw, 2.8rem);
    margin: 0 0 12px;
}

.lead {
    font-size: 1.05rem;
    color: var(--muted);
    line-height: 1.6;
    max-width: 1200px;
    margin: 0;
}

.hero-card {
    flex: 0 1 320px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: grid;
    gap: 16px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--muted-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 600;
}

.search-panel {
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.tab {
    border: 1px solid transparent;
    background: #f1f5f9;
    color: var(--muted);
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab.active {
    background: linear-gradient(135deg, #0ea5a3, #22c55e);
    color: #fff;
    border-color: rgba(14, 165, 163, 0.3);
    box-shadow: 0 12px 24px rgba(14, 165, 163, 0.25);
}

.search-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.input-wrap {
    flex: 1 1 320px;
    display: flex;
    gap: 8px;
    background: #fff;
    padding: 6px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    align-items: center;
}

#searchInput {
    flex: 1;
    border: none;
    padding: 12px 14px;
    font-size: 1rem;
    outline: none;
    background: transparent;
    color: var(--text);
    font-family: "Work Sans", sans-serif;
}

#searchInput::placeholder {
    color: var(--muted-light);
}

.ghost-btn {
    border: none;
    background: #e2e8f0;
    color: var(--muted);
    padding: 10px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}

.search-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #0ea5a3, #14b8a6);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 16px 30px rgba(14, 165, 163, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 8px 0 12px;
}

.course-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--muted);
    min-width: 200px;
    flex: 1 1 200px;
}

.filter select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-family: "Work Sans", sans-serif;
    background: #fff;
    color: var(--text);
}

.search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(14, 165, 163, 0.35);
}

.btn-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
}

.btn-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.meta-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.results-count {
    font-weight: 600;
    color: var(--text);
}

.mode-pill {
    background: #e2e8f0;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    color: var(--text);
}

.search-tip {
    color: var(--muted-light);
}

.loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--card);
    border-radius: 999px;
    border: 1px solid var(--border);
    width: fit-content;
    box-shadow: var(--shadow);
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #cbd5f5;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.results-section {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.course-card {
    background: var(--card-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.student-table {
    background: var(--card-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    padding: 0;
}

.student-table-header,
.student-row {
    display: grid;
    grid-template-columns: 60px 2fr 80px;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    min-width: 520px;
}

.student-table-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-light);
    font-weight: 600;
    background: #f8fafc;
}

.student-row {
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.student-row:hover {
    background: #f8fafc;
}

.student-row.active {
    background: #eef2f7;
    box-shadow: inset 4px 0 0 #cbd5e1;
}

.student-detail {
    padding: 14px 18px 18px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.student-detail.active {
    border-left: 4px solid #cbd5e1;
}

.student-cell {
    display: flex;
    align-items: center;
}

.student-cell[data-label="STT"] {
    color: var(--muted-light);
    font-weight: 600;
}

.student-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.badge {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.table {
    display: grid;
    gap: 6px;
    margin-top: 0;
    min-width: 720px;
    width: 100%;
}

.course-table {
    --cols: 110px 2fr 120px 120px 40px;
    min-width: 680px;
    width: 100%;
}

.enroll-table {
    --cols: 50px 2.5fr 1.4fr 120px 90px 90px 40px;
    min-width: 820px;
    width: 100%;
}

.table-header,
.table-row {
    display: grid;
    grid-template-columns: var(--cols);
    gap: 12px;
    align-items: start;
}

.table-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-light);
    font-weight: 600;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.table-row {
    padding: 8px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

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

.table-row > div {
    font-size: 0.95rem;
    color: var(--text);
    word-break: break-word;
}

.table-scroll {
    overflow-x: auto;
    padding-bottom: 0;
    margin-top: 20px;
}

.table-scroll::-webkit-scrollbar {
    height: 6px;
}

.table-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 999px;
}

.alpha-filter {
    margin-top: 8px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alpha-title {
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.alpha-toggle {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.alpha-type,
.alpha-letter {
    border: 1px solid var(--border);
    background: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--muted);
}

.alpha-type.active,
.alpha-letter.active {
    background: linear-gradient(135deg, #0ea5a3, #22c55e);
    color: #fff;
    border-color: rgba(14, 165, 163, 0.3);
}

.alpha-letters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.alpha-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.alpha-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    min-width: 36px;
}

.subtle {
    font-size: 0.85rem;
    color: var(--muted-light);
}

.pagination {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.empty-state,
.error-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--muted);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
    background: rgba(255, 255, 255, 0.7);
}

.empty-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e2e8f0;
}

.empty-icon svg {
    width: 28px;
    height: 28px;
    fill: var(--muted);
}

.notice {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: #fff7ed;
    margin: 20px 0;
    color: #9a3412;
    border: 1px solid #fed7aa;
    font-size: 0.9rem;
}

.footer {
    font-size: 0.85rem;
    color: var(--muted-light);
    text-align: center;
}

.stats-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    justify-content: center;
}

.stats-inline strong {
    color: var(--text);
    font-weight: 600;
}

@media (max-width: 960px) {
    .table {
        min-width: 700px;
    }

    .enroll-table {
        min-width: 780px;
    }
}

@media (max-width: 720px) {

    :root {
        --radius-lg: 10px;
    }

    .hero h1 {
        font-size: 1.5rem;
    }
    
    .hero {
        flex-direction: column;
        margin-bottom: 6px;
    }

    .app {
        padding: 18px 14px 28px;
        gap: 10px;
    }

    .search-panel,
    .course-card,
    .course-card {
        padding-left: 16px;
        padding-right: 16px;
    }

    .search-panel {
        padding-left: 16px;
        padding-right: 16px;
    }

    .search-row {
        flex-direction: column;
    }

    .search-tip, .mode-pill, .results-count {
        font-size: 0.75rem;
    }

    .hero-copy {
        flex: none;
        padding: 10px;
    }

    .lead {
        font-size: 0.8rem;
    }

    .input-wrap {
        padding: 2px;
        flex: 0 0 auto;
        min-height: 0;
    }

    #searchInput {
        padding: 6px 10px;
        font-size: 0.98rem;
        line-height: 1.2;
        height: 36px;
    }

    .ghost-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
        height: 32px;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
        box-shadow: 0 5px 10px rgba(14, 165, 163, 0.25);
        padding: 9px 14px;

    }

    .card-filters {
        flex-direction: column;
    }

    .course-filters {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 8px;
    }

    .alpha-toggle {
        justify-content: flex-start;
    }

    .alpha-row {
        align-items: flex-start;
    }

    .alpha-label {
        min-width: auto;
    }

    .alpha-letters {
        gap: 4px;
    }

    .filter {
        width: 100%;
        gap: 4px;
        flex: none;
    }

    .filter select {
        padding: 6px 8px;
        font-size: 0.95rem;
        height: 36px;
    }

    .modal {
        padding: 18px;
    }

    .modal-actions {
        justify-content: stretch;
    }

    .modal-actions button {
        flex: 1 1 120px;
    }

    .modal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .logo {
        display: none;
    }

    .modal-body {
        max-height: 60vh;
    }

    .student-table-header {
        grid-template-columns: 30px 1fr 80px;
    }

    .student-name {
        font-size: 0.9rem;
    }

    .student-cell[data-label="STT"] {
        font-size: 0.8rem;
    }

    .student-row {
        grid-template-columns: 30px 1fr 80px;
        gap: 12px;
    }

    .student-table-header,
    .student-row {
        padding: 8px 10px;
    }

    .student-cell {
        padding-left: 0;
    }

    .table-header,
    .table-row {
        gap: 8px;
    }

    .table-row {
        padding: 6px 0;
    }
}

@media (max-width: 560px) {
    .student-table-header,
    .student-row {
        min-width: 100%;
    }

    .course-card {
        padding-left: 12px;
        padding-right: 12px;
    }

    .search-panel {
        padding-left: 12px;
        padding-right: 12px;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
