/* ============================================================
   ACADEMIC MANAGEMENT DASHBOARD
   CSS3
   ============================================================ */


/* ============================================================
   ROOT
   ============================================================ */


:root {
    --bg-main: #0b0a08;
    --bg-secondary: #12100d;
    --bg-card: rgba(25, 22, 17, 0.95);
    --bg-card-hover: rgba(34, 30, 23, 0.98);

    --surface: #181510;
    --surface-light: #211d16;
    --surface-hover: #2a251c;

    --border: rgba(255, 205, 100, 0.08);
    --border-strong: rgba(255, 205, 100, 0.17);

    --text-primary: #fffaf0;
    --text-secondary: #b6aa96;
    --text-muted: #776e60;

    --blue: #f59e0b;
    --blue-light: #fbbf24;

    --purple: #d97706;
    --purple-light: #f59e0b;

    --green: #84cc16;
    --yellow: #facc15;
    --red: #f87171;

    --gradient: linear-gradient(135deg, #f59e0b, #d97706);

    --gradient-soft: linear-gradient(135deg,
            rgba(245, 158, 11, 0.14),
            rgba(217, 119, 6, 0.08));

    --shadow: 0 18px 55px rgba(0, 0, 0, 0.48);

    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --transition: 160ms ease;
}


   
/* ============================================================
   RESET
   ============================================================ */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg-main);
}

body {
    margin: 0;
    min-height: 100vh;

    background:
        radial-gradient(circle at 10% 0%,
            rgba(80, 110, 255, 0.10),
            transparent 32%),
        radial-gradient(circle at 90% 20%,
            rgba(145, 80, 255, 0.08),
            transparent 30%),
        var(--bg-main);

    color: var(--text-primary);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
}

button,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}

input,
select {
    outline: none;
}

.hidden {
    display: none !important;
}


/* ============================================================
   APP SHELL
   ============================================================ */

.app-shell {
    position: relative;

    width: min(1500px, 100%);
    min-height: 100vh;

    margin: 0 auto;

    padding:
        28px 28px 110px;

    overflow: hidden;
}

.ambient {
    position: fixed;

    width: 340px;
    height: 340px;

    border-radius: 50%;

    filter: blur(90px);

    opacity: 0.10;

    pointer-events: none;

    z-index: -1;
}

.ambient-one {
    top: -150px;
    left: -100px;

    background: #4d76ff;
}

.ambient-two {
    right: -100px;
    bottom: -150px;

    background: #9b62ff;
}


/* ============================================================
   HEADER
   ============================================================ */

.topbar {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 28px;
}

.brand-area {
    display: flex;

    align-items: center;

    gap: 14px;
}

.brand-mark {
    display: grid;

    place-items: center;

    width: 44px;
    height: 44px;

    border-radius: 15px;

    background: var(--gradient);

    box-shadow:
        0 8px 30px rgba(92, 105, 255, 0.24);
}

/* .brand-mark-inner {
    font-size: 19px;
    font-weight: 800;

    color: white;
} */

.brand-area h1 {
    margin: 0;

    font-size: clamp(20px, 3vw, 27px);

    letter-spacing: -0.04em;
}

.brand-area p {
    margin: 4px 0 0;

    color: var(--text-secondary);

    font-size: 13px;
}

.connection-status {
    display: flex;

    align-items: center;

    gap: 8px;

    padding: 8px 11px;

    border: 1px solid var(--border);

    border-radius: 999px;

    background: rgba(255, 255, 255, 0.025);

    color: var(--text-secondary);

    font-size: 12px;
}

.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--yellow);

    box-shadow: 0 0 10px currentColor;
}

.connection-status.online .status-dot {
    background: var(--green);
}

.connection-status.offline .status-dot {
    background: var(--red);
}


/* ============================================================
   SUMMARY BAR
   ============================================================ */

.summary-bar {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 12px;

    margin-bottom: 24px;
}

.summary-item {
    min-width: 0;

    padding: 14px 16px;

    border:
        1px solid var(--border);

    border-radius: var(--radius-md);

    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.035),
            rgba(255, 255, 255, 0.015));
}

.summary-label {
    display: block;

    margin-bottom: 5px;

    color: var(--text-muted);

    font-size: 11px;

    text-transform: uppercase;

    letter-spacing: 0.08em;
}

.summary-item strong {
    display: block;

    font-size: 22px;

    letter-spacing: -0.04em;
}


/* ============================================================
   SUBJECT GRID
   ============================================================ */

.subjects-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 18px;

    align-items: start;
}


/* ============================================================
   SUBJECT CARD
   ============================================================ */

.subject-card {
    position: relative;

    min-width: 0;

    overflow: hidden;

    border:
        1px solid var(--border);

    border-radius: var(--radius-lg);

    background:
        linear-gradient(180deg,
            rgba(14, 18, 29, 0.94),
            rgba(12, 16, 28, 0.94));

    box-shadow: var(--shadow);

    transition:
        transform var(--transition),
        border-color var(--transition),
        background var(--transition);
}

.subject-card:hover {
    border-color: var(--border-strong);

    background:
        linear-gradient(180deg,
            rgba(22, 29, 47, 0.97),
            rgba(13, 17, 29, 0.97));
}

.subject-card.editing {
    border-color: rgba(102, 128, 255, 0.36);

    box-shadow:
        0 18px 65px rgba(48, 58, 130, 0.17);
}


/* ============================================================
   CARD TOP ACCENT
   ============================================================ */

.subject-card::before {
    content: "";

    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 2px;

    background: var(--gradient);

    opacity: 0.65;
}


/* ============================================================
   CARD HEADER
   ============================================================ */

.card-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 14px;

    padding: 20px 20px 16px;
}

.card-title-area {
    min-width: 0;
}

.card-title {
    margin: 0;

    overflow: hidden;

    color: var(--text-primary);

    font-size: 17px;
    font-weight: 720;

    line-height: 1.25;

    letter-spacing: -0.025em;

    text-overflow: ellipsis;

    white-space: nowrap;
}

.card-code {
    margin: 5px 0 0;

    color: var(--text-secondary);

    font-size: 12px;

    font-weight: 600;

    letter-spacing: 0.06em;
}

.card-meta {
    display: flex;

    align-items: center;

    flex-wrap: wrap;

    gap: 7px;

    margin-top: 12px;
}

.credit-pill {
    display: inline-flex;

    align-items: center;

    padding: 5px 8px;

    border:
        1px solid var(--border);

    border-radius: 7px;

    color: var(--text-secondary);

    font-size: 11px;
    font-weight: 650;
}

.complexity-badge {
    display: inline-flex;

    align-items: center;

    padding: 5px 8px;

    border-radius: 7px;

    font-size: 10px;
    font-weight: 750;

    text-transform: uppercase;

    letter-spacing: 0.06em;
}

.complexity-easy {
    color: #69e0aa;

    background: rgba(79, 211, 154, 0.10);

    border:
        1px solid rgba(79, 211, 154, 0.16);
}

.complexity-medium {
    color: #f2cc78;

    background: rgba(244, 199, 109, 0.10);

    border:
        1px solid rgba(244, 199, 109, 0.16);
}

.complexity-hard {
    color: #ff7c92;

    background: rgba(255, 111, 134, 0.10);

    border:
        1px solid rgba(255, 111, 134, 0.16);
}


/* ============================================================
   CARD BODY
   ============================================================ */

.card-body {
    padding: 0 20px;
}

.lane {
    margin-bottom: 15px;
}

.lane-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 8px;
}

.lane-title {
    display: flex;

    align-items: center;

    gap: 7px;

    color: var(--text-secondary);

    font-size: 11px;
    font-weight: 750;

    text-transform: uppercase;

    letter-spacing: 0.075em;
}

.lane-title::before {
    content: "";

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: var(--blue);

    box-shadow: 0 0 10px rgba(91, 140, 255, 0.7);
}

.lane-count {
    color: var(--text-muted);

    font-size: 11px;
    font-weight: 650;
}


/* ============================================================
   DROP ZONE
   ============================================================ */

.lesson-lane {
    display: flex;

    align-items: flex-start;

    flex-wrap: wrap;

    gap: 7px;

    min-height: 42px;

    padding: 8px;

    border:
        1px dashed rgba(255, 255, 255, 0.075);

    border-radius: 11px;

    background: rgba(0, 0, 0, 0.10);

    transition:
        background var(--transition),
        border-color var(--transition);
}

.lesson-lane.sortable-ghost-container {
    border-color: rgba(91, 140, 255, 0.35);
}

.lesson-lane:empty::after {
    content: "Drop lessons here";

    color: var(--text-muted);

    font-size: 11px;

    padding: 6px;
}


/* ============================================================
   LESSON CHIP
   ============================================================ */

.lesson-chip {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    min-width: 39px;

    min-height: 34px;

    padding: 7px 10px;

    border:
        1px solid rgba(255, 255, 255, 0.085);

    border-radius: 9px;

    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.055),
            rgba(255, 255, 255, 0.025));

    color: var(--text-primary);

    font-size: 12px;
    font-weight: 700;

    cursor: grab;

    user-select: none;

    touch-action: none;

    transition:
        border-color var(--transition),
        transform var(--transition),
        background var(--transition);
}

.lesson-chip:hover {
    border-color: rgba(111, 143, 255, 0.35);

    background:
        rgba(91, 140, 255, 0.08);
}

.lesson-chip:active {
    cursor: grabbing;
}

.lesson-chip.pool-chip {
    border-color:
        rgba(151, 117, 255, 0.18);

    background:
        rgba(151, 117, 255, 0.07);
}

.lesson-chip.studied-chip {
    border-color:
        rgba(79, 211, 154, 0.17);

    background:
        rgba(79, 211, 154, 0.07);
}

.lesson-chip .delete-target {
    display: grid;

    place-items: center;

    width: 18px;
    height: 18px;

    margin-left: 5px;

    border-radius: 50%;

    color: var(--text-muted);

    background: rgba(255, 255, 255, 0.04);

    cursor: pointer;

    font-size: 13px;

    touch-action: manipulation;
}

.lesson-chip .delete-target:hover {
    color: white;

    background: rgba(255, 111, 134, 0.18);
}


/* ============================================================
   SORTABLE STATES
   ============================================================ */

.sortable-ghost {
    opacity: 0.30;
}

.sortable-chosen {
    transform: scale(1.03);
}

.sortable-drag {
    opacity: 0.95;

    transform: rotate(2deg) scale(1.04);

    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.4);
}


/* ============================================================
   REMAINING LANE
   ============================================================ */

.remaining-lane {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    min-height: 53px;

    padding: 10px 12px;

    border:
        1px solid rgba(91, 140, 255, 0.10);

    border-radius: 11px;

    background:
        linear-gradient(135deg,
            rgba(91, 140, 255, 0.065),
            rgba(151, 105, 255, 0.045));
}

.remaining-value {
    display: flex;

    align-items: baseline;

    gap: 7px;
}

.remaining-number {
    font-size: 21px;
    font-weight: 800;

    letter-spacing: -0.04em;
}

.remaining-label {
    color: var(--text-muted);

    font-size: 11px;
}


/* ============================================================
   SUBJECT CARD FOOTER
   ============================================================ */

.card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: auto;
    padding: 18px;
    min-height: 48px;
}

/*
 * Ascending Order stays on the left.
 */
.card-footer .sort-toggle-area {
    margin-right: auto;
}

/*
 * Edit button ALWAYS stays at the bottom-right.
 */
.card-footer .icon-button {
    margin-left: auto;
    flex-shrink: 0;
}

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

.icon-button {
    display: grid;

    place-items: center;

    width: 34px;
    height: 34px;

    flex: 0 0 auto;

    border:
        1px solid var(--border);

    border-radius: 9px;

    background:
        rgba(255, 255, 255, 0.025);

    color: var(--text-secondary);

    cursor: pointer;

    transition:
        color var(--transition),
        background var(--transition),
        border-color var(--transition);
}

.icon-button:hover {
    color: white;

    border-color:
        rgba(104, 132, 255, 0.32);

    background:
        rgba(91, 140, 255, 0.08);
}

.edit-icon {
    width: 15px;
    height: 15px;
}


/* ============================================================
   EDIT MODE
   ============================================================ */

.edit-mode-panel {
    margin: 0 20px 16px;

    padding: 12px;

    border:
        1px solid rgba(151, 117, 255, 0.14);

    border-radius: 12px;

    background:
        rgba(151, 117, 255, 0.045);
}

.edit-mode-heading {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 9px;
}

.edit-mode-heading strong {
    font-size: 11px;

    text-transform: uppercase;

    letter-spacing: 0.07em;
}

.edit-mode-heading span {
    color: var(--text-muted);

    font-size: 10px;
}

.lesson-pool {
    display: flex;

    flex-wrap: wrap;

    gap: 7px;

    min-height: 40px;
}


/* ============================================================
   EMPTY POOL
   ============================================================ */

.pool-empty {
    width: 100%;

    padding: 9px;

    color: var(--text-muted);

    font-size: 11px;

    text-align: center;
}


/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    display: grid;

    place-items: center;

    min-height: 360px;

    padding: 30px;

    border:
        1px dashed var(--border);

    border-radius: var(--radius-lg);

    text-align: center;
}

.empty-icon {
    display: grid;

    place-items: center;

    width: 50px;
    height: 50px;

    margin-bottom: 14px;

    border-radius: 15px;

    background: var(--gradient);

    font-size: 25px;
}

.empty-state h2 {
    margin: 0 0 7px;

    font-size: 20px;
}

.empty-state p {
    max-width: 360px;

    margin: 0 0 18px;

    color: var(--text-secondary);

    font-size: 13px;

    line-height: 1.6;
}


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

.primary-button,
.secondary-button {
    min-height: 40px;

    padding: 0 15px;

    border-radius: 9px;

    font-size: 12px;
    font-weight: 750;

    cursor: pointer;

    transition:
        transform var(--transition),
        opacity var(--transition),
        background var(--transition);
}

.primary-button {
    color: white;

    background: var(--gradient);

    box-shadow:
        0 8px 22px rgba(86, 96, 255, 0.20);
}

.primary-button:hover {
    transform: translateY(-1px);
}

.primary-button:disabled {
    opacity: 0.55;

    cursor: wait;

    transform: none;
}

.secondary-button {
    color: var(--text-secondary);

    border:
        1px solid var(--border);

    background:
        rgba(255, 255, 255, 0.025);
}

.secondary-button:hover {
    color: white;

    background:
        rgba(255, 255, 255, 0.055);
}


/* ============================================================
   FAB
   ============================================================ */

.fab {
    position: fixed;

    left: auto;
    right: 24px;
    bottom: 24px;

    z-index: 50;

    display: grid;

    place-items: center;

    width: 56px;
    height: 56px;

    border-radius: 17px;

    color: white;

    background: var(--gradient);

    box-shadow:
        0 16px 35px rgba(59, 70, 190, 0.35);

    cursor: pointer;

    transition:
        transform var(--transition),
        box-shadow var(--transition);
}

.fab:hover {
    transform: translateY(-2px) scale(1.02);

    box-shadow:
        0 20px 42px rgba(59, 70, 190, 0.42);
}

.fab span {
    font-size: 27px;
    font-weight: 350;

    line-height: 1;
}

@media (max-width: 600px) {

    .fab {
        right: 18px;
        bottom: 18px;
    }

}

/* ============================================================
   DIALOG
   ============================================================ */

.subject-dialog {
    width: min(540px, calc(100vw - 30px));

    padding: 0;

    border:
        1px solid var(--border-strong);

    border-radius: 20px;

    color: var(--text-primary);

    background:
        linear-gradient(180deg,
            #151b2b,
            #0e1320);

    box-shadow:
        0 30px 100px rgba(0, 0, 0, 0.55);
}

.subject-dialog::backdrop {
    background:
        rgba(2, 4, 10, 0.75);

    backdrop-filter: blur(5px);
}

.subject-form {
    padding: 22px;
}

.dialog-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 22px;
}

.eyebrow {
    display: block;

    margin-bottom: 5px;

    color: var(--purple-light);

    font-size: 10px;
    font-weight: 800;

    text-transform: uppercase;

    letter-spacing: 0.12em;
}

.dialog-header h2 {
    margin: 0;

    font-size: 22px;

    letter-spacing: -0.035em;
}

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 15px;
}

.form-field {
    display: flex;

    flex-direction: column;

    gap: 7px;
}

.form-field.full-width {
    grid-column: 1 / -1;
}

.form-field>span {
    color: var(--text-secondary);

    font-size: 11px;
    font-weight: 700;
}

.form-field input,
.form-field select {
    width: 100%;

    min-height: 43px;

    padding: 0 12px;

    border:
        1px solid var(--border);

    border-radius: 10px;

    outline: none;

    color: var(--text-primary);

    background:
        rgba(0, 0, 0, 0.18);

    transition:
        border-color var(--transition),
        box-shadow var(--transition);
}

.form-field input::placeholder {
    color: #5d667b;
}

.form-field input:focus,
.form-field select:focus {
    border-color:
        rgba(102, 131, 255, 0.55);

    box-shadow:
        0 0 0 3px rgba(91, 140, 255, 0.08);
}

.form-field select option {
    background: #101523;
}

.dialog-actions {
    display: flex;

    align-items: center;
    justify-content: flex-end;

    gap: 9px;

    margin-top: 23px;
}


/* ============================================================
   TOAST
   ============================================================ */

.toast {
    position: fixed;

    left: 50%;
    bottom: 28px;

    z-index: 100;

    transform:
        translate(-50%, 30px);

    min-width: 200px;

    max-width: calc(100vw - 30px);

    padding: 11px 15px;

    border:
        1px solid var(--border-strong);

    border-radius: 11px;

    color: white;

    background:
        rgba(22, 27, 42, 0.96);

    box-shadow:
        0 16px 45px rgba(0, 0, 0, 0.38);

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 180ms ease,
        transform 180ms ease;

    font-size: 12px;

    text-align: center;
}

.toast.show {
    opacity: 1;

    transform:
        translate(-50%, 0);
}


/* ============================================================
   LOADING OVERLAY
   ============================================================ */

.loading-overlay {
    position: fixed;

    inset: 0;

    z-index: 200;

    display: grid;

    place-items: center;

    background:
        rgba(5, 7, 13, 0.55);

    backdrop-filter: blur(3px);
}

.loading-card {
    display: flex;

    align-items: center;

    gap: 11px;

    padding: 13px 16px;

    border:
        1px solid var(--border);

    border-radius: 12px;

    background:
        #121827;

    box-shadow: var(--shadow);

    color: var(--text-secondary);

    font-size: 12px;
}

.spinner {
    width: 17px;
    height: 17px;

    border:
        2px solid rgba(255, 255, 255, 0.10);

    border-top-color:
        var(--blue);

    border-radius: 50%;

    animation:
        spin 700ms linear infinite;
}

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


/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 1100px) {

    .subjects-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 700px) {

    .app-shell {
        padding:
            18px 14px 100px;
    }

    .topbar {
        align-items: flex-start;
    }

    .brand-area p {
        display: none;
    }

    .connection-status {
        margin-top: 3px;
    }

    .summary-bar {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .subjects-grid {
        grid-template-columns: 1fr;

        gap: 14px;
    }

    .card-header {
        padding: 18px 16px 14px;
    }

    .card-body {
        padding: 0 16px;
    }

    .card-footer {
        padding:
            13px 16px 16px;
    }

    .edit-mode-panel {
        margin:
            0 16px 14px;
    }

    .fab {
        left: 16px;
        bottom: 16px;

        width: 52px;
        height: 52px;
    }

}


/* ============================================================
   SMALL MOBILE
   ============================================================ */

@media (max-width: 430px) {

    .card-title {
        max-width: 200px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field.full-width {
        grid-column: auto;
    }

    .dialog-actions {
        flex-direction: column-reverse;
    }

    .dialog-actions button {
        width: 100%;
    }

}

/* ============================================================
   STUDY PROGRESS BAR
   ============================================================ */

.study-progress {
    margin-top: 14px;
    width: 100%;
    padding-left: 20px;
    padding-right: 20px;
}


/* Header */

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}

.progress-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-percent {
    font-size: 0.75rem;
    color: var(--text-primary);
}


/* Track */

.progress-track {
    width: 100%;
    height: 7px;

    overflow: hidden;

    border-radius: 999px;

    background: rgba(255, 255, 255, 0.08);
}


/* Fill */

.progress-fill {
    height: 100%;

    min-width: 0;

    border-radius: inherit;

    background:
        linear-gradient(90deg,
            #3b82f6,
            #8b5cf6);

    transition:
        width 0.35s ease;
}


/* Bottom information */

.progress-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-top: 6px;

    font-size: 0.68rem;

    color: var(--text-muted);
}


/* ============================================================
   MOBILE COLLAPSIBLE SUBJECT CARDS
   ============================================================ */

/*
 * Desktop:
 * Normal card behavior remains unchanged.
 */
.mobile-card-toggle {
    display: none;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 600px) {

    .subject-card {
        position: relative;
        overflow: hidden;

        transition:
            max-height 0.3s ease,
            padding 0.3s ease,
            transform 0.2s ease;
    }


    /* --------------------------------------------------------
       MOBILE CARD HEADER
    -------------------------------------------------------- */

    .card-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;

        gap: 10px;
    }


    .card-title-area {
        min-width: 0;
        flex: 1;
    }


    /*
     * Dropdown button
     */

    .mobile-card-toggle {
        display: flex;

        align-items: center;
        justify-content: center;

        flex: 0 0 36px;

        width: 36px;
        height: 36px;

        padding: 0;

        border: 1px solid rgba(255, 255, 255, 0.10);
        border-radius: 10px;

        background: rgba(255, 255, 255, 0.04);

        color: var(--text-primary);

        cursor: pointer;

        -webkit-tap-highlight-color: transparent;
    }


    .mobile-card-toggle:active {
        transform: scale(0.94);
    }


    .mobile-card-chevron {
        display: block;

        font-size: 20px;
        line-height: 1;

        transition:
            transform 0.25s ease;
    }


    /* ========================================================
       COMPACT STATE
       ======================================================== */

    /*
     * Hide the functional card body and footer.
     *
     * The card header remains visible.
     */
    .subject-card:not(.mobile-expanded) .card-body,
    .subject-card:not(.mobile-expanded) .card-footer,
    .subject-card:not(.mobile-expanded) .edit-pool {
        display: none;
    }


    /*
     * Progress bar remains visible in compact mode.
     */

    .subject-card:not(.mobile-expanded) .study-progress {
        display: block;
    }


    /*
     * Give compact cards a clean small-card appearance.
     */

    .subject-card:not(.mobile-expanded) {
        padding-bottom: 14px;
    }


    /*
     * Don't show the detailed progress summary in compact mode.
     * Keep only the visual bar + percentage.
     */

    .subject-card:not(.mobile-expanded) .progress-summary {
        display: none;
    }


    .subject-card:not(.mobile-expanded) .progress-header {
        margin-bottom: 6px;
    }


    /* ========================================================
       EXPANDED STATE
       ======================================================== */

    .subject-card.mobile-expanded {

        /*
         * Normal card content becomes available.
         */
        padding-bottom: 16px;
    }


    .subject-card.mobile-expanded .card-body,
    .subject-card.mobile-expanded .card-footer,
    .subject-card.mobile-expanded .edit-pool {
        display: block;
    }


    /*
     * The progress bar remains visible in expanded state.
     */

    .subject-card.mobile-expanded .study-progress {
        display: block;
    }


    /*
     * Normal progress information is restored.
     */

    .subject-card.mobile-expanded .progress-summary {
        display: flex;
    }


    /*
     * Expanded card can use full available width.
     */

    .subject-card.mobile-expanded {
        width: 100%;
    }


    /* ========================================================
       EDIT MODE
       ======================================================== */

    /*
     * If the user enters Edit Mode, automatically keep
     * the card expanded.
     */

    .subject-card.editing {
        display: block;
    }


    .subject-card.editing .card-body,
    .subject-card.editing .card-footer,
    .subject-card.editing .edit-pool {
        display: block;
    }


    /*
     * Edit mode should never hide the lesson controls.
     */

    .subject-card.editing .mobile-card-toggle {
        display: flex;
    }


    /* ========================================================
       SMALL SCREEN SPACING
       ======================================================== */

    .subject-card {
        margin-bottom: 12px;
    }


    .card-title {
        font-size: 1rem;
    }


    .card-code {
        font-size: 0.78rem;
    }


    .card-meta {
        gap: 6px;
    }


    .credit-pill,
    .complexity-badge {
        font-size: 0.68rem;
    }
    

}


/* ============================================================
   EXAM COUNTDOWN
   ============================================================ */

.topbar-status-area {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}


/* ============================================================
   COUNTDOWN BUTTON
   ============================================================ */

.exam-countdown {
    display: inline-flex;

    align-items: center;

    gap: 9px;

    min-width: 170px;

    padding: 7px 11px;

    border: 1px solid rgba(139, 92, 246, 0.22);

    border-radius: 12px;

    background:
        linear-gradient(135deg,
            rgba(59, 130, 246, 0.10),
            rgba(139, 92, 246, 0.10));

    color: var(--text-primary);

    cursor: pointer;

    text-align: left;

    transition:
        border-color 0.2s ease,
        transform 0.2s ease;
}


.exam-countdown:hover {
    border-color:
        rgba(139, 92, 246, 0.45);

    transform:
        translateY(-1px);
}


.exam-countdown-icon {
    font-size: 18px;
    line-height: 1;
}


.exam-countdown-info {
    display: flex;

    flex-direction: column;

    min-width: 0;
}


.exam-countdown-label {
    overflow: hidden;

    max-width: 150px;

    white-space: nowrap;

    text-overflow: ellipsis;

    font-size: 0.72rem;

    font-weight: 600;

    color: var(--text-primary);
}


.exam-countdown-time {
    margin-top: 2px;

    font-size: 0.68rem;

    font-variant-numeric: tabular-nums;

    color: var(--text-secondary);
}


/* ============================================================
   EXAM DIALOG
   ============================================================ */

.exam-dialog {
    width: min(680px,
            calc(100vw - 32px));

    max-height:
        calc(100vh - 32px);

    padding: 0;

    border: 1px solid rgba(255, 255, 255, 0.08);

    border-radius: 20px;

    background:
        #0d111c;

    color: var(--text-primary);

    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.55);
}


.exam-dialog::backdrop {
    background:
        rgba(0, 0, 0, 0.65);

    backdrop-filter:
        blur(5px);
}


.exam-dialog-card {
    padding: 24px;

    max-height:
        calc(100vh - 32px);

    overflow-y: auto;
}


/* ============================================================
   EXAM LIST
   ============================================================ */

.exam-list {
    display: flex;

    flex-direction: column;

    gap: 10px;

    margin-top: 22px;
}


.exam-item {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    padding: 13px 14px;

    border: 1px solid rgba(255, 255, 255, 0.07);

    border-radius: 12px;

    background:
        rgba(255, 255, 255, 0.025);
}


.exam-item-info {
    min-width: 0;
}


.exam-item-category {
    display: inline-block;

    margin-bottom: 4px;

    font-size: 0.68rem;

    font-weight: 700;

    color: #a78bfa;

    text-transform: uppercase;

    letter-spacing: 0.04em;
}


.exam-item-name {
    font-size: 0.9rem;

    font-weight: 600;

    color: var(--text-primary);
}


.exam-item-date {
    margin-top: 3px;

    font-size: 0.72rem;

    color: var(--text-secondary);
}


.exam-item-actions {
    display: flex;

    gap: 6px;

    flex-shrink: 0;
}


.exam-delete-button {
    border: none;

    background:
        rgba(239, 68, 68, 0.08);

    color: #f87171;

    border-radius: 8px;

    padding: 7px 9px;

    cursor: pointer;
}


/* ============================================================
   EMPTY EXAM STATE
   ============================================================ */

.exam-empty {
    padding: 25px 10px;

    text-align: center;

    font-size: 0.8rem;

    color: var(--text-secondary);
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 600px) {

    .topbar-status-area {
        width: 100%;

        justify-content: space-between;

        gap: 7px;
    }


    .exam-countdown {
        min-width: 0;

        flex: 1;

        padding: 6px 8px;
    }


    .exam-countdown-label {
        max-width: 120px;
    }


    .connection-status {
        flex-shrink: 0;
    }


    .exam-dialog {
        width:
            calc(100vw - 20px);

        max-height:
            calc(100vh - 20px);

        border-radius: 16px;
    }


    .exam-dialog-card {
        padding: 18px;
    }


    .exam-item {
        align-items: flex-start;
    }

}
