/* ═══════════════════════════════════════════════════════════════
   Finland Trophy Retro – Race Registration Plugin Styles
   Eristetty Divin tyyleistä rr- etuliitteellä
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset / eristys ─────────────────────────────────────────── */
.rr-wrap *,
.rr-wrap *::before,
.rr-wrap *::after {
  box-sizing: border-box;
}

.rr-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a1a;
  max-width: 720px;
  margin: 0 auto;
}

/* ── Otsikko ─────────────────────────────────────────────────── */
.rr-form-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: #1a1a1a;
}

/* ── Fieldset ────────────────────────────────────────────────── */
.rr-fieldset {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.rr-legend {
  font-size: 14px;
  font-weight: 600;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 6px;
}

/* ── Kentät ──────────────────────────────────────────────────── */
.rr-field {
  margin-bottom: 1rem;
}

.rr-field:last-child {
  margin-bottom: 0;
}

.rr-field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 5px;
}

.rr-field input[type="text"],
.rr-field input[type="email"],
.rr-field input[type="tel"],
.rr-field input[type="number"],
.rr-field select,
.rr-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 15px;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.rr-field input[type="text"]:focus,
.rr-field input[type="email"]:focus,
.rr-field input[type="tel"]:focus,
.rr-field input[type="number"]:focus,
.rr-field select:focus,
.rr-field textarea:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

.rr-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M6 8L0 0h12z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Kaksi kenttää rinnakkain */
.rr-fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .rr-fields-row {
    grid-template-columns: 1fr;
  }
}

/* ── Checkbox ────────────────────────────────────────────────── */
.rr-field--checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 400;
}

.rr-field--checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Apukuljettajat ──────────────────────────────────────────── */
.rr-codriver-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rr-codriver-row input {
  flex: 1;
}

/* ── Lisäpaidat ──────────────────────────────────────────────── */
.rr-extra-shirt-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.rr-extra-shirt-row select {
  flex: 1;
  width: auto;
}

/* ── Poisto/lisäysnapit ──────────────────────────────────────── */
.rr-btn-remove-codriver,
.rr-btn-remove-shirt {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: #888;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}

.rr-btn-remove-codriver:hover,
.rr-btn-remove-shirt:hover {
  color: #c0392b;
  border-color: #c0392b;
}

.rr-btn-add {
  background: none;
  border: none;
  color: #1a73e8;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}

.rr-btn-add:hover {
  text-decoration: underline;
}

/* ── Laskurit ────────────────────────────────────────────────── */
.rr-counter-row {
  display: flex;
  align-items: center;
  gap: 0;
  width: fit-content;
}

.rr-counter-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #ccc;
  background: #f8f8f8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #333;
  transition: background 0.15s;
}

.rr-counter-btn:first-child {
  border-radius: 5px 0 0 5px;
}

.rr-counter-btn:last-child {
  border-radius: 0 5px 5px 0;
}

.rr-counter-btn:hover {
  background: #e8e8e8;
}

.rr-counter-input {
  width: 52px !important;
  text-align: center;
  border-radius: 0 !important;
  border-left: none !important;
  border-right: none !important;
}

/* ── Merkkimäärälaskuri ──────────────────────────────────────── */
.rr-char-counter {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 4px;
  text-align: right;
}

/* ── Hinnat ja vihjeet ───────────────────────────────────────── */
.rr-req { color: #c0392b; }

.rr-optional {
  font-size: 12px;
  font-weight: 400;
  color: #888;
}

.rr-hint {
  display: block;
  font-size: 12px;
  color: #666;
  margin-top: 3px;
}

.rr-price-hint {
  font-size: 12px;
  color: #888;
  font-weight: 400;
  margin-left: 4px;
}

/* ── Hintayhteenveto ─────────────────────────────────────────── */
.rr-summary {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}

.rr-summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 3px 0;
  color: #555;
}

.rr-summary-total {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px solid #ddd;
  color: #1a1a1a;
}

/* ── Lähetysnappi ────────────────────────────────────────────── */
.rr-submit-wrap {
  text-align: center;
  padding: 0.5rem 0;
}

.rr-btn-submit {
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 36px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.rr-btn-submit:hover {
  background: #333;
}

.rr-btn-submit--secondary {
  background: #1a73e8;
}

.rr-btn-submit--secondary:hover {
  background: #1558b0;
}

/* ── Virheilmoitukset ────────────────────────────────────────── */
.rr-errors {
  background: #fdf0f0;
  border: 1px solid #e74c3c;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 1.25rem;
  color: #c0392b;
  font-size: 14px;
}

.rr-errors ul {
  margin: 8px 0 0 1rem;
  padding: 0;
}

.rr-errors li {
  margin-bottom: 4px;
}

/* ── Ilmoitukset ─────────────────────────────────────────────── */
.rr-notice {
  background: #fff8e1;
  border: 1px solid #f9a825;
  border-radius: 6px;
  padding: 12px 16px;
}

.rr-notice--closed {
  background: #f5f5f5;
  border-color: #bbb;
  color: #666;
}

.rr-notice--error {
  background: #fdf0f0;
  border-color: #e74c3c;
  color: #c0392b;
}

/* ── Onnistumisviesti ────────────────────────────────────────── */
.rr-success {
  text-align: center;
  padding: 2rem 1rem;
}

.rr-success-icon {
  width: 60px;
  height: 60px;
  background: #27ae60;
  color: #fff;
  border-radius: 50%;
  font-size: 28px;
  line-height: 60px;
  margin: 0 auto 1rem;
}

.rr-success h2 {
  font-size: 22px;
  margin-bottom: 0.5rem;
}

.rr-success-details {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  margin: 1.25rem auto;
  max-width: 360px;
  text-align: left;
}

.rr-success-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.rr-success-row:last-child {
  border-bottom: none;
}

.rr-success-note {
  font-size: 13px;
  color: #666;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Osallistujan dashboard ──────────────────────────────────── */
.rr-dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.rr-btn-logout {
  font-size: 13px;
  color: #888;
  text-decoration: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px 12px;
}

.rr-btn-logout:hover {
  color: #333;
  border-color: #bbb;
}

.rr-dash-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.rr-dash-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.rr-dash-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.rr-dash-row:last-child {
  border-bottom: none;
}

.rr-dash-row > span:first-child {
  color: #666;
  flex-shrink: 0;
}

.rr-dash-row--highlight {
  background: #f8f9fa;
  margin: -1.25rem -1.25rem 0;
  padding: 10px 1.25rem;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
}

.rr-badge {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.rr-badge--paid {
  background: #e8f5e9;
  color: #2e7d32;
}

.rr-badge--unpaid {
  background: #fff8e1;
  color: #f57f17;
}

/* ── Admin-hallintapaneeli ────────────────────────────────────── */
.rr-admin-wrap .rr-settings-section {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.rr-admin-wrap .rr-settings-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

/* ── Tiedostokenttä ──────────────────────────────────────────── */
.rr-field input[type="file"] {
  padding: 6px 0;
  border: none;
  font-size: 14px;
}

/* ── PIN-kirjautuminen ───────────────────────────────────────── */
.rr-participant-login {
  max-width: 420px;
}

.rr-pin-form .rr-btn-submit {
  width: 100%;
}

/* ── Ladataan-tila ───────────────────────────────────────────── */
.rr-loading {
  color: #888;
  font-size: 14px;
  padding: 1rem 0;
}

/* ── Responsiivisuus ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .rr-wrap {
    font-size: 14px;
  }

  .rr-fieldset {
    padding: 1rem;
  }

  .rr-dash-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
}

/* ── Modaali ─────────────────────────────────────────────────── */
#rr-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99999;
  overflow-y: auto;
  padding: 20px;
}

#rr-modal {
  background: #fff;
  border-radius: 8px;
  max-width: 720px;
  width: 100%;
  margin: 40px auto;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

@media (max-width: 600px) {
  #rr-modal-overlay { padding: 0; }
  #rr-modal { margin: 0; border-radius: 0; min-height: 100vh; }
}

/* Tiimilinkki taulukossa */
.rr-team-link {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 500;
}
.rr-team-link:hover {
  text-decoration: underline;
}
