/* Practice page styles. Builds on /css/style.css. */

.practice-main {
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 4rem;
}

.practice-header h1 {
    margin: 0 0 0.4rem;
}

.practice-tagline {
    color: var(--text-1);
    margin: 0 0 1.5rem;
}

/* Two-column shell: question list on the left, work area on the right */
.practice-shell {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 900px) {
    .practice-shell { grid-template-columns: 1fr; }
}

/* ---------- Sidebar ---------- */

.practice-sidebar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1rem;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}
.sidebar-header h3 {
    margin: 0;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--mint-deep);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}
.score-summary {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-1);
    background: var(--bg-1);
    border: 1px solid var(--line);
    padding: 0.15rem 0.55rem;
    border-radius: 3px;
}

.filter-row {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
}
.filter-btn {
    flex: 1 1 auto;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    padding: 0.3rem 0.4rem;
    background: var(--bg-1);
    color: var(--text-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--mint-deep); }
.filter-btn.is-active {
    background: rgba(70, 208, 154, 0.10);
    border-color: var(--mint-deep);
    color: var(--mint-deep);
}

.q-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.q-list li {
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid transparent;
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 0.5rem;
    align-items: center;
    transition: background 0.12s, border-color 0.12s;
}
.q-list li:hover {
    background: var(--bg-1);
    border-color: var(--line);
}
.q-list li.is-active {
    background: rgba(70, 208, 154, 0.08);
    border-color: var(--mint-deep);
}
.q-list li.is-hidden { display: none; }

.q-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-3);
    text-align: right;
}
.q-title {
    font-size: 0.88rem;
    color: var(--text-0);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.q-status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}
.q-status.pending  { background: var(--bg-1);                       color: var(--text-3); }
.q-status.passed   { background: rgba(70,208,154,0.14);             color: var(--mint-deep); }
.q-status.partial  { background: rgba(233,198,109,0.10);            color: var(--amber); }
.q-status.failed   { background: rgba(239,146,115,0.10);            color: var(--coral); }

/* ---------- Main pane ---------- */

.practice-main-pane {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.q-detail {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem;
}
.q-detail .placeholder {
    color: var(--text-2);
    font-style: italic;
}
.q-detail h2 {
    margin: 0 0 0.4rem;
    font-size: 1.4rem;
    color: var(--text-0);
}
.q-detail .q-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}
.q-detail .q-meta .tag {
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
    border: 1px solid var(--line);
    color: var(--text-2);
    background: var(--bg-1);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.q-detail .q-meta .tag.diff-easy   { color: var(--mint-deep);  border-color: rgba(70,208,154,0.3); }
.q-detail .q-meta .tag.diff-medium { color: var(--amber);      border-color: rgba(233,198,109,0.3); }
.q-detail .q-meta .tag.diff-hard   { color: var(--coral);      border-color: rgba(239,146,115,0.3); }
.q-detail .prompt {
    color: var(--text-1);
    font-size: 0.98rem;
    line-height: 1.6;
    white-space: pre-wrap;
}
.q-detail .prompt code {
    background: var(--code-bg);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--mint);
    border: 1px solid var(--line);
}
.q-detail .sample-block {
    margin: 1rem 0 0;
    padding: 0.8rem 1rem;
    background: var(--code-bg);
    border-left: 3px solid var(--coral);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-1);
    white-space: pre-wrap;
    overflow-x: auto;
}

/* ---------- Editor ---------- */

.editor-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.8rem;
    background: var(--bg-1);
    border-bottom: 1px solid var(--line);
}
.toolbar-label {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--mint-deep);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}
.toolbar-actions {
    display: flex;
    gap: 0.4rem;
}
.btn {
    font-family: var(--font-sans);
    font-size: 0.86rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-1);
    background: var(--bg-1);
}
.btn:hover {
    border-color: var(--mint-deep);
    color: var(--text-0);
}
.btn-primary {
    background: var(--mint-deep);
    color: var(--bg-0);
    border-color: var(--mint-deep);
}
.btn-primary:hover { background: var(--mint); border-color: var(--mint); color: var(--bg-0); }
.btn-secondary { /* base style is fine */ }
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.editor {
    width: 100%;
    box-sizing: border-box;
    min-height: 220px;
    padding: 0.8rem 1rem;
    background: var(--code-bg);
    color: var(--text-0);
    font-family: var(--font-mono);
    font-size: 0.92rem;
    line-height: 1.5;
    border: none;
    outline: none;
    resize: vertical;
    tab-size: 4;
}
.editor:focus { background: var(--code-bg); }
.editor-status {
    padding: 0.45rem 0.8rem;
    background: var(--bg-1);
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    border-top: 1px solid var(--line);
}

/* ---------- Results panel ---------- */

.results-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1rem 1.2rem;
    min-height: 80px;
}
.results-empty { color: var(--text-3); font-style: italic; }

.score-card {
    display: grid;
    grid-template-columns: repeat(3, 1fr) auto;
    gap: 0.8rem;
    align-items: stretch;
    margin-bottom: 0.8rem;
}
.score-axis {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.7rem 0.9rem;
}
.score-axis .axis-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.score-axis .axis-value {
    font-size: 1.4rem;
    color: var(--text-0);
    font-family: var(--font-display);
    font-weight: 600;
    margin: 0.15rem 0 0.1rem;
}
.score-axis .axis-detail {
    font-size: 0.78rem;
    color: var(--text-2);
}
.score-axis.is-perfect { border-color: var(--mint-deep); background: rgba(70,208,154,0.05); }
.score-axis.is-partial { border-color: var(--amber); }
.score-axis.is-zero    { border-color: var(--coral); }

.score-total {
    background: var(--mint-deep);
    color: var(--bg-0);
    border-radius: var(--radius);
    padding: 0.7rem 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}
.score-total .total-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
}
.score-total .total-value {
    font-size: 1.8rem;
    font-family: var(--font-display);
    font-weight: 700;
    margin-top: 0.1rem;
}

.results-notes {
    list-style: none;
    padding: 0;
    margin: 0.6rem 0 0;
    font-size: 0.9rem;
    color: var(--text-1);
}
.results-notes li {
    padding: 0.25rem 0;
    border-top: 1px solid var(--line);
}
.results-notes li:first-child { border-top: none; }
.results-notes li.note-good::before { content: "✓ "; color: var(--mint-deep); font-weight: 700; }
.results-notes li.note-bad::before  { content: "✗ "; color: var(--coral);     font-weight: 700; }
.results-notes li.note-info::before { content: "i "; color: var(--text-3);    font-weight: 700; }

.submit-banner {
    margin-top: 0.8rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    background: var(--bg-1);
    border: 1px solid var(--line);
    color: var(--text-2);
}
.submit-banner strong { color: var(--text-1); }

/* ========================================================================== */
/* User-result + gold tables shown after Test Run / Submit                    */
/* ========================================================================== */

.results-tables {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
    margin-top: 1rem;
}
@media (min-width: 1100px) {
    .results-tables { grid-template-columns: 1fr 1fr; }
}

.results-table-block {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.6rem 0.7rem 0.4rem;
    overflow: hidden;
}

.results-table-title {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}
.results-table-meta {
    font-size: 0.72rem;
    color: var(--text-3);
    text-transform: none;
    letter-spacing: 0;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    display: block;
    overflow-x: auto;
    max-height: 360px;
}
.results-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface);
    color: var(--text-1);
    text-align: left;
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    white-space: nowrap;
}
.results-table tbody td {
    padding: 0.3rem 0.6rem;
    border-bottom: 1px solid var(--line);
    color: var(--text-1);
    vertical-align: top;
    max-width: 28ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.results-table tbody td:hover {
    white-space: normal;
    overflow: visible;
    background: var(--surface-2);
}
.results-table tbody tr:last-child td { border-bottom: none; }
.results-table tfoot td {
    padding: 0.3rem 0.6rem;
    color: var(--text-3);
    font-style: italic;
    text-align: center;
    border-top: 1px solid var(--line);
}
.results-table .results-empty { padding: 0.4rem 0.6rem; }

/* Subtle accent so user-vs-gold is visually distinguishable */
.results-table.is-user thead th { color: var(--mint-deep); }
.results-table.is-gold thead th { color: var(--amber); }
