/* Matura Mix — Savremena school-palette theme */

:root {
  /* School palette — pulled from savremena-osnovna.edu.rs */
  --sos-red:    #e52c2d;
  --sos-blue:   #3564ab;
  --sos-yellow: #f7b62f;
  --sos-green:  #39a749;

  /* Surface & text */
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --card: #ffffff;
  --ink: #383838;
  --ink-muted: #7595a0;
  --ink-dim: #a1a1a1;

  /* Accents */
  --accent: var(--sos-blue);     /* primary (buttons, focus rings, active tab) */
  --accent-alt: var(--sos-red);  /* wordmark, headline emphasis */
  --accent-ink: #ffffff;         /* text on primary buttons */
  --danger: var(--sos-red);
  --ok: var(--sos-green);

  --border: #e0e0e0;
  --border-strong: #cfd6dc;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 6px 18px rgba(53, 100, 171, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  min-height: 100vh;
}

/* Rainbow top strip — matches the four-color bar under the Savremena wordmark */
.brand-bar {
  display: flex;
  height: 6px;
  width: 100%;
}
.brand-bar > span { flex: 1 1 0; display: block; }
.brand-bar > .bb-yellow { background: var(--sos-yellow); }
.brand-bar > .bb-blue   { background: var(--sos-blue); }
.brand-bar > .bb-red    { background: var(--sos-red); }
.brand-bar > .bb-green  { background: var(--sos-green); }

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.logo {
  display: block;
  height: 54px;
  width: auto;
  max-width: 100%;
  margin: 0 0 20px;
}

.intro h1 {
  margin: 0 0 4px;
  font-size: 32px;
  letter-spacing: -0.02em;
  color: var(--accent-alt);
  font-weight: 700;
}

.tagline {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

/* Feature illustration between the tagline and the first paragraph.
   Always sized to the content column; scales by aspect ratio; sits
   with breathing room above and below. `max-width: 100%` is the
   load-bearing rule — width: 100% alone can be overridden by the
   image's intrinsic size in some edge cases. */
.feature {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 6px 0 18px;
  border-radius: var(--radius);
  background: #0f1138; /* matches the field tone — avoids a flash before
                           the image paints on slow connections */
}

.blurb {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
}

.blurb.muted { color: var(--ink-muted); font-size: 14px; }

.form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  box-shadow: var(--shadow);
}

.block h2 {
  margin: 0 0 4px;
  font-size: 17px;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.hint {
  margin: 0 0 12px;
  color: var(--ink-muted);
  font-size: 13.5px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}

.req { color: var(--accent-alt); margin-left: 2px; }

input[type="text"],
input[type="email"] {
  font: inherit;
  font-size: 16px; /* >= 16 so iOS doesn't zoom */
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder { color: var(--ink-dim); }

input[type="text"]:focus,
input[type="email"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(53, 100, 171, 0.18);
}

input.is-invalid,
input[type="text"].is-invalid,
input[type="email"].is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(229, 44, 45, 0.15);
}

.rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rows .row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rows .row .idx {
  flex: 0 0 22px;
  text-align: right;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.rows .row input[type="text"] { flex: 1 1 auto; }

.rows.songs .row { flex-wrap: wrap; }
.rows.songs .row .pair {
  display: flex;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.rows.songs .row .pair input { min-width: 0; }
.rows.songs .row .pair .title  { flex: 2 1 0; }
.rows.songs .row .pair .artist { flex: 1.3 1 0; }

.btn {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 18px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.08s, opacity 0.15s;
  box-shadow: 0 2px 6px rgba(53, 100, 171, 0.25);
}

.btn:hover { background: #2d5597; border-color: #2d5597; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: progress; }

.error {
  background: #fdecec;
  border: 1px solid rgba(229, 44, 45, 0.45);
  color: #7a1616;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.thanks {
  text-align: center;
  padding: 48px 20px;
}
.thanks h2 {
  font-size: 28px;
  margin: 0 0 10px;
  color: var(--ok);
  font-weight: 700;
}
.thanks p { color: var(--ink-muted); margin: 0; }

.foot {
  margin-top: 28px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 12.5px;
}

/* tablet+ */
@media (min-width: 640px) {
  .page { padding: 36px 24px 80px; }
  .intro h1 { font-size: 38px; }
  .block { padding: 22px 20px 20px; }
  .logo { height: 64px; }
}

/* Narrow phones — stack song title/artist vertically so both get full width,
   and bump input tap target from ~40px to ~47px so thumbs have more room. */
@media (max-width: 479px) {
  .rows.songs .row .pair {
    flex-direction: column;
    gap: 6px;
  }
  .rows.songs .row .pair .title,
  .rows.songs .row .pair .artist { flex: 1 1 auto; }
  input[type="text"],
  input[type="email"] { padding: 13px 12px; }
}

/* --- Results page --------------------------------------------------- */

.page-wide { max-width: 1080px; }

.deny {
  text-align: center;
  color: var(--ink-muted);
}
.deny h2 {
  margin: 0 0 8px;
  color: var(--ink);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 14px;
  flex-wrap: wrap;
}
.status-main {
  font-size: 22px;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--ink);
}
.status-sub {
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 400;
}
.status-main .status-sub {
  font-size: 14px;
  margin-left: 4px;
}

.btn-ghost {
  background: #ffffff;
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: none;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 500;
}
.btn-ghost:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: 4px 0 16px;
}
.tab {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 14px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.panel { margin-top: 8px; }

/* Spotify connector bar on the leaderboard tab */
.spotify-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0 0 12px;
  font-size: 13.5px;
}
.spotify-bar .sp-label {
  color: var(--ink);
  font-weight: 500;
}
.spotify-bar .sp-status {
  color: var(--ink-muted);
}
.spotify-bar .sp-status.sp-ok { color: var(--ok); }
.spotify-bar input[type="text"] {
  flex: 1 1 200px;
  padding: 7px 10px;
  font-size: 14px;
}
.spotify-bar .btn,
.spotify-bar .btn-ghost {
  padding: 7px 12px;
  font-size: 13.5px;
  font-weight: 500;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  overflow: auto;
  max-height: 72vh;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 1%;
  white-space: nowrap;
}
.data-table .t-time {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.data-table .t-email {
  color: var(--ink-muted);
  font-size: 13px;
  white-space: nowrap;
}
.data-table .t-votes {
  color: var(--accent-alt);
  font-weight: 700;
}
.data-table .t-voters {
  color: var(--ink-muted);
  font-size: 13px;
}
.data-table .t-sp { width: 1%; white-space: nowrap; }
.data-table .t-sp a {
  color: var(--ok);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  border-bottom: 1px dashed rgba(57, 167, 73, 0.4);
}
.data-table .t-sp a:hover { border-bottom-style: solid; }
.data-table .t-sp .sp-empty { color: var(--ink-dim); font-size: 13px; }

.empty-hint {
  color: var(--ink-dim);
  text-align: center;
  padding: 24px 12px;
  font-size: 14px;
}
