@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
    --bg: #0b0e1a;
    --bg2: #111425;
    --card: rgba(255,255,255,0.04);
    --card-border: rgba(255,255,255,0.08);
    --primary: #6366f1;
    --primary-light: #818cf8;
    --accent: #22d3ee;
    --accent2: #a78bfa;
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --text: #e2e8f0;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Sora', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99,102,241,0.15) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 110%, rgba(34,211,238,0.1) 0%, transparent 60%);
    overflow-x: hidden;
}

/* ─── HEADER ───────────────────────────────────────────────── */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(11,14,26,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
}

header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

header h1::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.8); }
}

.header-buttons { display: flex; gap: 10px; }

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn, button {
    font-family: 'Sora', sans-serif;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-logout, #logout-button {
    background: rgba(255,255,255,0.07);
    color: var(--text-dim);
    border: 1px solid var(--card-border);
    padding: 0.55rem 1.1rem;
}
.btn-logout:hover, #logout-button:hover {
    background: rgba(248,113,113,0.15);
    color: var(--danger);
    border-color: rgba(248,113,113,0.3);
}

.btn-add, button.btn-add {
    background: linear-gradient(135deg, var(--primary), var(--accent2));
    color: white;
    padding: 0.6rem 1.2rem;
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}
.btn-add:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }

.btn-small {
    background: rgba(255,255,255,0.07);
    color: var(--text-dim);
    border: 1px solid var(--card-border);
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 0.78rem;
}
.btn-small:hover { background: rgba(99,102,241,0.2); color: var(--primary-light); border-color: var(--primary); }

.btn-danger-text {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.78rem;
    cursor: pointer;
    opacity: 0.7;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'Sora', sans-serif;
}
.btn-danger-text:hover { opacity: 1; background: rgba(248,113,113,0.1); }

.btn-danger-outline {
    background: rgba(248,113,113,0.08);
    border: 1px solid rgba(248,113,113,0.25);
    color: var(--danger);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
}
.btn-danger-outline:hover { background: rgba(248,113,113,0.18); }

/* ─── MAIN & GRID ────────────────────────────────────────────── */
main { padding: 2.5rem 5%; max-width: 1300px; margin: 0 auto; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}

/* ─── CARDS ──────────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 1.8rem;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    animation: fadeUp 0.5s ease forwards;
    opacity: 0;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover { transform: translateY(-3px); border-color: rgba(99,102,241,0.25); box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.card:hover::before { opacity: 1; }

.card h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #fff;
    margin-bottom: 1.2rem;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.12s; }
.card:nth-child(3) { animation-delay: 0.19s; }
.card:nth-child(4) { animation-delay: 0.26s; }

.course-card-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.2rem;
    gap: 1rem;
}

/* ─── TASK BOX ────────────────────────────────────────────────── */
.task-box {
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    margin-top: 1rem;
    transition: border-color 0.2s;
}
.task-box:hover { border-color: rgba(99,102,241,0.2); }
.task-box h4 { font-size: 0.92rem; font-weight: 600; color: var(--primary-light); }

.task-actions { display: flex; gap: 6px; align-items: center; }

.file-row {
    margin-top: 0.6rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-row label {
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    transition: opacity 0.2s;
}
.file-row label:hover { opacity: 0.75; }

/* ─── TABLE ──────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin-top: 0.9rem; }

th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--card-border);
    text-align: left;
    font-weight: 500;
}

td { padding: 0.65rem 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 0.85rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.03); }

/* ─── GRADE BADGE ────────────────────────────────────────────── */
.grade-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.78rem;
    font-family: 'DM Mono', monospace;
    background: rgba(99,102,241,0.12);
    color: var(--primary-light);
    border: 1px solid rgba(99,102,241,0.2);
    min-width: 36px;
    justify-content: center;
}

.grade-badge.pending { background: rgba(251,191,36,0.1); color: var(--warning); border-color: rgba(251,191,36,0.2); }
.grade-badge.good { background: rgba(52,211,153,0.1); color: var(--success); border-color: rgba(52,211,153,0.2); }
.grade-badge.bad { background: rgba(248,113,113,0.1); color: var(--danger); border-color: rgba(248,113,113,0.2); }

/* ─── STUDENT TASK LIST ──────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 0.7rem; }

.task-item {
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    transition: border-color 0.2s, transform 0.2s;
}
.task-item:hover { border-color: rgba(34,211,238,0.2); transform: translateX(4px); }

.task-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.task-title { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.task-attachment { margin-top: 0.5rem; font-size: 0.78rem; }
.task-attachment a { color: var(--accent); text-decoration: none; }
.task-attachment a:hover { text-decoration: underline; }

/* ─── LOGIN ──────────────────────────────────────────────────── */
.login-wrapper {
    min-height: calc(100vh - 70px);
    display: grid;
    place-items: center;
    padding: 2rem;
}

.login-container {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(20px);
    animation: fadeUp 0.6s ease forwards;
    position: relative;
    overflow: hidden;
}

.login-container::after {
    content: '';
    position: absolute;
    bottom: -80px; right: -80px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.login-logo {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.5rem;
    box-shadow: 0 8px 24px rgba(99,102,241,0.35);
}

.login-container h2 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    margin-bottom: 0.3rem;
}

.login-subtitle {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

#login-form { display: flex; flex-direction: column; gap: 1rem; }

#login-form label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 5px;
}

#login-form input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Sora', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
#login-form input::placeholder { color: var(--text-muted); }

#login-form button[type="submit"] {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 0.9rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 0.5rem;
    width: 100%;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(99,102,241,0.3);
    transition: all 0.2s;
    font-family: 'Sora', sans-serif;
    border: none;
    cursor: pointer;
}
#login-form button[type="submit"]:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(99,102,241,0.4); }
#login-form button[type="submit"]:active { transform: translateY(0); }

.test-users {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--card-border);
    border-radius: 10px;
}
.test-users p { font-size: 0.75rem; color: var(--text-muted); margin: 0 0 0.4rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.test-users code { font-family: 'DM Mono', monospace; font-size: 0.78rem; color: var(--text-dim); display: block; margin: 3px 0; }

/* ─── ADMIN GRID ──────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 1.8rem;
    animation: fadeUp 0.5s ease forwards;
    opacity: 0;
}

.dashboard-card h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1.2rem;
    display: flex; align-items: center; gap: 8px;
}
.dashboard-card h2::before {
    content: '';
    width: 3px; height: 16px;
    background: linear-gradient(var(--primary), var(--accent));
    border-radius: 2px;
    display: inline-block;
}

#add-user-form { display: flex; flex-direction: column; gap: 0.7rem; }

#add-user-form input, #add-user-form select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--card-border);
    border-radius: 9px;
    color: var(--text);
    font-family: 'Sora', sans-serif;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}
#add-user-form input:focus, #add-user-form select:focus { outline: none; border-color: var(--primary); }
#add-user-form select option { background: #1a1d30; }

#add-user-form button {
    background: linear-gradient(135deg, var(--primary), var(--accent2));
    color: white;
    padding: 0.7rem;
    font-weight: 600;
    justify-content: center;
    font-family: 'Sora', sans-serif;
    border: none;
    cursor: pointer;
    border-radius: 9px;
}

hr { border: none; border-top: 1px solid var(--card-border); margin: 1.2rem 0; }

.dashboard-card h3 { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.8rem; }

#user-list, #course-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

#user-list li, #course-list li {
    padding: 0.65rem 0.9rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--card-border);
    border-radius: 9px;
    font-size: 0.85rem;
    color: var(--text-dim);
    display: flex; align-items: center; gap: 8px;
}

.role-badge {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.role-badge.admin { background: rgba(167,139,250,0.15); color: var(--accent2); border: 1px solid rgba(167,139,250,0.25); }
.role-badge.profesor { background: rgba(34,211,238,0.1); color: var(--accent); border: 1px solid rgba(34,211,238,0.2); }
.role-badge.estudiante { background: rgba(52,211,153,0.1); color: var(--success); border: 1px solid rgba(52,211,153,0.2); }

/* ─── PAGE TITLE ─────────────────────────────────────────────── */
.page-title {
    margin-bottom: 2rem;
    animation: fadeUp 0.4s ease forwards;
}
.page-title h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.03em; color: #fff; }
.page-title p { color: var(--text-muted); margin-top: 0.25rem; font-size: 0.9rem; }

/* ─── TOAST ──────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 2rem; right: 2rem;
    display: flex; flex-direction: column; gap: 0.7rem;
    z-index: 9999;
}

.toast {
    background: rgba(17,20,37,0.95);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.9rem 1.2rem;
    font-size: 0.88rem;
    color: var(--text);
    backdrop-filter: blur(20px);
    display: flex; align-items: center; gap: 10px;
    animation: slideIn 0.3s cubic-bezier(0.4,0,0.2,1) forwards;
    max-width: 320px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.toast.success { border-color: rgba(52,211,153,0.3); }
.toast.error { border-color: rgba(248,113,113,0.3); }
.toast.info { border-color: rgba(99,102,241,0.3); }

.toast-icon { font-size: 1.1rem; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.out { animation: slideOut 0.3s ease forwards; }

@keyframes slideOut {
    to { opacity: 0; transform: translateX(30px); }
}

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state p { font-size: 0.95rem; }

/* ─── MODAL OVERLAY ──────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 500;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: #141729;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 420px;
    animation: scaleIn 0.25s cubic-bezier(0.4,0,0.2,1);
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal h3 { font-size: 1.1rem; font-weight: 600; color: #fff; margin-bottom: 1.2rem; }

.modal-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Sora', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}
.modal-input:focus { outline: none; border-color: var(--primary); }

.modal-actions { display: flex; gap: 0.7rem; justify-content: flex-end; }

.modal-btn-confirm {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 0.65rem 1.3rem;
    border-radius: 9px;
    font-weight: 600;
    font-family: 'Sora', sans-serif;
    border: none;
    cursor: pointer;
}

.modal-btn-cancel {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
    padding: 0.65rem 1.3rem;
    border-radius: 9px;
    font-family: 'Sora', sans-serif;
    cursor: pointer;
}
.modal-btn-cancel:hover { background: rgba(248,113,113,0.1); color: var(--danger); }

/* ─── STATUS BADGE ───────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.status-open     { background: rgba(52,211,153,0.12); color: var(--success);  border: 1px solid rgba(52,211,153,0.25); }
.status-closed   { background: rgba(248,113,113,0.12); color: var(--danger);  border: 1px solid rgba(248,113,113,0.25); }
.status-upcoming { background: rgba(251,191,36,0.12);  color: var(--warning); border: 1px solid rgba(251,191,36,0.25); }

/* ─── TASK DATES ─────────────────────────────────────────────── */
.task-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.task-dates span {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--card-border);
    padding: 2px 8px;
    border-radius: 6px;
}

/* ─── TASK HIDDEN ────────────────────────────────────────────── */
.task-hidden { opacity: 0.5; border-style: dashed !important; }

/* ─── SUBMISSION BOX ─────────────────────────────────────────── */
.submission-box {
    margin-top: 0.8rem;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    font-size: 0.82rem;
    border: 1px dashed var(--card-border);
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
}
.submission-box.submitted {
    border-color: rgba(52,211,153,0.35);
    background: rgba(52,211,153,0.06);
    color: var(--text-dim);
}
.submission-box.closed-no-sub {
    border-color: rgba(248,113,113,0.25);
    background: rgba(248,113,113,0.06);
    color: var(--danger);
    opacity: 0.8;
}
.submission-box.upcoming-box {
    border-color: rgba(251,191,36,0.25);
    background: rgba(251,191,36,0.05);
    color: var(--warning);
    opacity: 0.8;
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary), var(--accent2));
    color: white;
    padding: 0.55rem 1.2rem;
    border-radius: 9px;
    font-weight: 600;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    font-family: 'Sora', sans-serif;
    box-shadow: 0 4px 14px rgba(99,102,241,0.3);
    transition: all 0.2s;
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }

.submission-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.submission-link:hover { text-decoration: underline; }

/* ─── WIDE MODAL ─────────────────────────────────────────────── */
.modal-wide { max-width: 560px; }

.modal-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.modal-field { margin-bottom: 0.9rem; }

.modal-dates-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

@media (max-width: 500px) {
    .modal-dates-row { grid-template-columns: 1fr; }
}

.btn-edit { background: rgba(99,102,241,0.12); color: var(--primary-light); border: 1px solid rgba(99,102,241,0.2); }
.btn-edit:hover { background: rgba(99,102,241,0.22); border-color: var(--primary); }

/* ─── NO-DATE CHECKBOX ───────────────────────────────────────── */
.no-date-check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-dim);
    font-weight: 500;
    margin: 0.2rem 0 1rem;
    user-select: none;
}
.no-date-check-label input[type="checkbox"] { display: none; }

.no-date-check-box {
    width: 18px; height: 18px;
    border: 1.5px solid var(--card-border);
    border-radius: 5px;
    background: rgba(255,255,255,0.04);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    position: relative;
}
.no-date-check-label input:checked + .no-date-check-box {
    background: var(--primary);
    border-color: var(--primary);
}
.no-date-check-label input:checked + .no-date-check-box::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}
.no-date-check-label:hover .no-date-check-box { border-color: var(--primary); }

#mt-dates-section, #ed-dates-section {
    transition: opacity 0.25s ease;
}

.no-date-badge {
    background: rgba(100,116,139,0.12);
    color: var(--text-muted);
    border: 1px dashed rgba(100,116,139,0.3);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-style: italic;
}

/* ─── COMMENT BOXES ──────────────────────────────────────────── */
.comment-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.comment-textarea {
    width: 100%;
    min-height: 72px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--card-border);
    border-radius: 9px;
    color: var(--text);
    font-family: 'Sora', sans-serif;
    font-size: 0.83rem;
    padding: 0.65rem 0.85rem;
    resize: vertical;
    line-height: 1.5;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    display: block;
}
.comment-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.comment-textarea::placeholder { color: var(--text-muted); }

.btn-comment-save {
    margin-top: 7px;
    background: rgba(99,102,241,0.15);
    color: var(--primary-light);
    border: 1px solid rgba(99,102,241,0.25);
    padding: 5px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Sora', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-comment-save:hover { background: rgba(99,102,241,0.25); }

/* Teacher comment box inside table row */
.comment-box-teacher {
    padding: 0.7rem 0.5rem;
    border-top: 1px solid var(--card-border);
}

.comment-teacher-row td { padding-top: 0; padding-bottom: 4px; border-bottom: 1px solid var(--card-border); }

/* Student private msg seen by teacher */
.student-msg-bubble {
    background: rgba(167,139,250,0.07);
    border: 1px solid rgba(167,139,250,0.2);
    border-radius: 9px;
    padding: 0.65rem 0.9rem;
    margin: 4px 0 6px;
}
.student-msg-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent2);
    display: block;
    margin-bottom: 4px;
}
.student-msg-text {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin: 0 0 4px;
    line-height: 1.5;
    white-space: pre-wrap;
}
.student-msg-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
}

.comment-student-row td { padding: 0 0.8rem 0.5rem; }

/* Student page: teacher comment display */
.teacher-comment-display {
    margin-top: 0.8rem;
    background: rgba(99,102,241,0.07);
    border: 1px solid rgba(99,102,241,0.2);
    border-left: 3px solid var(--primary);
    border-radius: 9px;
    padding: 0.75rem 0.9rem;
}
.teacher-comment-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-light);
    display: block;
    margin-bottom: 5px;
}
.teacher-comment-text {
    font-size: 0.88rem;
    color: var(--text);
    margin: 0 0 5px;
    line-height: 1.6;
    white-space: pre-wrap;
}
.teacher-comment-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
}

/* Student private comment box */
.comment-box-student {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--card-border);
}

/* ─── COUNTDOWN ──────────────────────────────────────────────── */
.countdown-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    transition: background 0.3s, color 0.3s;
    border: 1px solid transparent;
}
.cd-open     { background: rgba(52,211,153,0.07);  color: var(--success);  border-color: rgba(52,211,153,0.15); }
.cd-urgent   { background: rgba(251,191,36,0.1);   color: var(--warning);  border-color: rgba(251,191,36,0.2);  animation: urgentPulse 1s ease-in-out infinite; }
.cd-upcoming { background: rgba(99,102,241,0.08);  color: var(--primary-light); border-color: rgba(99,102,241,0.15); }
.cd-closed   { background: rgba(248,113,113,0.07); color: var(--danger);   border-color: rgba(248,113,113,0.15); }

@keyframes urgentPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.65; }
}

/* ─── LATE TAG ───────────────────────────────────────────────── */
.late-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(248,113,113,0.15);
    color: var(--danger);
    border: 1px solid rgba(248,113,113,0.3);
    margin-left: 5px;
    vertical-align: middle;
}

.late-warning {
    font-size: 0.8rem;
    color: var(--danger);
    background: rgba(248,113,113,0.08);
    border: 1px solid rgba(248,113,113,0.25);
    border-radius: 8px;
    padding: 7px 10px;
    margin-bottom: 8px;
}

.submission-box.late-open {
    border-color: rgba(248,113,113,0.3);
    background: rgba(248,113,113,0.04);
}

.btn-submit-late {
    background: linear-gradient(135deg, #ef4444, #f87171) !important;
    box-shadow: 0 4px 14px rgba(248,113,113,0.3) !important;
}
.btn-submit-late:hover { box-shadow: 0 6px 20px rgba(248,113,113,0.4) !important; }

/* ─── LOADING SCREEN ─────────────────────────────────────────── */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-logo {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 22px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    box-shadow: 0 0 40px rgba(99,102,241,0.4);
    animation: logoPulse 1.5s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(99,102,241,0.3); transform: scale(1); }
    50% { box-shadow: 0 0 60px rgba(99,102,241,0.6); transform: scale(1.05); }
}

.loader-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    margin-bottom: -1rem;
}

.loader-bar-wrap {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.07);
    border-radius: 2px;
    overflow: hidden;
}

.loader-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    animation: loadBar 1.6s cubic-bezier(0.4,0,0.2,1) forwards;
}

@keyframes loadBar {
    0%   { width: 0%; }
    40%  { width: 55%; }
    70%  { width: 80%; }
    90%  { width: 95%; }
    100% { width: 100%; }
}

.loader-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ─── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }