/* ============================================================
   Cita Renta 2025 · ASOGRA — Hoja de estilos
   Misma paleta y estructura que servilse.asogra.es
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary:       #c82716;
  --primary-dark:  #a31f12;
  --primary-light: #e85a4d;
  --primary-bg:    #fdf2f1;
  --text:          #5c140f;
  --text-sec:      #8b1a0f;
  --text-muted:    #a82818;
  --white:         #ffffff;
  --gray-100:      #f8f9fa;
  --gray-200:      #e9ecef;
  --gray-300:      #dee2e6;
  --success:       #1a7f3c;
  --success-bg:    #d4edda;
  --warning-bg:    #fff3cd;
  --warning:       #856404;
  --shadow-soft:   0 4px 20px rgba(200,39,22,.14);
  --shadow-card:   0 8px 32px rgba(200,39,22,.11);
  --radius:        18px;
  --radius-sm:     12px;
  --input-h:       56px;
  --focus-ring:    0 0 0 3px rgba(200,39,22,.32);
  --transition:    .2s ease;
}

/* Modo oscuro */
[data-theme="dark"] {
  --primary-bg:  #1a0f0f;
  --text:        #f5e6e4;
  --text-sec:    #f8c9c4;
  --text-muted:  #e8a39d;
  --white:       #2d1515;
  --gray-100:    #3d2020;
  --gray-200:    #4a2525;
  --gray-300:    #5a2f2f;
  --shadow-soft: 0 4px 20px rgba(0,0,0,.35);
  --shadow-card: 0 8px 32px rgba(0,0,0,.45);
}
[data-theme="dark"] body {
  background: linear-gradient(135deg,#1a0f0f 0%,#2d1515 50%,#1a0f0f 100%);
}

/* ── Reset ──────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing:border-box; }

/* Garantiza que [hidden] funcione aunque el elemento tenga display:flex/grid */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 3.5rem 1rem 4rem;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: linear-gradient(135deg,var(--primary-bg) 0%,var(--white) 50%,var(--primary-bg) 100%);
  min-height: 100vh;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* ── Theme toggle ───────────────────────────────────────────── */
.theme-toggle {
  position: fixed; top: 1rem; right: 1rem; z-index: 1000;
  width: 48px; height: 48px; padding: 0;
  border: none; border-radius: 50%;
  background: var(--white); color: var(--text);
  box-shadow: var(--shadow-soft); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
}
.theme-toggle:hover  { transform: scale(1.07); box-shadow: var(--shadow-card); }
.theme-toggle:focus  { outline: none; box-shadow: var(--focus-ring); }
.theme-toggle svg    { width: 22px; height: 22px; }
.theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── Container ──────────────────────────────────────────────── */
.container { max-width: 820px; margin: 0 auto; }

/* ── Header ─────────────────────────────────────────────────── */
.header { text-align: center; margin-bottom: 2.5rem; }

.header__logos {
  display: flex; align-items: center; justify-content: center;
  gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.logo { height: 48px; width: auto; object-fit: contain; }
.logo--asogra { height: 52px; }

.header__badge { margin-bottom: 1rem; }

.badge {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem 1.2rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; letter-spacing: .03em;
}
.badge svg { width: 16px; height: 16px; flex-shrink: 0; }
.badge--renta {
  background: var(--primary); color: #fff;
}

.header__title {
  margin: 0 0 .4rem;
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 700; color: var(--text); line-height: 1.15;
}
.header__subtitle {
  margin: 0; color: var(--text-sec); font-size: 1.05rem;
}

/* ── Alert ──────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: 1rem 1.25rem; border-radius: var(--radius-sm);
  margin-bottom: 1.5rem; font-size: .97rem;
}
.alert svg { width: 22px; height: 22px; flex-shrink: 0; margin-top: .1rem; }
.alert--agotado {
  background: var(--warning-bg); color: var(--warning);
  border: 1.5px solid #ffc107;
}

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.card--datos { padding: 1.5rem 2rem; }

.card__header {
  display: flex; align-items: center; gap: .85rem;
  margin-bottom: 1.5rem;
}
.card__icon {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 12px; background: var(--primary-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.card__icon svg { width: 22px; height: 22px; }
.card__title {
  margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text);
}
.card__info {
  margin: -0.75rem 0 1.25rem;
  font-size: .92rem; color: var(--text-sec);
}

/* ── Form row ───────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media(min-width:600px) { .form-row { grid-template-columns: 1fr 1fr; } }

/* ── Field ──────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .35rem; }

.label {
  font-size: .95rem; font-weight: 600; color: var(--text);
}
.req { color: var(--primary); margin-left: .1rem; }

.input {
  height: var(--input-h);
  padding: 0 1rem;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 1rem;
  color: var(--text); background: var(--gray-100);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  background: var(--white);
}
.input.is-invalid { border-color: var(--primary); }
.input::placeholder { color: var(--text-muted); opacity: .6; }

.field__error {
  font-size: .85rem; color: var(--primary); font-weight: 500;
  min-height: 1.2em;
}
.field__error:empty { display: none; }

/* ── Day selector ───────────────────────────────────────────── */
.day-selector {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .25rem;
}
.day-btn {
  flex: 1; min-width: 110px; max-width: 180px;
  display: flex; flex-direction: column; align-items: center;
  padding: 1.1rem .75rem;
  border: 2.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  cursor: pointer; transition: all var(--transition);
  font-family: inherit;
}
.day-btn:hover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}
.day-btn[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: var(--focus-ring);
}
.day-btn__num {
  font-size: 2.2rem; font-weight: 700;
  color: var(--text); line-height: 1;
}
.day-btn[aria-pressed="true"] .day-btn__num { color: var(--primary); }
.day-btn__mes {
  font-size: .85rem; font-weight: 600; text-transform: uppercase;
  color: var(--primary); letter-spacing: .06em;
}
.day-btn__dia {
  font-size: .8rem; color: var(--text-sec); margin-top: .15rem;
}

/* ── Slots ──────────────────────────────────────────────────── */
.slots-section { margin-top: 1.5rem; }
.slots-section--break { margin-top: .75rem; }

.slots-section__label {
  display: flex; align-items: center; gap: .4rem;
  font-size: .88rem; font-weight: 600; color: var(--text-sec);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: .6rem;
}
.slots-section__label svg { width: 16px; height: 16px; }
.slots-section__label--break {
  color: var(--text-muted); font-style: italic;
  background: var(--gray-100); border-radius: 8px;
  padding: .45rem .75rem; font-size: .83rem;
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: .55rem;
}

.slot-btn {
  padding: .6rem .3rem;
  border: 2px solid var(--gray-300);
  border-radius: 10px;
  background: var(--gray-100);
  font-family: inherit; font-size: .95rem; font-weight: 600;
  color: var(--text); cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.slot-btn:hover:not(:disabled) {
  border-color: var(--primary-light);
  background: var(--primary-bg);
  color: var(--primary);
}
.slot-btn.is-selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: var(--focus-ring);
}
.slot-btn:disabled,
.slot-btn.is-taken {
  border-color: var(--gray-300);
  background: var(--gray-200);
  color: var(--gray-300);
  cursor: not-allowed;
  text-decoration: line-through;
  opacity: .55;
}

/* ── Loading ────────────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; gap: .75rem;
  color: var(--text-sec); font-size: .95rem; padding: 1rem 0;
}
.spinner {
  width: 22px; height: 22px; flex-shrink: 0;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner--white {
  border-color: rgba(255,255,255,.3);
  border-top-color: #fff;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Radio cards ────────────────────────────────────────────── */
.radio-cards {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem;
  align-items: stretch;
}
.radio-card { flex: 1; min-width: 150px; cursor: pointer; display: flex; }
.radio-card__input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-card__inner {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5rem; padding: 1.25rem 1rem; width: 100%;
  border: 2.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  transition: all var(--transition);
  font-weight: 600; color: var(--text); text-align: center;
}
.radio-card__inner svg { width: 28px; height: 28px; }
label[for="dos_acompanantes"] .radio-card__inner svg { width: 35px; height: 28px; }
.radio-card:hover .radio-card__inner {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}
.radio-card__input:checked + .radio-card__inner {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
  box-shadow: var(--focus-ring);
}
.radio-card__input:focus-visible + .radio-card__inner {
  box-shadow: var(--focus-ring);
}

/* ── Checkbox ───────────────────────────────────────────────── */
.checkbox-label {
  display: flex; align-items: flex-start; gap: .85rem; cursor: pointer;
}
.checkbox-label__input {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.checkbox-label__box {
  flex-shrink: 0; width: 24px; height: 24px; margin-top: .15rem;
  border: 2.5px solid var(--gray-300);
  border-radius: 6px; background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.checkbox-label__input:checked + .checkbox-label__box {
  background: var(--primary); border-color: var(--primary);
}
.checkbox-label__input:checked + .checkbox-label__box::after {
  content: '';
  width: 6px; height: 11px;
  border: 2.5px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg) translate(-1px,-1px);
  display: block;
}
.checkbox-label__input:focus-visible + .checkbox-label__box {
  box-shadow: var(--focus-ring);
}
.checkbox-label:hover .checkbox-label__box { border-color: var(--primary-light); }
.checkbox-label__text { font-size: .97rem; line-height: 1.5; }

/* ── Submit button ──────────────────────────────────────────── */
.btn-submit {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 1.1rem 2rem;
  border: none; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
  font-family: inherit; font-size: 1.15rem; font-weight: 700;
  cursor: pointer; transition: background var(--transition), transform var(--transition),
    box-shadow var(--transition);
  box-shadow: 0 6px 20px rgba(200,39,22,.35);
  margin-top: .5rem;
}
.btn-submit:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(200,39,22,.4);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { opacity: .65; cursor: not-allowed; transform: none; }
.btn-submit__text,
.btn-submit__loading { display: flex; align-items: center; gap: .6rem; }
.btn-submit__text svg { width: 22px; height: 22px; }

/* ── Confirm card ───────────────────────────────────────────── */
.confirm-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 3rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
}
.confirm-card__icon {
  width: 72px; height: 72px; margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: var(--success-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--success);
}
.confirm-card__icon svg { width: 36px; height: 36px; }
.confirm-card__title {
  margin: 0 0 .75rem; font-size: 1.6rem; color: var(--text);
}
.confirm-card__text {
  margin: 0 0 1.25rem; color: var(--text-sec); font-size: 1.05rem;
  line-height: 1.7;
}
.confirm-card__detail {
  display: inline-block;
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  font-size: .97rem; color: var(--text);
  text-align: left; line-height: 1.8;
  border-left: 4px solid var(--primary);
}

/* ── Botón nueva solicitud ──────────────────────────────────── */
.btn-nueva {
  display: inline-flex; align-items: center; gap: .5rem;
  margin-top: 1.5rem;
  padding: .85rem 2rem;
  border: 2.5px solid var(--primary); border-radius: var(--radius-sm);
  background: transparent; color: var(--primary);
  font-family: inherit; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: all var(--transition);
}
.btn-nueva svg { width: 20px; height: 20px; }
.btn-nueva:hover {
  background: var(--primary); color: #fff;
  transform: translateY(-1px);
}

/* ── Footer logos ───────────────────────────────────────────── */
.footer-logos {
  display: flex; align-items: center; justify-content: center;
  gap: 2rem; flex-wrap: wrap;
  margin: 2rem 0 2rem;
  padding: 1rem;
}
.footer-logos a,
.footer-logos span   { display: inline-flex; align-items: center; }
.footer-logos img    { display: block; width: auto; object-fit: contain; }
.footer-logos__asogra img { height: 80px;  max-width: 240px; }
.footer-logos__junta  img { height: 72px;  max-width: 280px; }
.footer-logos__irpf   img { height: 72px;  max-width: 200px; }

/* ── Responsive fixes ───────────────────────────────────────── */
@media(max-width:480px) {
  .card { padding: 1.5rem 1.1rem; }
  .header__title { font-size: 1.8rem; }
  .day-btn { min-width: 90px; }
  .slots-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
}
