@import url("/fonts/fonts.css");

/* Dark theme by default. Tokens keep their original brand names (--paper,
   --ink, --wine...) but are repurposed for a dark surface — see
   docs/decision_log.md for the rationale. --wine/--brass-deep are reused as
   the primary gold accent (Latón claro, #D9AA3E) since the official Vino
   isn't AA-safe as text on a near-black background; Vino itself moves to
   --surface (card backgrounds), matching the manual's own permitted
   "Papel sobre Vino" combination (12.1:1, AAA) inverted for dark mode. */
:root {
  --paper: #17111A;       /* page background */
  --surface: #2A1D28;     /* card / input background (a lifted Vino) */
  --surface-hover: #34232F;
  --ink: #F3E9E4;         /* primary text */
  --wine: #D9AA3E;        /* headings + primary accent (Latón claro) */
  --brass: #A8801F;       /* decorative borders (official Latón, unchanged) */
  --brass-deep: #D9AA3E;  /* links — same gold as headings */
  --wolf: #B7ADA5;        /* secondary/muted text */
  --line: rgba(255, 255, 255, 0.14);
  --berry: #C13FA8;       /* focus ring / interactive accent, brightened for dark bg */
  --success: #6FCF7A;
  --error: #FF7A7A;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28), 0 1px 1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.36), 0 2px 6px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Hanken Grotesk", Arimo, Arial, Helvetica, sans-serif;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.card {
  background: rgba(42, 29, 40, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

h1 {
  font-family: "Fraunces", "Noto Serif", Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-size: 1.65rem;
  color: var(--wine);
  margin: 0 0 12px;
}
h2 {
  font-family: "Fraunces", "Noto Serif", Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-size: 1.2rem;
  color: var(--wine);
  margin: 0 0 12px;
}
p { margin: 0 0 12px; }

.steps {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--wine);
  transition: width 0.25s ease;
}

.progress-label {
  font-size: 0.85rem;
  color: var(--wolf);
  white-space: nowrap;
  font-weight: 500;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin: 14px 0 5px;
  color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  /* Native <select> ignores `color` on its closed-state option list in some
     browsers unless options are styled too — Chromium/Firefox respect this
     on the <select> itself for the closed state, which is what matters here. */
  color-scheme: dark;
}
select option {
  background: var(--surface);
  color: var(--ink);
}

input::placeholder { color: var(--wolf); opacity: 0.8; }
input:hover { border-color: rgba(255, 255, 255, 0.26); }

input:focus, button:focus-visible, .option:focus-visible, .country-option:focus {
  outline: none;
  border-color: var(--berry);
  box-shadow: 0 0 0 3px rgba(193, 63, 168, 0.28);
}
button:focus-visible {
  box-shadow: 0 0 0 3px rgba(193, 63, 168, 0.4);
}

.field-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 4px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0;
}
.checkbox-row input { margin-top: 4px; accent-color: var(--wine); }
.checkbox-row label { font-weight: 400; margin: 0; }

button {
  font-size: 0.98rem;
  font-weight: 600;
  font-family: inherit;
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}
button:active:not(:disabled) { transform: translateY(1px); }

.btn-primary {
  background: var(--wine);
  color: var(--paper);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { box-shadow: var(--shadow-md); }
.btn-primary:disabled { background: #453842; color: #837680; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  background: transparent;
  color: var(--wine);
  border: 1px solid var(--wine);
}
.btn-secondary:hover:not(:disabled) { background: rgba(217, 170, 62, 0.1); }
.btn-secondary:disabled {
  color: #756a72;
  border-color: rgba(255, 255, 255, 0.14);
  cursor: not-allowed;
  background: none;
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.option:hover { border-color: var(--brass); }
.option[aria-pressed="true"] {
  background: var(--wine);
  color: var(--paper);
  border-color: var(--wine);
}
.option .option-number {
  font-weight: 700;
  min-width: 1.5em;
}

.summary-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.summary-item:last-child { border-bottom: none; }
.edit-link {
  background: none;
  border: none;
  color: var(--brass-deep);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-weight: 600;
  font-family: inherit;
}

.deadline-note {
  background: rgba(168, 128, 31, 0.14);
  border: 1px solid var(--brass);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.95rem;
}

a { color: var(--brass-deep); }

/* -- Phone / country selector --------------------------------------------- */

.phone-field {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 480px) {
  .phone-field { grid-template-columns: 170px 1fr; }
}

.country-select {
  position: relative;
}
.country-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  text-align: left;
}
.country-select-trigger:hover { border-color: rgba(255, 255, 255, 0.26); }
.country-select-trigger .flag { border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14); flex-shrink: 0; }
.country-select-trigger .dial { color: var(--wolf); margin-left: auto; font-size: 0.9rem; }

.country-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #2E2030;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  max-height: 260px;
  overflow-y: auto;
  z-index: 20;
  padding: 6px;
}
.country-search-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.95rem;
  font-family: inherit;
  margin-bottom: 6px;
}
.country-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
}
.country-option .flag { border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14); flex-shrink: 0; }
.country-option .dial { margin-left: auto; color: var(--wolf); font-size: 0.85rem; }
.country-option:hover, .country-option.active {
  background: rgba(217, 170, 62, 0.14);
}
.country-empty {
  padding: 10px;
  color: var(--wolf);
  font-size: 0.9rem;
}
.country-divider {
  border-top: 1px dashed var(--line);
  margin: 6px 4px;
}

/* -- Password visibility toggle -------------------------------------------- */

.password-field {
  position: relative;
}
.password-field input { padding-right: 44px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--wolf);
  display: flex;
  border-radius: 8px;
}
.password-toggle:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
.password-toggle svg { width: 20px; height: 20px; }

@media (min-width: 640px) {
  #app { padding-top: 48px; }
}
