/* === Suntrack training app === */
:root {
  --orange: #f39200;
  --orange-dark: #d97e00;
  --yellow: #ffc940;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2433;
  --muted: #6b7280;
  --border: #e6e8ee;
  --ok: #16a34a;
  --bad: #dc2626;
  --admin: #6366f1;
  --shadow: 0 4px 16px rgba(20,30,60,0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin-top: 0; line-height: 1.2; }
a { color: var(--orange-dark); text-decoration: none; }

/* === LOGIN === */
.login-screen { display: grid; grid-template-columns: 1.2fr 1fr; min-height: 100vh; }
.login-left { padding: 2.5rem 3rem; background: linear-gradient(180deg, #fff 0%, #faf6f0 100%); overflow-y: auto; }
.brand { margin-bottom: 2rem; }
.logo { font-weight: 900; letter-spacing: 0.25em; font-size: 1.4rem; color: var(--orange); }
.tagline { color: var(--muted); font-size: 0.9rem; letter-spacing: 0.1em; text-transform: uppercase; }
.login-left h2 { font-size: 1.5rem; margin: 1rem 0 1.5rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.tile { background: white; border: 2px solid var(--border); border-radius: 18px; padding: 1.5rem 1rem; cursor: pointer; transition: all .15s ease; font-family: inherit; position: relative; text-align: center; }
.tile:hover { border-color: var(--orange); transform: translateY(-3px); box-shadow: var(--shadow); }
.tile-admin { border-color: rgba(99,102,241,0.3); background: linear-gradient(180deg, #fff 0%, #f5f5ff 100%); }
.tile-admin:hover { border-color: var(--admin); }
.tile-avatar { width: 60px; height: 60px; margin: 0 auto 0.75rem; border-radius: 50%; background: linear-gradient(135deg, var(--orange), var(--yellow)); display: flex; align-items: center; justify-content: center; color: white; font-weight: 800; font-size: 1.3rem; }
.tile-admin .tile-avatar { background: linear-gradient(135deg, var(--admin), #8b5cf6); }
.tile-name { font-weight: 600; font-size: 0.95rem; }
.tile-badge { position: absolute; top: 8px; right: 8px; background: var(--admin); color: white; font-size: 0.65rem; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; }

.login-right { background: linear-gradient(135deg, #1f2433 0%, #2d3344 100%); color: white; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.hero { max-width: 420px; text-align: center; }
.hero-img { width: 100%; height: 280px; border-radius: 20px; margin-bottom: 1.5rem; background-image:
  linear-gradient(135deg, rgba(243,146,0,0.25), rgba(0,0,0,0.55)),
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 400'><defs><linearGradient id='g' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='%23f39200'/><stop offset='1' stop-color='%231f2433'/></linearGradient></defs><rect width='600' height='400' fill='url(%23g)'/><g fill='none' stroke='white' stroke-width='2' opacity='0.5'><rect x='80' y='220' width='100' height='80'/><rect x='200' y='220' width='100' height='80'/><rect x='320' y='220' width='100' height='80'/><rect x='440' y='220' width='100' height='80'/><line x1='80' y1='160' x2='540' y2='160'/><circle cx='310' cy='100' r='30' fill='white' opacity='0.9'/></g><text x='300' y='370' text-anchor='middle' fill='white' font-family='Arial' font-size='14' opacity='0.6'>SALA SZKOLENIOWA</text></svg>");
  background-size: cover; background-position: center; box-shadow: 0 10px 40px rgba(0,0,0,0.4); }
.hero h1 { font-size: 2rem; margin: 0 0 0.5rem; }
.hero p { color: rgba(255,255,255,0.7); line-height: 1.6; }

@media (max-width: 900px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-right { display: none; }
}

/* === MODAL PIN === */
.modal { position: fixed; inset: 0; background: rgba(31,36,51,0.65); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal.hidden { display: none; }
.pin-form { background: white; border-radius: 20px; padding: 2rem; width: 350px; max-width: 90vw; position: relative; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: none; font-size: 1.8rem; cursor: pointer; color: var(--muted); }
.pin-avatar { width: 80px; height: 80px; margin: 0 auto 1rem; border-radius: 50%; background: linear-gradient(135deg, var(--orange), var(--yellow)); display: flex; align-items: center; justify-content: center; color: white; font-weight: 800; font-size: 1.6rem; }
.pin-form h3 { margin: 0 0 1rem; }
.pin-form label { display: block; text-align: left; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
.pin-form input[type=password] { width: 100%; padding: 0.9rem; font-size: 1.5rem; text-align: center; border: 2px solid var(--border); border-radius: 12px; letter-spacing: 0.3em; }
.pin-form input[type=password]:focus { border-color: var(--orange); outline: none; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 1rem 0; }
.pk { padding: 1rem; font-size: 1.3rem; border: 1px solid var(--border); background: #fafbfc; border-radius: 10px; cursor: pointer; font-family: inherit; transition: all .1s; }
.pk:hover { background: #f0f2f5; }
.pk:active { transform: scale(0.95); }
.hint { color: var(--muted); font-size: 0.8rem; margin-top: 0.5rem; }
.hint code { background: #f0f2f5; padding: 2px 6px; border-radius: 4px; font-family: monospace; }

/* === BUTTONS === */
.btn-primary { display: inline-block; background: var(--orange); color: white; border: none; padding: 0.9rem 1.5rem; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; font-family: inherit; width: 100%; margin-top: 0.5rem; text-align: center; text-decoration: none; transition: background .15s; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-primary.big { font-size: 1.1rem; padding: 1rem 2rem; }
.btn-secondary { display: block; text-align: center; color: var(--muted); margin-top: 0.75rem; font-size: 0.9rem; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 0.9rem; text-decoration: none; }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange-dark); }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

/* === CARD / CENTERED === */
.centered { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.card { background: white; padding: 2rem; border-radius: 18px; box-shadow: var(--shadow); max-width: 420px; width: 100%; }
.card h1 { font-size: 1.6rem; }
.card label { display: block; font-size: 0.85rem; color: var(--muted); margin: 1rem 0 0.3rem; }
.card input { width: 100%; padding: 0.9rem; font-size: 1.3rem; text-align: center; border: 2px solid var(--border); border-radius: 12px; letter-spacing: 0.3em; }
.card input:focus { border-color: var(--orange); outline: none; }

/* === TOPBAR === */
.topbar { background: white; border-bottom: 1px solid var(--border); padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; }
.brand-mini { font-weight: 900; letter-spacing: 0.2em; color: var(--orange); }
.brand-mini span { color: var(--muted); font-weight: 500; letter-spacing: 0.1em; margin-left: 0.5rem; }
.topbar-right { display: flex; gap: 0.75rem; align-items: center; }

.container { max-width: 1100px; margin: 1.25rem auto; padding: 0 1.5rem; }
.container h1 { font-size: 1.5rem; margin-bottom: 1rem; }

/* === TRAINING GRID === */
.training-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
.training-card { background: white; padding: 1.5rem; border-radius: 16px; box-shadow: var(--shadow); display: block; color: var(--text); border: 2px solid transparent; transition: all .15s; }
.training-card:hover { border-color: var(--orange); transform: translateY(-2px); }
.training-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; }
.training-card p { color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 1rem; }
.cta { color: var(--orange-dark); font-weight: 600; margin-top: 0.75rem; }
.badge-done { display: inline-block; background: var(--ok); color: white; padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; margin-top: 0.75rem; }

/* === PROGRESS BAR === */
.progress-bar { width: 100%; height: 10px; background: #eef0f4; border-radius: 999px; overflow: hidden; }
.progress-bar.small { height: 6px; }
.progress-bar.tiny { height: 4px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--yellow), var(--orange)); transition: width .3s ease; }
.progress-text { font-size: 0.85rem; color: var(--muted); margin-top: 0.4rem; }

/* === QUIZ (kompaktowe) === */
.quiz-head { margin-bottom: 1rem; }
.quiz-head h2 { font-size: 1rem; color: var(--muted); margin-bottom: 0.5rem; }
.stats-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; font-size: 0.8rem; }
.stat { background: white; border: 1px solid var(--border); padding: 0.25rem 0.65rem; border-radius: 999px; color: var(--muted); }
.stat strong { color: var(--text); font-size: 0.9rem; margin-right: 0.25rem; }
.stat-learned { border-color: rgba(22,163,74,0.3); }
.stat-learned strong { color: var(--ok); }
.stat-progress { border-color: rgba(243,146,0,0.3); }
.stat-progress strong { color: var(--orange-dark); }
.stat-new { border-color: rgba(99,102,241,0.3); }
.stat-new strong { color: var(--admin); }
.stat-pct { background: linear-gradient(90deg, #fff7ec, #ffe9c4); border-color: var(--orange); }
.stat-pct strong { color: var(--orange-dark); }
.question-card { background: white; padding: 1.25rem 1.5rem; border-radius: 16px; box-shadow: var(--shadow); max-width: 700px; margin: 0 auto; }
.q-image { text-align: center; margin-bottom: 0.75rem; }
.q-image img { max-width: 100%; max-height: 200px; border-radius: 10px; object-fit: contain; background: #fafbfc; padding: 0.5rem; }
.q-text { font-size: 1.15rem; margin-bottom: 1rem; line-height: 1.35; }
.answers { display: flex; flex-direction: column; gap: 0.5rem; }
.answer-btn { display: flex; align-items: center; gap: 0.75rem; background: #fafbfc; border: 2px solid var(--border); padding: 0.7rem 1rem; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 0.95rem; text-align: left; transition: all .12s; width: 100%; }
.answer-btn:hover { border-color: var(--orange); background: white; transform: translateX(3px); }
.answer-letter { background: var(--orange); color: white; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.9rem; flex-shrink: 0; }
.answer-text { flex: 1; }

/* === FEEDBACK (kompaktowe) === */
.feedback-card { background: white; padding: 1.25rem 1.5rem; border-radius: 16px; box-shadow: var(--shadow); text-align: center; max-width: 520px; margin: 0 auto; }
.feedback-card.ok { border-top: 5px solid var(--ok); }
.feedback-card.bad { border-top: 5px solid var(--bad); }
.fb-head { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.fb-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 1.6rem; font-weight: 700; flex-shrink: 0; }
.feedback-card.ok .fb-icon { background: var(--ok); }
.feedback-card.bad .fb-icon { background: var(--bad); }
.fb-head h1 { font-size: 1.4rem; margin: 0; }
.fb-correct { margin: 0.4rem 0; font-size: 0.95rem; }
.fb-explanation { color: var(--muted); font-style: italic; margin: 0.6rem 0 1rem; line-height: 1.4; font-size: 0.95rem; }
.feedback-card .btn-primary { width: auto; padding: 0.75rem 1.6rem; margin-top: 0; }
.muted { color: var(--muted); }

/* === DONE === */
.done-card { background: white; padding: 3rem 2rem; border-radius: 20px; box-shadow: var(--shadow); text-align: center; max-width: 500px; margin: 3rem auto; }
.done-card .big-icon { font-size: 5rem; }
.done-card h1 { font-size: 2.5rem; color: var(--orange); }

/* === ADMIN === */
.stats { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.stats th, .stats td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.stats th { background: #fafbfc; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stats tr:last-child td { border-bottom: none; }
.cell-progress { min-width: 160px; }
.cell-text { font-size: 0.9rem; margin-top: 0.3rem; }
.cell-sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.2rem; }
.admin-list { background: white; padding: 1rem 2rem; border-radius: 12px; box-shadow: var(--shadow); list-style: none; }
.admin-list li { padding: 0.5rem 0; }

/* === TOAST === */
.toast-stack { position: fixed; bottom: 2rem; right: 2rem; z-index: 200; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background: white; padding: 1rem 1.5rem; border-radius: 10px; box-shadow: var(--shadow); border-left: 4px solid var(--muted); animation: slidein .3s ease; }
.toast-error { border-left-color: var(--bad); }
.toast-success { border-left-color: var(--ok); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
