/* === competition_app.css ===
   NVSF Competition App v3 styling
*/

/* --- Base layout --- */
html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Roboto, system-ui, sans-serif;
  background: #f5f7fa;
  color: #222;
}

#competition-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 4rem;
  min-height: 100vh;
  box-sizing: border-box;
}

.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  padding: 1.8rem;
  width: 100%;
  max-width: 550px;
  animation: fadeIn 0.3s ease;
}

/* --- Setup wizard --- */
.competition-setup h2 {
  margin-top: 0;
  color: #004aad;
}

.form-group {
  margin-bottom: 1rem;
  text-align: left;
  width: 100%;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

select,
input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  font-size: 1rem;
  padding: 0.6rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}

textarea {
  resize: vertical;
}

/* --- Buttons --- */
.ms-btn {
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.2rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ms-btn.primary {
  background: #007bff;
  color: #fff;
}
.ms-btn.primary:hover { background: #005dc1; }

.ms-btn.success {
  background: #28a745;
  color: #fff;
}
.ms-btn.success:hover { background: #218838; }

.ms-btn.danger {
  background: #dc3545;
  color: #fff;
}
.ms-btn.danger:hover { background: #c82333; }

.ms-btn.outline {
  background: #fff;
  border: 1px solid #007bff;
  color: #007bff;
}
.ms-btn.outline:hover { background: #e8f2ff; }

.ms-btn.small {
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
}

/* --- Active competition --- */
.next-player {
  text-align: center;
  margin-top: 1rem;
}
.player-name {
  font-size: 1.4rem;
  font-weight: 700;
  background: #e7f1ff;
  padding: 0.4rem 1rem;
  border-radius: 12px;
  display: inline-block;
  margin-top: 0.4rem;
}
.player-name.highlight {
  background: #d1f7d6;
  border: 1px solid #96e79b;
  color: #155724;
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.player-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  width: 100%;
}
.player-list li {
  background: #f9f9fb;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.5rem;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.player-list li.active {
  background: #e6f7ed;
  border: 1px solid #93e2ac;
}
.player-list strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

/* --- Time chips --- */
.times {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.time-chip {
  background: #e1ecff;
  border: none;
  border-radius: 12px;
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.time-chip:hover {
  background: #cde0ff;
  transform: scale(1.05);
}

/* --- Result table --- */
.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}
.result-table th,
.result-table td {
  border-bottom: 1px solid #eef2f7;
  padding: 0.55rem 0.6rem;
  text-align: left;
}
.result-table th {
  background: #007bff;
  color: #fff;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.result-table th::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255,255,255,0.6);
  transform: translateY(-30%);
  opacity: 0.5;
}
.result-table th:hover::after {
  opacity: 1;
}
.result-table tr:hover td {
  background: #f1f7ff;
}

/* --- Chart and explain --- */
canvas#resultChart {
  width: 100%;
  max-width: 600px;
  margin: 1.5rem auto;
  display: block;
}

.explain {
  background: #f8fafc;
  border-radius: 10px;
  padding: 1rem;
  font-size: 0.9rem;
  color: #333;
}
.explain ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}
.explain li {
  margin-bottom: 0.3rem;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .card { padding: 1.3rem; }
  .player-name { font-size: 1.2rem; }
  .time-chip { font-size: 0.85rem; }
  .result-table th, .result-table td {
    font-size: 0.85rem;
    padding: 0.4rem;
  }
}

.sklie-stats-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}
.sklie-stats-card {
  background: #f9faff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  padding: 1rem 1.2rem;
}
.sklie-stats-card h3 {
  margin: 0 0 0.4rem;
  color: #004aad;
}
.sklie-stats-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
}
.sklie-stats-card li {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}
.sklie-stats-card .medals {
  display: flex;
  gap: 1rem;
  font-size: 1rem;
  margin-bottom: 0.6rem;
}
.result-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:0.6rem;
}
.copy-msg {
  margin-left:0.5rem;
  font-size:0.85rem;
  color:#007bff;
}

.sklie-stats-wrapper {
  display:flex;
  flex-direction:column;
  gap:1rem;
  margin-top:1.5rem;
}
.sklie-stats-card {
  background:#f9faff;
  border-radius:14px;
  box-shadow:0 2px 10px rgba(0,0,0,0.05);
  padding:1rem 1.2rem;
}
.sklie-stats-card h3 {
  margin:0 0 0.4rem;
  color:#004aad;
}
.sklie-stats-card ul {
  list-style:none;
  margin:0;
  padding:0;
  columns:2;
}
.sklie-stats-card li {
  font-size:0.9rem;
  margin-bottom:0.25rem;
}
.sklie-stats-card .medals {
  display:flex;
  flex-wrap:wrap;
  gap:0.6rem 1rem;
  font-size:1.1rem;
  margin-bottom:0.6rem;
}
.sklie-stats-card .medals span {
  padding:0.25rem 0.6rem;
  border-radius:8px;
  background:#fff;
  box-shadow:0 1px 3px rgba(0,0,0,0.08);
}


.header-line {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:0.6rem;
}
.subtitle {
  text-align:center;
  font-weight:600;
  margin:0.5rem 0 1.2rem;
}
.ms-input {
  width:100%;
  padding:0.6rem;
  border:1px solid #ccc;
  border-radius:8px;
  font-size:1rem;
  box-sizing:border-box;
}

/* medalje-farger */
.sklie-stats-card.gold    {box-shadow:0 0 10px 2px rgba(255,215,0,0.5);}
.sklie-stats-card.silver  {box-shadow:0 0 10px 2px rgba(192,192,192,0.5);}
.sklie-stats-card.bronze  {box-shadow:0 0 10px 2px rgba(205,127,50,0.5);}
.medals span.gold    {background:linear-gradient(90deg,#ffd700,#fff5b0);}
.medals span.silver  {background:linear-gradient(90deg,#c0c0c0,#f2f2f2);}
.medals span.bronze  {background:linear-gradient(90deg,#cd7f32,#ffe5c0);}
.medals span.none    {background:#fff;}


/* Glød rundt kortet for totalvinner-plassering */
.sklie-stats-card.gold   { box-shadow: 0 0 12px 3px rgba(255,215,0,0.6); }
.sklie-stats-card.silver { box-shadow: 0 0 12px 3px rgba(192,192,192,0.6); }
.sklie-stats-card.bronze { box-shadow: 0 0 12px 3px rgba(205,127,50,0.6); }

/* Medaljebokser – farges kun hvis du faktisk vant */
.medals span {
  display:inline-block;
  padding:0.25rem 0.6rem;
  border-radius:8px;
  background:#fff;
  box-shadow:0 1px 3px rgba(0,0,0,0.08);
}
.medals span.gold   { background:linear-gradient(90deg,#ffd700,#fff5b0); }
.medals span.silver { background:linear-gradient(90deg,#c0c0c0,#f2f2f2); }
.medals span.bronze { background:linear-gradient(90deg,#cd7f32,#ffe5c0); }
.runs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px 0;
}

.run-pill {
  background: #f1f3f5;
  border-radius: 10px;
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #333;
  border: 1px solid #d0d4d8;
  user-select: none;
  transition: background 0.15s ease;
}

.run-pill:hover {
  background: #e6e9ed;
}
.chart-explainer {
  margin-top: 1.2rem;
  background: #f8f9fb;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  font-size: 0.9rem;
  color: #333;
}

.chart-explainer h4 {
  margin: 0 0 0.6rem 0;
  font-size: 1.05rem;
  color: #007bff;
}

.chart-explainer ul {
  margin: 0;
  padding-left: 1.2rem;
}

.chart-explainer li {
  margin-bottom: 0.35rem;
}

.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1.5rem;
  margin: 1.2rem 0 2rem 0;
  height: 120px;
}

.podium-spot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 90px;
  text-align: center;
  font-weight: 600;
  color: #333;
}

.podium-spot .medal {
  font-size: 1.8rem;
}

.podium-spot .name {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px; /* begrenser bredden før "..." vises */
  text-align: center;
}

.podium-spot.first {
  height: 120px;
  background: linear-gradient(to top, gold 40%, #fff8b3);
  border-radius: 6px 6px 0 0;
  padding: 0.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.podium-spot.second {
  height: 90px;
  background: linear-gradient(to top, silver 40%, #f0f0f0);
  border-radius: 6px 6px 0 0;
  padding: 0.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.podium-spot.third {
  height: 70px;
  background: linear-gradient(to top, #cd7f32 40%, #f7d6b5);
  border-radius: 6px 6px 0 0;
  padding: 0.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.8rem;
  margin: 1.2rem 0;
}

.podium-spot {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.podium-spot.first { height: 130px; }
.podium-spot.second { height: 100px; }
.podium-spot.third { height: 80px; }

.podium-spot.double {
  height: 120px;
}

.podium-spot .medal {
  font-size: 1.8rem;
}

.podium-spot .name {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
  text-align: center;
}

