/* ============================================================
   SUNDFÉLAGIÐ ÓÐINN – Sólarhringssund 2026
   Sameiginleg stílsíða
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800;900&family=JetBrains+Mono:wght@400;700;800&display=swap');

/* ===== LITIR / THEME ===== */
:root {
  /* Óðinn litir */
  --blue: #1e5aaa;
  --blue-dark: #153d73;
  --blue-light: #e8f0fe;
  --blue-mid: #3b7dda;
  --red: #cc2936;
  --red-light: #fde8ea;

  /* Ljóst þema (default) */
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #dce3ed;
  --text: #1e293b;
  --text-dim: #64748b;
  --text-light: #94a3b8;

  /* Viðbótar litir */
  --green: #16a34a;
  --green-bg: #dcfce7;
  --gold: #d97706;
  --gold-bg: #fef3c7;
}

/* Dimmt þema (display skjár) */
[data-theme="dark"] {
  --bg: #070e1a;
  --surface: #0f1a2e;
  --surface2: #162240;
  --border: #1e3358;
  --text: #f0f6ff;
  --text-dim: #8ea4c4;
  --text-light: #5a7499;
  --blue-light: rgba(30,90,170,.15);
}

/* ===== GRUNNUR ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: 'JetBrains Mono', monospace; }
.bold { font-weight: 700; }
.center { text-align: center; }
.dim { color: var(--text-dim); }

/* ===== LAYOUT ===== */
.wrap { max-width: 960px; margin: 0 auto; padding: 1rem 1.5rem; }
.wrap-narrow { max-width: 500px; margin: 0 auto; padding: 1.5rem 1rem; }

/* ===== HEADER / NAV ===== */
.site-header {
  background: var(--surface);
  border-bottom: 3px solid var(--blue);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.site-header .logo { height: 48px; width: auto; }
.site-header .title { font-size: 1.3rem; font-weight: 800; }
.site-header .title span { color: var(--red); }
.site-header .right { margin-left: auto; font-size: .82rem; color: var(--text-dim); }

/* ===== CARDS / PANELS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.card-blue { border-left: 4px solid var(--blue); }
.card-red { border-left: 4px solid var(--red); }
.card-gold { border-left: 4px solid var(--gold); }
.card h2 {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--blue);
  margin-bottom: .8rem;
}
.card h2.red { color: var(--red); }
.card h2.gold { color: var(--gold); }

/* ===== STAT BOXES ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .8rem;
  text-align: center;
}
.stat .num { font-family: 'JetBrains Mono', monospace; font-size: 1.8rem; font-weight: 800; color: var(--blue); }
.stat .num.red { color: var(--red); }
.stat .num.gold { color: var(--gold); }
.stat .num.green { color: var(--green); }
.stat .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-top: .15rem; }

/* ===== BUTTONS ===== */
.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  font-size: .88rem;
  padding: .55rem 1.1rem;
}
.btn:active { transform: scale(.96); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-dark); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { opacity: .9; }
.btn-outline { background: transparent; color: var(--blue); border: 2px solid var(--blue); }
.btn-outline:hover { background: var(--blue-light); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { opacity: .9; }
.btn-sm { font-size: .78rem; padding: .35rem .7rem; }
.btn-lg { font-size: 1rem; padding: .7rem 1.5rem; }
.btn-danger { background: var(--red-light); color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

/* ===== FORMS ===== */
.field { margin-bottom: .6rem; }
.field label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  margin-bottom: .2rem;
}
.field input, .field select, .field textarea {
  width: 100%;
  font-family: 'Outfit', sans-serif;
  font-size: .9rem;
  padding: .5rem .7rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.field textarea { min-height: 80px; resize: vertical; font-family: 'JetBrains Mono', monospace; font-size: .82rem; }
select option { background: var(--surface); }
.row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: end; }

/* ===== TABLES ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
.tbl th {
  background: var(--surface2);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  padding: .6rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.tbl td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
.tbl tr:hover td { background: var(--blue-light); }

/* ===== MESSAGES ===== */
.msg { padding: .5rem .8rem; border-radius: 6px; font-size: .82rem; margin-bottom: .6rem; display: none; }
.msg.ok { display: block; background: var(--green-bg); color: var(--green); border: 1px solid #86efac; }
.msg.err { display: block; background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; }

/* ===== HERO (forsíða) ===== */
.hero {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  text-align: center;
  padding: 3rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60'%3E%3Cpath d='M0,30 C200,60 400,0 600,30 C800,60 1000,0 1200,30 L1200,60 L0,60Z' fill='%23f3f6fa'/%3E%3C/svg%3E") repeat-x;
  background-size: 1200px 60px;
}
[data-theme="dark"] .hero::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 60'%3E%3Cpath d='M0,30 C200,60 400,0 600,30 C800,60 1000,0 1200,30 L1200,60 L0,60Z' fill='%23070e1a'/%3E%3C/svg%3E");
}
.hero .logo { height: 70px; width: auto; margin-bottom: .8rem; filter: brightness(0) invert(1); }
.hero h1 { font-size: clamp(2rem, 7vw, 3.5rem); font-weight: 900; line-height: 1.1; margin-bottom: .3rem; }
.hero h1 .accent { color: var(--gold); color: #fbbf24; }
.hero .sub { font-size: clamp(.9rem, 2.5vw, 1.2rem); opacity: .85; font-weight: 300; margin-bottom: 1.5rem; }

/* ===== TIMER ===== */
.timer-box {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  display: inline-block;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(8px);
}
.timer-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; opacity: .8; margin-bottom: .3rem; }
.timer-digits { font-family: 'JetBrains Mono', monospace; font-size: clamp(1.8rem, 6vw, 3rem); font-weight: 700; }
.timer-digits .sep { opacity: .4; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; margin-right: .4rem; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.2 } }

/* ===== DISTANCE (hero) ===== */
.distance-big {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(2.5rem, 9vw, 5rem);
  font-weight: 800;
  color: #fbbf24;
  text-shadow: 0 2px 20px rgba(251,191,36,.3);
  line-height: 1;
}
.distance-label { font-size: 1rem; font-weight: 600; color: rgba(255,255,255,.7); letter-spacing: .1em; text-transform: uppercase; margin-top: .3rem; }
.distance-km { font-size: clamp(1rem, 3vw, 1.5rem); color: rgba(255,255,255,.6); margin-top: .3rem; }

/* ===== PROGRESS BAR ===== */
.progress { max-width: 500px; margin: 1rem auto 0; }
.progress-bar { height: 10px; background: rgba(255,255,255,.15); border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #fbbf24, #f59e0b); transition: width 1s ease; }
.progress-labels { display: flex; justify-content: space-between; font-size: .75rem; opacity: .7; margin-top: .3rem; }

/* ===== INFO GRID ===== */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; }
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.info-card .icon { font-size: 1.6rem; margin-bottom: .3rem; }
.info-card .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.info-card .value { font-size: .95rem; font-weight: 700; margin-top: .15rem; }

/* ===== GROUP CHIPS ===== */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.chip {
  background: var(--blue-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .7rem .8rem;
  text-align: center;
  font-weight: 600;
  font-size: .88rem;
}

/* ===== SWIMMER CARDS (live) ===== */
.swimmer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.swimmer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .7rem;
  text-align: center;
}
.swimmer-card .name { font-weight: 600; font-size: .85rem; }
.swimmer-card .meters { font-family: 'JetBrains Mono', monospace; font-size: .95rem; font-weight: 700; color: var(--blue); margin-top: .2rem; }
.swimmer-card .laps { font-size: .7rem; color: var(--text-dim); }

/* ===== DONATE / COPY BUTTONS ===== */
.donate-section { background: var(--gold-bg); border-radius: 16px; padding: 2rem; text-align: center; }
.donate-section h2 { color: var(--gold); font-size: 1.3rem; font-weight: 800; margin-bottom: .4rem; }
.donate-section p { color: var(--text-dim); font-size: .88rem; }

.copy-btn {
  width: 100%;
  padding: 1rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: .6rem;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.copy-btn:active { transform: scale(.97); }
.copy-btn:hover, .copy-btn:active { border-color: var(--blue); }
.copy-btn.copied { border-color: var(--green); background: var(--green-bg); }
.copy-btn .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.copy-btn .num { font-family: 'JetBrains Mono', monospace; font-size: 1.4rem; font-weight: 700; color: var(--blue); }
.copy-btn .hint { font-size: .72rem; color: var(--text-light); }
.copy-btn.copied .hint { color: var(--green); }
.copy-btn .ripple { position: absolute; border-radius: 50%; background: rgba(30,90,170,.1); transform: scale(0); animation: ripple .6s ease-out; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: 1rem 0; }
.option-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.option-card .icon { font-size: 1.6rem; margin-bottom: .2rem; }
.option-card .title { font-size: .72rem; text-transform: uppercase; color: var(--text-dim); letter-spacing: .05em; }
.option-card .desc { font-size: .88rem; font-weight: 700; color: var(--blue); margin-top: .15rem; }

/* ===== ADMIN: SWIMMER ROWS ===== */
.swimmer-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .7rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: .4rem;
  transition: background .2s, border-color .2s;
}
.swimmer-row.selected {
  background: var(--green-bg);
  border-color: var(--green);
  border-left: 4px solid var(--green);
  box-shadow: 0 0 0 2px rgba(22,163,74,.1);
}
.swimmer-row.selected .name { color: var(--green); }
.swimmer-row .sel-area:hover { color: var(--blue); text-decoration: underline; }
.swimmer-row .name { font-weight: 700; flex: 1; }
.swimmer-row .meters { font-family: 'JetBrains Mono', monospace; color: var(--blue); font-weight: 700; min-width: 70px; text-align: right; }
.swimmer-row .laps-count { font-family: 'JetBrains Mono', monospace; font-size: .75rem; color: var(--text-dim); min-width: 50px; text-align: right; }
.btn-lap { background: var(--blue); color: #fff; min-width: 40px; font-size: .88rem; padding: .4rem .6rem; }
.btn-lap5 { background: var(--blue-mid); color: #fff; font-size: .78rem; padding: .35rem .55rem; }
.btn-minus { background: var(--red-light); color: var(--red); font-size: .78rem; padding: .35rem .55rem; border: 1px solid var(--red); }

/* ===== ADMIN: LOG ===== */
.log { max-height: 200px; overflow-y: auto; font-size: .75rem; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }
.log-entry { padding: .2rem 0; border-bottom: 1px solid var(--border); }

/* ===== FOOTER ===== */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: .75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
.site-footer a { color: var(--text-dim); }

/* ===== DISPLAY SCREEN SPECIFICS ===== */
[data-theme="dark"] body { overflow: hidden; }
.display-scene { width: 100%; height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }

.display-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2vw 2.5vw;
  background: rgba(15,26,46,.8);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--blue);
}
.display-top .logo { height: 5.5vh; width: auto; }
.display-top .title { font-size: clamp(1.1rem, 2.2vw, 1.8rem); font-weight: 800; }
.display-top .title span { color: #fbbf24; }
.display-top .timer { font-family: 'JetBrains Mono', monospace; font-size: clamp(1rem, 1.8vw, 1.5rem); font-weight: 700; color: var(--text-dim); }
.live-badge { display: flex; align-items: center; gap: .4vw; font-size: clamp(.7rem, 1.2vw, .95rem); font-weight: 700; color: #ef4444; background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); padding: .3vw .8vw; border-radius: 5px; }

.display-center { display: flex; align-items: center; justify-content: center; text-align: center; }
.display-dist {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(5rem, 14vw, 11rem);
  font-weight: 800;
  color: #fbbf24;
  text-shadow: 0 0 60px rgba(251,191,36,.2);
  line-height: 1;
}
.display-km { font-family: 'JetBrains Mono', monospace; font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 700; color: var(--text-dim); margin-top: .5vw; }
.display-progress { width: 55vw; max-width: 700px; margin: 1.5vw auto 0; }
.display-progress .progress-bar { height: clamp(10px, 1.2vw, 18px); background: rgba(255,255,255,.06); }
.display-ticker { display: flex; gap: 1.5vw; justify-content: center; flex-wrap: wrap; margin-top: 1.2vw; }
.display-ticker .chip { background: rgba(30,90,170,.15); border: 1px solid rgba(30,90,170,.3); font-size: clamp(.65rem, .9vw, .8rem); padding: .3vw .8vw; color: var(--text); }
.display-ticker .chip .m { font-family: 'JetBrains Mono', monospace; color: #7dd3fc; font-weight: 700; }

.display-bottom {
  display: flex; align-items: center; justify-content: center; gap: 3vw;
  padding: 1.2vw 2.5vw;
  background: rgba(15,26,46,.8);
  backdrop-filter: blur(10px);
  border-top: 2px solid rgba(251,191,36,.3);
}
.display-bottom .qr { width: clamp(55px, 7vh, 90px); height: auto; border-radius: 5px; background: #fff; padding: 3px; }
.display-bottom .qr-text { text-align: left; font-size: clamp(.65rem, 1vw, .85rem); }
.display-bottom .qr-text strong { color: var(--text); }
.display-bottom .donate-block { text-align: center; }
.display-bottom .donate-label { font-size: clamp(.55rem, .85vw, .75rem); text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); }
.display-bottom .donate-value { font-family: 'JetBrains Mono', monospace; font-size: clamp(1rem, 2.2vw, 1.8rem); font-weight: 800; color: #fbbf24; }
.display-divider { width: 1px; height: 5vh; background: rgba(251,191,36,.2); }

/* Rain */
.rain { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.drop { position: absolute; font-size: 2rem; opacity: .08; animation: fall linear infinite; }
@keyframes fall { 0%{ transform: translateY(-60px) rotate(0deg); } 100%{ transform: translateY(110vh) rotate(360deg); } }

/* Glow orbs (display) */
.glow { position: fixed; z-index: 0; border-radius: 50%; filter: blur(80px); opacity: .1; animation: drift 20s ease-in-out infinite; }
@keyframes drift { 0%,100%{transform:translate(0,0)} 50%{transform:translate(30px,-20px)} }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .site-header { padding: .8rem 1rem; gap: .7rem; }
  .site-header .logo { height: 36px; }
  .site-header .title { font-size: 1.05rem; }
  .card { padding: 1rem; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .options-grid { gap: .5rem; }
  .swimmer-row { flex-wrap: wrap; }
}
