/* ============================================================
   System Testów IRT 3PL – główny arkusz stylów
   Motyw: profesjonalny panel edukacyjny
   ============================================================ */

/* ── Reset & Custom Properties ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --clr-primary:    #6366f1;
    --clr-primary-dk: #4f46e5;
    --clr-secondary:  #8b5cf6;
    --clr-success:    #10b981;
    --clr-danger:     #ef4444;
    --clr-warning:    #f59e0b;
    --clr-info:       #3b82f6;
    --clr-bg:         #f8fafc;
    --clr-surface:    #ffffff;
    --clr-border:     #e2e8f0;
    --clr-text:       #1e293b;
    --clr-muted:      #64748b;
    --radius:         0.75rem;
    --shadow:         0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
    --shadow-lg:      0 8px 24px rgba(0,0,0,.12);
    --transition:     0.2s ease;
    --font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --nav-h:          60px;
}

html { font-size: 16px; scroll-behavior: smooth; min-height: 100%; }
body { font-family: var(--font); background: var(--clr-bg); color: var(--clr-text); line-height: 1.6;
       display: flex; flex-direction: column; min-height: 100vh; }

/* ── Typografia ──────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
p  { margin-bottom: .75rem; }
a  { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }
.text-muted   { color: var(--clr-muted); font-size: .875rem; }
.text-center  { text-align: center; }
.text-truncate{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.text-danger  { color: var(--clr-danger); }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
    position: sticky; top: 0; z-index: 1000;
    height: var(--nav-h);
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.nav-brand   { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; color: var(--clr-text); }
.nav-logo    { font-size: 1.5rem; }
.nav-title   { color: var(--clr-primary); }
.nav-links   { display: flex; gap: .25rem; }
.nav-link    { padding: .5rem .875rem; border-radius: .5rem; color: var(--clr-muted); font-size: .9rem; transition: var(--transition); }
.nav-link:hover, .nav-link.active { background: rgba(99,102,241,.1); color: var(--clr-primary); text-decoration: none; }
.nav-user    { display: flex; align-items: center; gap: .75rem; }
.user-badge  { font-size: .8rem; padding: .3rem .75rem; border-radius: 9999px; font-weight: 600; }
.badge-admin   { background: #fef3c7; color: #92400e; }
.badge-teacher { background: #dbeafe; color: #1e40af; }
.badge-student { background: #dcfce7; color: #166534; }

/* ── Layout ──────────────────────────────────────────────── */
.main-content { flex: 1; }
.container {
    max-width: 1200px; margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem 1.1rem; border-radius: .5rem;
    font-size: .9rem; font-weight: 600; cursor: pointer;
    border: 2px solid transparent; transition: var(--transition);
    text-decoration: none; white-space: nowrap;
    font-family: var(--font);
}
.btn-primary   { background: var(--clr-primary); color: #fff; }
.btn-primary:hover { background: var(--clr-primary-dk); text-decoration: none; }
.btn-secondary { background: var(--clr-secondary); color: #fff; }
.btn-secondary:hover { background: #7c3aed; }
.btn-outline   { border-color: var(--clr-border); color: var(--clr-text); background: var(--clr-surface); }
.btn-outline:hover { border-color: var(--clr-primary); color: var(--clr-primary); }
.btn-danger    { background: var(--clr-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning   { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-irt       { background: #0d9488; color: #fff; }
.btn-irt:hover { background: #0f766e; }
.btn-analytics { background: #7c3aed; color: #fff; }
.btn-analytics:hover { background: #6d28d9; }
.btn-sm  { padding: .3rem .7rem; font-size: .8rem; }
.btn-full{ width: 100%; justify-content: center; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.card-title  { font-size: 1.1rem; margin-bottom: 1rem; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .75rem; }
.card-desc   { color: var(--clr-muted); font-size: .875rem; margin-bottom: 1rem; }
.card-meta   { display: flex; gap: 1rem; margin-bottom: 1rem; font-size: .85rem; color: var(--clr-muted); }
.card-actions{ display: flex; gap: .5rem; }
.card-warning{ border-color: #fbbf24; background: #fffbeb; }
.card-danger { border-color: #fca5a5; background: #fff5f5; }

/* ── Stats Grid ─────────────────────────────────────────── */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.stats-5 { grid-template-columns: repeat(5, 1fr); }
.stat-card {
    background: var(--clr-surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    border: 1px solid var(--clr-border);
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.stat-blue   { border-top: 3px solid var(--clr-info); }
.stat-green  { border-top: 3px solid var(--clr-success); }
.stat-purple { border-top: 3px solid var(--clr-secondary); }
.stat-orange { border-top: 3px solid var(--clr-warning); }
.stat-teal   { border-top: 3px solid #0d9488; }
.stat-icon   { font-size: 1.75rem; }
.stat-value  { font-size: 1.75rem; font-weight: 800; }
.stat-label  { font-size: .8rem; color: var(--clr-muted); }

/* ── Cards Grid ─────────────────────────────────────────── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.test-card  { display: flex; flex-direction: column; }
.test-card .card-actions { margin-top: auto; padding-top: 1rem; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group  { margin-bottom: 1rem; }
.form-label  { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .4rem; }
.form-input, .form-select {
    width: 100%; padding: .6rem .9rem;
    border: 1.5px solid var(--clr-border); border-radius: .5rem;
    font-size: .95rem; font-family: var(--font);
    background: var(--clr-surface); color: var(--clr-text);
    transition: var(--transition);
}
.form-input:focus, .form-select:focus {
    outline: none; border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
textarea.form-input { resize: vertical; min-height: 80px; }
.form-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.span-2     { grid-column: span 2; }
.input-wrapper { position: relative; }
.btn-toggle-pass { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1.1rem; }
.filter-bar { display: flex; gap: .75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.filter-input { max-width: 280px; }
.filter-select{ max-width: 200px; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.table {
    width: 100%; border-collapse: collapse; font-size: .9rem;
}
.table th {
    background: #f1f5f9; padding: .75rem 1rem; text-align: left;
    font-weight: 600; font-size: .8rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--clr-muted); white-space: nowrap;
}
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--clr-border); vertical-align: middle; }
.table tr:hover td { background: #f8fafc; }
.table-compact td, .table-compact th { padding: .5rem .75rem; font-size: .85rem; }
.table-sub { color: var(--clr-muted); font-size: .8rem; margin-top: .2rem; }
.actions-cell { white-space: nowrap; vertical-align: middle; }
.row-warning td { background: #fffbeb; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: .2rem .6rem; border-radius: 9999px;
    font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.badge-success   { background: #dcfce7; color: #166534; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-secondary { background: #e2e8f0; color: #475569; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-mode-classic    { background: #e2e8f0; color: #475569; }
.badge-mode-irt        { background: #dbeafe; color: #1e40af; }
.badge-mode-theta_only { background: #f3e8ff; color: #6b21a8; }
.badge-mode-cat        { background: #d1fae5; color: #065f46; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    padding: .875rem 1.25rem; border-radius: .5rem; margin: 1rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    font-size: .9rem; font-weight: 500;
    animation: slideDown .3s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-10px) } to { opacity:1; transform:translateY(0) } }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-close   { background: none; border: none; cursor: pointer; font-size: 1.2rem; opacity: .7; }
.alert-close:hover { opacity: 1; }

/* ── Login ──────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh; display: grid;
    grid-template-columns: 1fr 1fr;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
    background: var(--clr-surface); display: flex; flex-direction: column;
    justify-content: center; padding: 3rem 2.5rem; max-width: 480px; margin: auto;
    width: 100%; border-radius: 0 var(--radius) var(--radius) 0;
    box-shadow: var(--shadow-lg);
}
.login-logo     { font-size: 3rem; text-align: center; margin-bottom: 1rem; }
.login-title    { font-size: 1.75rem; text-align: center; color: var(--clr-primary); margin-bottom: .25rem; }
.login-subtitle { text-align: center; color: var(--clr-muted); font-size: .875rem; margin-bottom: 2rem; }
.login-form     { display: flex; flex-direction: column; gap: 1rem; }
.login-info     { margin-top: 1.5rem; text-align: center; font-size: .8rem; color: var(--clr-muted); }
.login-features {
    color: white; padding: 3rem 2.5rem; display: flex; flex-direction: column;
    justify-content: center; gap: 1.5rem;
}
.login-features h2 { color: white; opacity: .9; }
.feature-list { list-style: none; display: flex; flex-direction: column; gap: .75rem; }
.feature-list li { font-size: .95rem; opacity: .9; }
@media (max-width: 768px) {
    .login-wrapper { grid-template-columns: 1fr; }
    .login-features { display: none; }
    .login-card { border-radius: 0; }
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.page-header h1 { margin-bottom: .25rem; }
.section        { margin-bottom: 2.5rem; }
.section-title  { margin-bottom: 1rem; font-size: 1.15rem; }

/* ── Test View ──────────────────────────────────────────── */
.test-container { max-width: 860px; }
.test-header    {
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
    position: sticky; top: var(--nav-h); z-index: 100; box-shadow: var(--shadow);
}
.test-meta h1   { font-size: 1.4rem; }
.test-info      { display: flex; gap: 1.5rem; color: var(--clr-muted); font-size: .875rem; margin-top: .5rem; flex-wrap: wrap; }
.test-progress  { margin-top: 1rem; }
.progress-track { height: 8px; background: #e2e8f0; border-radius: 9999px; overflow: hidden; }
.progress-fill  { height: 100%; background: var(--clr-primary); border-radius: 9999px; transition: width .3s; }
.progress-text  { font-size: .8rem; color: var(--clr-muted); margin-top: .25rem; }
.timer-value    { font-weight: 700; color: var(--clr-text); }
.timer-warning  { color: var(--clr-danger) !important; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }

.question-card  {
    background: var(--clr-surface); border: 2px solid var(--clr-border);
    border-radius: var(--radius); padding: 1.75rem; margin-bottom: 1.25rem;
    transition: border-color .2s;
}
.question-card.answered { border-color: rgba(16,185,129,.4); }
.question-number{ display: flex; justify-content: space-between; margin-bottom: 1rem; }
.q-num          { font-weight: 700; color: var(--clr-primary); font-size: .95rem; }
.q-category     { font-size: .75rem; color: var(--clr-muted); background: #f1f5f9; padding: .2rem .6rem; border-radius: 9999px; }
.question-content { font-size: 1.05rem; margin-bottom: 1.25rem; line-height: 1.7; }
.answers-list   { display: flex; flex-direction: column; gap: .5rem; }

.answer-option  {
    display: flex; align-items: flex-start; gap: .875rem; padding: .875rem 1.1rem;
    border: 1.5px solid var(--clr-border); border-radius: .5rem; cursor: pointer;
    transition: var(--transition);
}
.answer-option:hover { border-color: var(--clr-primary); background: rgba(99,102,241,.04); }
.answer-option:has(.answer-radio:checked) { border-color: var(--clr-primary); background: rgba(99,102,241,.08); }
.answer-radio   { display: none; }
.answer-marker  {
    min-width: 28px; height: 28px; border-radius: 50%; background: #f1f5f9;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem;
    border: 2px solid var(--clr-border); transition: var(--transition);
}
.answer-option:has(.answer-radio:checked) .answer-marker {
    background: var(--clr-primary); color: white; border-color: var(--clr-primary);
}
.answer-text    { flex: 1; font-size: .95rem; padding-top: .2rem; }

.test-footer    {
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius); padding: 1.25rem 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; bottom: 1rem; box-shadow: var(--shadow-lg);
}
.answered-summary { display: flex; flex-direction: row; align-items: center; gap: .5rem; flex-wrap: wrap; }
.count-badge    { font-weight: 700; color: var(--clr-primary); font-size: 1.1rem; }
.q-dots         { display: flex; flex-wrap: wrap; gap: .3rem; }
.q-dot          { width: 12px; height: 12px; border-radius: 50%; background: #e2e8f0; transition: var(--transition); }
.q-dot.answered { background: var(--clr-primary); }
.btn-submit     { font-size: 1rem; padding: .75rem 2rem; }

/* ── Results ─────────────────────────────────────────────── */
.results-container { max-width: 900px; }
.result-hero {
    border-radius: var(--radius); padding: 2.5rem; text-align: center;
    margin-bottom: 1.5rem; border: 1px solid;
}
.result-pass { background: linear-gradient(135deg, #d1fae5, #a7f3d0); border-color: #6ee7b7; }
.result-fail { background: linear-gradient(135deg, #fee2e2, #fecaca); border-color: #fca5a5; }
.result-icon { font-size: 4rem; margin-bottom: 1rem; }
.result-title { font-size: 2rem; margin-bottom: .5rem; }
.result-subtitle { opacity: .8; margin-bottom: 1.5rem; }
.result-scores  { display: flex; justify-content: center; gap: 2rem; flex-wrap: wrap; }
.score-box      { background: rgba(255,255,255,.8); border-radius: .75rem; padding: 1.25rem 2rem; text-align: center; }
.score-value    { font-size: 2rem; font-weight: 800; }
.score-label    { font-size: .8rem; color: var(--clr-muted); margin-top: .25rem; }
.score-irt      { background: rgba(99,102,241,.15); }
.score-grade    { background: rgba(16,185,129,.15); }
.irt-details    {}
.irt-grid       { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.irt-metric     { background: #f8fafc; border-radius: .5rem; padding: 1rem; border: 1px solid var(--clr-border); }
.irt-val        { font-size: 1.5rem; font-weight: 700; color: var(--clr-primary); }
.irt-key        { font-weight: 600; font-size: .85rem; margin-top: .25rem; }
.irt-desc       { font-size: .8rem; color: var(--clr-muted); margin-top: .25rem; }
.metric-warning { background: #fffbeb; border-color: #fcd34d; }
.metric-warning .irt-val { color: var(--clr-warning); }

/* Theta axis */
.theta-axis-wrapper { margin: 1.5rem 0; }
.theta-axis      { background: #f8fafc; border-radius: .5rem; padding: 1rem 1.5rem; border: 1px solid var(--clr-border); }
.axis-labels     { display: flex; justify-content: space-between; font-size: .75rem; color: var(--clr-muted); margin-bottom: .5rem; }
.axis-track      { height: 20px; background: linear-gradient(to right, #fee2e2, #fef3c7, #dcfce7); border-radius: 9999px; position: relative; }
.axis-ci         { position: absolute; top: 0; height: 100%; background: rgba(99,102,241,.3); border-radius: 9999px; }
.axis-marker     {
    position: absolute; top: 50%; transform: translate(-50%,-50%);
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--clr-primary); border: 3px solid white;
    box-shadow: 0 2px 8px rgba(99,102,241,.5);
}
.axis-zone-labels{ display: flex; justify-content: space-between; font-size: .75rem; color: var(--clr-muted); margin-top: .4rem; }

/* Review */
.review-list    { display: flex; flex-direction: column; gap: .75rem; }
.review-item    { display: flex; gap: 1rem; padding: .875rem 1rem; border-radius: .5rem; border: 1px solid; }
.review-correct { background: #f0fdf4; border-color: #86efac; }
.review-wrong   { background: #fff5f5; border-color: #fca5a5; }
.review-num     { font-weight: 700; color: var(--clr-muted); min-width: 24px; }
.review-content { flex: 1; }
.review-question{ font-size: .9rem; margin-bottom: .25rem; }
.review-answer  { font-size: .85rem; color: var(--clr-muted); }
.item-params    { font-size: .75rem; color: var(--clr-muted); font-family: monospace; }
.results-actions{ display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }

/* Score bar */
.score-bar-wrapper { display: flex; align-items: center; gap: .5rem; }
.score-bar       { height: 8px; border-radius: 9999px; min-width: 4px; }
.theta-badge     { background: rgba(99,102,241,.1); color: var(--clr-primary); border-radius: .4rem; padding: .2rem .5rem; font-family: monospace; font-size: .85rem; }
.grade-badge     { font-weight: 700; font-size: 1.1rem; }
.grade-2 { color: #ef4444; }
.grade-3 { color: #f59e0b; }
.grade-4 { color: #3b82f6; }
.grade-5 { color: #10b981; }

/* ── Admin Questions ─────────────────────────────────────── */
.questions-list   { display: flex; flex-direction: column; gap: .75rem; }
.question-row     { background: var(--clr-surface); border: 1px solid var(--clr-border); border-radius: .5rem; padding: 1rem 1.25rem; }
.question-row-header { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.q-id            { font-family: monospace; font-size: .8rem; color: var(--clr-muted); }
.q-cat-tag       { background: #f1f5f9; border-radius: 9999px; font-size: .75rem; padding: .15rem .6rem; }
.irt-params-inline { display: flex; gap: .35rem; flex-wrap: wrap; }
.param-badge     { font-family: monospace; font-size: .75rem; padding: .15rem .5rem; border-radius: .3rem; font-weight: 600; }
.param-a         { background: #dbeafe; color: #1e40af; }
.param-b         { background: #ede9fe; color: #5b21b6; }
.param-c         { background: #fef3c7; color: #92400e; }
.param-warn      { background: #fee2e2; color: #991b1b; }
.param-none      { background: #f1f5f9; color: #64748b; }
.question-row-content { font-size: .9rem; color: var(--clr-muted); margin-bottom: .75rem; }
.question-row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* IRT param bars in ranking */
.param-bar  { display: flex; align-items: center; gap: .5rem; }
.bar-fill   { height: 8px; border-radius: 9999px; }
.bar-a      { background: var(--clr-info); }
.b-badge    { display: inline-block; padding: .15rem .5rem; border-radius: .3rem; font-family: monospace; font-size: .8rem; color: white; font-weight: 600; }

/* ── Analytics ──────────────────────────────────────────── */
.analytics-container {}
.test-selector  { display: flex; align-items: center; gap: .75rem; }
.charts-row     { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.charts-2       { grid-template-columns: 1fr 1fr; }
.chart-card     {
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.chart-card h3  { margin-bottom: 1rem; font-size: .95rem; }
.chart-wrapper  { margin-top: 1.5rem; }
.analytics-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
@media (max-width: 900px) {
    .charts-2 { grid-template-columns: 1fr; }
    .stats-5  { grid-template-columns: repeat(2, 1fr); }
}

/* ── Quick Actions ──────────────────────────────────────── */
.quick-actions  { margin-bottom: 1.5rem; }
.quick-actions h2 { margin-bottom: 1rem; }
.actions-row    { display: flex; gap: .75rem; flex-wrap: wrap; }
.action-btn     {
    display: flex; flex-direction: column; align-items: center; gap: .4rem;
    padding: 1rem 1.5rem; background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius); text-decoration: none; color: var(--clr-text);
    transition: var(--transition); font-size: .875rem; font-weight: 600;
    min-width: 120px; text-align: center;
}
.action-btn:hover { border-color: var(--clr-primary); background: rgba(99,102,241,.05); text-decoration: none; color: var(--clr-primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.action-primary { background: rgba(99,102,241,.07); border-color: rgba(99,102,241,.4); color: var(--clr-primary); }
.action-icon    { font-size: 1.75rem; }

/* ── Answers Editor ─────────────────────────────────────── */
.answers-editor { margin-bottom: 1.25rem; }
.answer-row     { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.answer-row input[type=radio] { width: auto; min-width: auto; }
.answer-row .form-input { flex: 1; }

/* ── Modal ──────────────────────────────────────────────── */
.modal          { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.modal-overlay  { position: absolute; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.modal-content  { position: relative; background: var(--clr-surface); border-radius: var(--radius); padding: 1.75rem; max-width: 600px; width: 95%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); z-index: 1; }
.modal-lg       { max-width: 780px; }
.modal-xl       { max-width: 960px; }
.modal-header   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.modal-close    { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--clr-muted); }
.modal-footer   { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--clr-border); }

/* ── Pagination ─────────────────────────────────────────── */
.pagination     { display: flex; gap: .35rem; justify-content: center; margin-top: 1rem; }
.page-link      { padding: .35rem .75rem; border-radius: .4rem; border: 1px solid var(--clr-border); font-size: .875rem; color: var(--clr-text); }
.page-link.active { background: var(--clr-primary); color: white; border-color: var(--clr-primary); }
.page-link:hover { border-color: var(--clr-primary); text-decoration: none; }

/* ── Empty State ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem; color: var(--clr-muted); }
.empty-icon  { font-size: 3rem; margin-bottom: 1rem; }

/* ── CAT Modal ──────────────────────────────────────────── */
.cat-loading    { text-align: center; padding: 2rem; }
.spinner        {
    width: 48px; height: 48px; border: 4px solid #e2e8f0;
    border-top-color: var(--clr-primary); border-radius: 50%;
    animation: spin .8s linear infinite; margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
    background: var(--clr-surface); border-top: 1px solid var(--clr-border);
    padding: .875rem 1.5rem; font-size: .8rem; color: var(--clr-muted);
}
.footer-content { display: flex; justify-content: center; align-items: center; gap: .75rem; flex-wrap: wrap; }
.footer-sep     { opacity: .4; }

/* ── Misc ────────────────────────────────────────────────── */
.btn-sm-text    { font-size: .8rem; color: var(--clr-muted); }
.error-code     { font-size: 6rem; color: var(--clr-danger); }
.error-msg      { font-size: 1.5rem; margin-bottom: 1rem; }

/* ── Print ───────────────────────────────────────────────── */
@media print {
    .navbar, .results-actions, .btn, .site-footer { display: none !important; }
    .result-hero { border: 2px solid #ccc !important; }
}

/* ── Tab-away (monitoring karty testu) ──────────────────── */
.tab-away-cell { font-size:.8rem;font-weight:600;padding:.2rem .5rem;border-radius:.35rem;white-space:nowrap; }
.tab-away-low  { background:#fef9c3;color:#854d0e; }
.tab-away-high { background:#fee2e2;color:#991b1b; }

/* ── Strony gościa (login, reset itp.) – pełny ekran bez stopki ── */
.guest .site-footer { display: none; }
.guest .main-content { display: flex; flex-direction: column; }

/* ── Student – bez menu nawigacyjnego ───────────────────── */
.role-student .nav-links,
.role-student .nav-hamburger { display: none !important; }

/* ── Hamburger (mobile) ──────────────────────────────────── */
.nav-hamburger {
    display: none;
    flex-direction: column; justify-content: center; gap: 5px;
    width: 36px; height: 36px;
    background: none; border: none; cursor: pointer; padding: 4px;
    border-radius: .375rem;
}
.nav-hamburger span {
    display: block; height: 2px; width: 22px;
    background: var(--clr-text); border-radius: 2px;
    transition: transform .25s, opacity .25s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .span-2    { grid-column: span 1; }
    .test-footer { flex-direction: column; gap: 1rem; text-align: center; }
    .result-scores { flex-direction: column; align-items: center; }
    .page-header { flex-direction: column; }
    h1 { font-size: 1.5rem; }

    .nav-hamburger { display: flex; margin-right: auto; }

    .nav-links {
        display: none;
        position: absolute; top: var(--nav-h); left: 0; right: 0;
        background: var(--clr-surface);
        border-bottom: 1px solid var(--clr-border);
        flex-direction: column; gap: 0;
        padding: .5rem 0;
        box-shadow: 0 4px 12px rgba(0,0,0,.08);
        z-index: 999;
    }
    .nav-links.open { display: flex; }
    .nav-link { padding: .75rem 1.5rem; border-radius: 0; }

    .nav-user { gap: .5rem; }
    .user-badge { display: none; }
}
