/* ============================================================
   dashboard.css — login + student/admin dashboards
   Self-contained; matches the landing page's Python theme.
   ============================================================ */

:root {
    --py-blue:      #306998;
    --py-blue-deep: #1f4d72;
    --py-yellow:    #ffd43b;
    --py-yellow-dk: #f7c948;
    --ink:          #11161d;
    --ink-soft:     #44505f;
    --muted:        #6b7686;
    --bg:           #0d1b2a;
    --bg-2:         #112a45;
    --surface:      #ffffff;
    --surface-soft: #f4f8fc;
    --line:         #e4ebf3;
    --ok:           #1e9e6a;
    --pending:      #e0a008;
    --shadow-sm:    0 4px 14px rgba(16, 42, 67, .08);
    --shadow-md:    0 12px 34px rgba(16, 42, 67, .14);
    --shadow-lg:    0 24px 60px rgba(16, 42, 67, .22);
    --radius:       18px;
    --ease:         cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: var(--ink); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
.accent { color: var(--py-yellow-dk); }
.brand-logo {
    font-family: 'Fira Code', monospace; background: var(--py-yellow);
    color: var(--py-blue-deep); padding: 2px 8px; border-radius: 7px; font-size: .85rem; font-weight: 700;
}

/* ============ LOGIN ============ */
.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: radial-gradient(130% 130% at 50% 0%, var(--bg-2), var(--bg));
}
.auth-card {
    width: 100%; max-width: 420px; background: var(--surface); border-radius: 24px;
    padding: 42px 38px; box-shadow: var(--shadow-lg); text-align: center;
    animation: pop .45s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.auth-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; color: var(--ink); margin-bottom: 22px; }
.auth-card h1 { font-size: 1.6rem; }
.auth-sub { color: var(--muted); margin: 6px 0 24px; font-size: .96rem; }
.auth-alert {
    background: #fdecec; color: #b03030; border: 1px solid #f5c2c2;
    padding: 12px 16px; border-radius: 12px; font-size: .9rem; margin-bottom: 20px; text-align: left;
}
.auth-form { text-align: left; }
.auth-field { margin-bottom: 18px; }
.auth-field label { display: block; font-size: .9rem; font-weight: 500; color: var(--ink-soft); margin-bottom: 7px; }
.auth-field input {
    width: 100%; padding: 13px 15px; font-family: inherit; font-size: .98rem; color: var(--ink);
    background: var(--surface-soft); border: 1.5px solid var(--line); border-radius: 12px;
    transition: border-color .25s, box-shadow .25s, background .25s;
}
.auth-field input:focus {
    outline: none; border-color: var(--py-blue); background: #fff;
    box-shadow: 0 0 0 4px rgba(48, 105, 152, .12);
}
.auth-btn {
    width: 100%; padding: 14px; border: none; border-radius: 999px; cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 1rem; color: #fff;
    background: linear-gradient(120deg, var(--py-blue), #4b8bbe);
    box-shadow: 0 10px 24px rgba(48, 105, 152, .4); margin-top: 4px;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.auth-btn:hover { transform: translateY(-3px); box-shadow: 0 16px 32px rgba(48, 105, 152, .5); }
.auth-forgot {
    background: none; border: none; cursor: pointer; color: var(--py-blue); font-family: inherit;
    font-size: .9rem; margin-top: 18px; text-decoration: underline;
}
.auth-forgot-msg {
    background: var(--surface-soft); border: 1px dashed var(--line); border-radius: 12px;
    padding: 12px 16px; font-size: .88rem; color: var(--ink-soft); margin-top: 12px;
}
.auth-foot { margin-top: 22px; font-size: .9rem; color: var(--muted); }
.auth-foot a { color: var(--py-blue); font-weight: 600; }

/* ============ DASHBOARD SHELL ============ */
.dash-body { background: var(--surface-soft); min-height: 100vh; }
.dash-nav {
    background: rgba(13, 27, 42, .97); color: #fff; padding: 14px 26px;
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10;
    box-shadow: var(--shadow-sm);
}
.dash-nav .auth-brand { color: #fff; margin: 0; font-size: 1.15rem; }
.dash-nav-right { display: flex; align-items: center; gap: 18px; }
.dash-hi { font-size: .92rem; color: rgba(255, 255, 255, .85); }
.dash-logout {
    background: var(--py-yellow); color: var(--py-blue-deep); font-weight: 600; font-size: .88rem;
    padding: 8px 18px; border-radius: 999px; transition: transform .2s var(--ease);
}
.dash-logout:hover { transform: translateY(-2px); }
.dash-wrap { max-width: 1080px; margin: 0 auto; padding: 32px 22px 60px; }

/* ---- Student banner ---- */
.dash-banner {
    background: radial-gradient(130% 200% at 0% 0%, #4b8bbe, var(--py-blue) 55%, var(--py-blue-deep));
    color: #fff; border-radius: var(--radius); padding: 32px 34px; margin-bottom: 26px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
    box-shadow: var(--shadow-md);
}
.dash-banner h1 { font-size: 1.7rem; font-weight: 800; }
.dash-banner p { color: rgba(255, 255, 255, .85); margin-top: 6px; }
.dash-countdown {
    text-align: center; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 14px; padding: 16px 26px; backdrop-filter: blur(6px);
}
.dc-label { display: block; font-size: .8rem; color: rgba(255, 255, 255, .75); }
.dc-date { display: block; font-size: 1.3rem; font-weight: 800; color: var(--py-yellow); }

.dash-grid { display: grid; grid-template-columns: 340px 1fr; gap: 24px; margin-bottom: 24px; }
.dash-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 28px; }

/* ---- Profile card ---- */
.profile-card { text-align: center; }
.profile-photo {
    position: relative; width: 120px; height: 120px; margin: 0 auto 16px; border-radius: 50%;
    background: linear-gradient(135deg, var(--py-blue), #4b8bbe); display: grid; place-items: center;
    overflow: hidden; border: 4px solid var(--surface); box-shadow: var(--shadow-md);
}
.profile-avatar { font-size: 2.6rem; font-weight: 800; color: #fff; }
.profile-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.profile-card h2 { font-size: 1.3rem; }
.profile-role { color: var(--py-blue); font-weight: 500; font-size: .92rem; margin-top: 2px; }
.status-row { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.status-badge { padding: 9px 14px; border-radius: 10px; font-size: .86rem; font-weight: 600; }
.status-badge.ok { background: rgba(30, 158, 106, .12); color: var(--ok); }
.status-badge.pending { background: rgba(224, 160, 8, .14); color: var(--pending); }

/* ---- clickable profile photo ---- */
.profile-card .profile-photo { padding: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
.photo-hover {
    position: absolute; inset: 0; z-index: 3; display: grid; place-items: center;
    background: rgba(13, 27, 42, .55); color: #fff; font-size: .82rem; font-weight: 600;
    opacity: 0; transition: opacity .2s;
}
.profile-photo:hover .photo-hover, .profile-photo:focus-visible .photo-hover { opacity: 1; }

/* ---- photo modal ---- */
.photo-overlay {
    position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
    padding: 18px; background: rgba(8, 16, 26, .72); backdrop-filter: blur(5px);
    opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
.photo-overlay.show { opacity: 1; visibility: visible; }
.photo-modal {
    position: relative; background: var(--surface); border-radius: 20px; padding: 28px 24px; width: 100%;
    max-width: 340px; text-align: center; box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(.97); transition: transform .3s var(--ease);
}
.photo-overlay.show .photo-modal { transform: none; }
.photo-modal h3 { font-size: 1.2rem; margin-bottom: 18px; color: var(--ink); }
.photo-close {
    position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border: none; cursor: pointer;
    background: var(--surface-soft); border-radius: 50%; font-size: 1.3rem; line-height: 1; color: var(--ink-soft);
    transition: background .2s, transform .2s;
}
.photo-close:hover { background: var(--line); transform: rotate(90deg); }
.photo-current {
    position: relative; width: 150px; height: 150px; margin: 0 auto 20px; border-radius: 50%; overflow: hidden;
    background: linear-gradient(135deg, var(--py-blue), #4b8bbe); display: grid; place-items: center;
    border: 4px solid var(--surface); box-shadow: var(--shadow-md);
}
.photo-current-avatar { font-size: 3rem; font-weight: 800; color: #fff; }
.photo-current img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.photo-choose, .photo-upload {
    display: inline-block; width: 100%; margin-top: 10px; padding: 12px; border-radius: 12px;
    font-family: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; border: none; text-align: center;
    transition: transform .2s var(--ease), filter .2s, background .2s, border-color .2s, color .2s;
}
.photo-choose { background: var(--surface-soft); border: 1.5px solid var(--line); color: var(--py-blue); }
.photo-choose:hover { border-color: var(--py-blue); background: #fff; }
.photo-upload { background: linear-gradient(120deg, var(--py-blue), #4b8bbe); color: #fff; box-shadow: 0 8px 20px rgba(48, 105, 152, .35); }
.photo-upload:hover { transform: translateY(-2px); }
.photo-upload:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.photo-hint { font-size: .76rem; color: var(--muted); margin-top: 12px; }
.photo-msg { font-size: .85rem; font-weight: 500; margin-top: 8px; min-height: 1em; }
.photo-msg.err { color: #b03030; }

/* ---- Details card ---- */
.details-card h3, .course-card h3, .table-card h3 { font-size: 1.15rem; margin-bottom: 18px; }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.detail-list dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
.detail-list dd { font-size: .98rem; font-weight: 500; color: var(--ink); word-break: break-word; }
.detail-reason { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.detail-reason dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.detail-reason p { font-style: italic; color: var(--ink-soft); }

/* ---- Course card ---- */
.course-card { text-align: center; }
.course-icon { font-size: 2.6rem; }
.course-card h3 { margin-top: 8px; color: var(--py-blue-deep); }
.course-card p { color: var(--muted); max-width: 620px; margin: 10px auto 0; }
.course-note {
    background: rgba(224, 160, 8, .1); color: #9a7000; border: 1px solid rgba(224, 160, 8, .25);
    padding: 12px 18px; border-radius: 12px; margin-top: 18px !important; font-size: .92rem;
}

/* ============ ADMIN ============ */
.admin-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 24px; text-align: center;
}
.stat-num { display: block; font-size: 2.1rem; font-weight: 800; color: var(--py-blue); }
.stat-label { font-size: .88rem; color: var(--muted); }
.table-card { margin-bottom: 24px; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th {
    text-align: left; padding: 12px 14px; background: var(--surface-soft); color: var(--ink-soft);
    font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tbody tr:hover { background: var(--surface-soft); }
.row-reason { cursor: help; margin-left: 6px; }
.toggle-form { margin: 0; }
.pill-toggle {
    border: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: .82rem;
    padding: 7px 14px; border-radius: 999px; transition: transform .2s var(--ease), filter .2s;
}
.pill-toggle:hover { transform: translateY(-2px); filter: brightness(1.05); }
.pill-toggle.on  { background: rgba(30, 158, 106, .15); color: var(--ok); }
.pill-toggle.off { background: rgba(176, 48, 48, .1); color: #b03030; }
.pill-toggle.verify { background: var(--py-blue); color: #fff; }
.pill-toggle.verify:hover { filter: brightness(1.07); }
.pill-static {
    display: inline-block; font-weight: 600; font-size: .82rem; padding: 7px 14px; border-radius: 999px;
    background: rgba(30, 158, 106, .15); color: var(--ok); white-space: nowrap;
}
.empty-state { color: var(--muted); padding: 14px 0; }
.edit-link {
    display: inline-block; font-weight: 600; font-size: .85rem; color: var(--py-blue);
    padding: 7px 14px; border: 1.5px solid var(--line); border-radius: 999px; white-space: nowrap;
    transition: background .2s, border-color .2s, color .2s, transform .2s;
}
.edit-link:hover { background: var(--py-blue); border-color: var(--py-blue); color: #fff; transform: translateY(-2px); }

/* ============ EDIT STUDENT PAGE ============ */
.edit-wrap { max-width: 760px; }
.save-ok, .save-err {
    border-radius: 12px; padding: 14px 18px; font-size: .94rem; font-weight: 500; margin-bottom: 18px;
}
.save-ok  { background: rgba(30, 158, 106, .12); color: var(--ok); border: 1px solid rgba(30, 158, 106, .3); }
.save-ok a { color: var(--py-blue); font-weight: 600; }
.save-err { background: #fdecec; color: #b03030; border: 1px solid #f5c2c2; }

.edit-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-md); overflow: hidden;
}
.edit-head {
    display: flex; align-items: center; gap: 16px; padding: 24px 28px;
    background: radial-gradient(130% 200% at 0% 0%, #4b8bbe, var(--py-blue) 60%, var(--py-blue-deep));
    color: #fff;
}
.edit-avatar {
    width: 60px; height: 60px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
    background: rgba(255, 255, 255, .18); border: 2px solid rgba(255, 255, 255, .5);
    font-size: 1.5rem; font-weight: 800;
}
.edit-head-info { flex: 1; min-width: 0; }
.edit-head-info h1 { font-size: 1.35rem; font-weight: 800; line-height: 1.2; word-break: break-word; }
.edit-head-info p { color: rgba(255, 255, 255, .8); font-size: .9rem; word-break: break-word; }
.acc-chip { flex-shrink: 0; font-size: .8rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.acc-chip.on  { background: rgba(255, 255, 255, .2); color: #c9ffe6; }
.acc-chip.off { background: rgba(0, 0, 0, .22); color: #ffd9d9; }

.edit-section { padding: 24px 28px; }
.edit-section + .edit-section { border-top: 1px solid var(--line); }
.edit-section-title {
    font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--py-blue);
    font-weight: 700; margin-bottom: 18px;
}
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.ef { display: flex; flex-direction: column; }
.ef-full { grid-column: 1 / -1; }
.ef label { font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 7px; }
.ef-tag {
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    background: rgba(48, 105, 152, .12); color: var(--py-blue); padding: 2px 7px; border-radius: 6px; margin-left: 4px;
}
.ef-tag.muted { background: var(--surface-soft); color: var(--muted); }
.ef input, .ef select, .ef textarea {
    width: 100%; padding: 12px 14px; font-family: inherit; font-size: .96rem; color: var(--ink);
    background: var(--surface-soft); border: 1.5px solid var(--line); border-radius: 12px;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.ef textarea { resize: vertical; min-height: 84px; }
.ef input:focus, .ef select:focus, .ef textarea:focus {
    outline: none; border-color: var(--py-blue); background: #fff; box-shadow: 0 0 0 4px rgba(48, 105, 152, .12);
}
.ef-hint { color: var(--muted); font-size: .78rem; margin-top: 6px; }

/* toggle switch for payment */
.switch-row { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch {
    width: 46px; height: 26px; border-radius: 999px; background: #cfd8e3; position: relative; transition: background .25s;
    flex-shrink: 0;
}
.switch::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .25s;
}
.switch-row input:checked + .switch { background: var(--ok); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { box-shadow: 0 0 0 4px rgba(48, 105, 152, .2); }
.switch-label { font-size: .94rem; font-weight: 600; color: var(--ink); }

.edit-actions {
    display: flex; justify-content: flex-end; align-items: center; gap: 14px;
    padding: 20px 28px; background: var(--surface-soft); border-top: 1px solid var(--line);
}
.edit-cancel { color: var(--ink-soft); font-weight: 600; font-size: .94rem; padding: 12px 18px; }
.edit-cancel:hover { color: var(--ink); }
.edit-save {
    border: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: .96rem; color: #fff;
    background: linear-gradient(120deg, var(--py-blue), #4b8bbe); padding: 13px 26px; border-radius: 999px;
    box-shadow: 0 10px 24px rgba(48, 105, 152, .35); transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.edit-save:hover { transform: translateY(-3px); box-shadow: 0 16px 30px rgba(48, 105, 152, .45); }

/* ============ RESPONSIVE ============ */
@media (max-width: 880px) {
    .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .dash-wrap { padding: 22px 16px 48px; }
    .dash-card { padding: 22px; }

    /* nav: keep on one row but compact, allow the greeting to hide if tight */
    .dash-nav { padding: 12px 16px; gap: 10px; }
    .dash-nav .auth-brand { font-size: 1rem; gap: 6px; }
    .dash-hi { display: none; }
    .dash-logout { padding: 8px 14px; font-size: .84rem; }

    .dash-banner { flex-direction: column; text-align: center; align-items: stretch; padding: 26px 22px; }
    .dash-banner h1 { font-size: 1.4rem; }
    .dash-countdown { width: 100%; }

    .detail-list { grid-template-columns: 1fr; gap: 14px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 18px; }
    .stat-num { font-size: 1.7rem; }
    .admin-title { font-size: 1.35rem; }

    /* edit form: single column + sticky action bar */
    .edit-grid { grid-template-columns: 1fr; gap: 16px; }
    .edit-head { padding: 20px; }
    .edit-section { padding: 20px; }
    .edit-actions {
        position: sticky; bottom: 0; padding: 16px 20px;
        justify-content: space-between; box-shadow: 0 -6px 16px rgba(16, 42, 67, .08);
    }
    .edit-save { flex: 1; }

    /* tables -> stacked cards (works for BOTH header rows and data rows) */
    .table-scroll { overflow: visible; }
    .admin-table thead { display: none; }
    .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
    .admin-table tr { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; padding: 6px 4px; background: var(--surface); }
    .admin-table td {
        border: none; display: flex; justify-content: space-between; align-items: center; gap: 14px;
        padding: 10px 14px; text-align: right;
    }
    .admin-table td::before {
        content: attr(data-label); font-weight: 600; color: var(--muted); font-size: .8rem;
        text-align: left; flex-shrink: 0;
    }
    .admin-table td strong { text-align: right; }
}

@media (max-width: 380px) {
    .stat-grid { grid-template-columns: 1fr; }
    .dash-nav .auth-brand .accent { display: inline; }
}
