/* PeluquIA — turnero público. Sistema papel y oro (guía v2).
 * Fuente única: DESIGN.md en la raíz. Los nombres de variable son los del sistema anterior;
 * manda el valor, no el nombre.
 */
:root {
  --orange: #E82078;        /* fucsia: SOLO la acción */
  --orange-solid: #DA1E71;  /* el mismo fucsia como relleno bajo texto blanco: el #E82078 se
                               queda en 4,28:1 con blanco y este llega a 4,77:1 */
  --orange-dark: #BE1F66;   /* fucsia oscurecido, solo hover */
  --orange-light: #F5EBE1;  /* crema */
  --cream: #FBF3ED;         /* papel */
  --cream-dark: #F5EBE1;    /* crema */
  --ink: #2B0D22;           /* ciruela */
  --ink-light: #4A4340;     /* gris cálido */
  --white: #FFFFFF;
  --border: #E2D7D4;        /* ciruela al 12% sobre papel */
  --gold: #D4A24C;          /* oro: etiquetas y filetes */
  --rosa-polvo: #C98F86;
  /* Estados funcionales (extensión documentada en DESIGN.md) */
  --green: #2F6B3D;
  --green-light: #E7F0E6;
  --red: #9E1B45;
  --red-light: #FBE9EE;
  --warn: #8A6318;
  --warn-light: #F7EEDC;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(43, 13, 34, 0.06), 0 1px 2px rgba(43, 13, 34, 0.04);
  --shadow-md: 0 8px 24px rgba(43, 13, 34, 0.1);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 200ms ease;

  /* alias usados por reglas del calendario */
  --primary-color: var(--orange);
  --secondary-color: var(--orange-dark);
  --bg-color: var(--cream);
  --text-main: var(--ink);
  --text-muted: var(--ink-light);
  --border-color: var(--border);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-dark) 100%);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.page-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px 48px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.brand-bar {
  max-width: 900px;
  margin: 0 auto 20px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

/* La «IA» va en oro, como en el logotipo. El fucsia queda reservado a la acción. */
.brand-wordmark span {
  color: var(--gold);
}

.container {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.salon-header {
  text-align: center;
  margin-bottom: 2rem;
}

.salon-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.salon-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--white);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.salon-brand-text {
  min-width: 0;
}

.salon-header h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.salon-header p {
  margin: 0;
  color: var(--ink-light);
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
}

label {
  margin-bottom: 0.45rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
}

.field-hint {
  margin: -0.15rem 0 0.55rem;
  font-size: 0.8rem;
  color: var(--ink-light);
}

.service-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 420px;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.service-checklist[aria-disabled="true"] {
  opacity: 0.65;
  background: var(--cream);
}

.service-checklist-empty {
  margin: 0;
  font-size: 0.875rem;
}

.service-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  line-height: 1.35;
}

.service-check input {
  margin-top: 0.2rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--orange);
  flex-shrink: 0;
}

.service-check-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.service-check-row {
  display: block;
}

.service-check-name {
  display: inline;
}

.service-check-meta {
  display: inline;
  color: var(--ink-light);
  font-weight: 400;
  font-size: 0.85rem;
}

.service-check-desc {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-light);
  line-height: 1.35;
}

select,
input,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-light);
}

select:disabled,
input:disabled {
  background-color: var(--cream-dark);
  cursor: not-allowed;
  color: var(--ink-light);
}

.slots-container {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
}

.placeholder-text {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-light);
  font-size: 0.925rem;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

#bookingForm {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.selected-slot-text {
  color: var(--ink-light);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.slot-professionals {
  margin: 0 0 0.5rem;
}

.slot-professionals-label {
  color: var(--ink);
  font-size: 0.925rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.slot-professionals-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pro-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
}

.pro-check:hover {
  border-color: var(--gold);
  background: var(--cream);
}

.pro-check:has(input:checked) {
  border-color: var(--orange);
  background: var(--orange-light);
}

.pro-check input {
  accent-color: var(--orange);
  width: 1.1rem;
  height: 1.1rem;
}

.primary-btn {
  background: var(--orange-solid);
  color: white;
  padding: 0.95rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  min-height: 44px;
  touch-action: manipulation;
}

.primary-btn:hover:not(:disabled) {
  background: var(--orange-dark);
}

.primary-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.secondary-btn {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  min-height: 44px;
}

.secondary-btn:hover {
  background: var(--cream);
  border-color: var(--orange);
  color: var(--orange-dark);
}

.success-box {
  text-align: center;
  padding: 2.5rem 1rem;
}

.success-box h2 {
  font-family: var(--font-display);
  color: var(--green);
  margin-bottom: 0.5rem;
}

.error-box {
  text-align: center;
  padding: 2rem;
  background: var(--red-light);
  border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
  border-radius: var(--radius);
  color: var(--red);
  margin-bottom: 1.5rem;
}

.error-box h2 {
  font-family: var(--font-display);
  margin-bottom: 0.5rem;
}

.modal {
  display: flex !important;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background-color: rgba(43, 13, 34, 0.55);
  justify-content: center;
  align-items: flex-end;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  background: var(--white);
  padding: 28px 20px 16px;
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  position: relative;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.modal-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

#bookBtn {
  flex-shrink: 0;
  margin-top: 0.75rem;
}

.modal-content h3 {
  font-family: var(--font-display);
  margin-bottom: 0.5rem;
}

.close-btn {
  color: var(--ink-light);
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: var(--ink);
}

#calendar-container {
  width: 100%;
  min-height: 360px;
  background: var(--white);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* FullCalendar — tema PeluquIA */
.fc {
  font-family: var(--font-body);
  --fc-border-color: var(--border);
  /* Pasar de mes es navegación, no la acción de la página: va en crema y ciruela, igual que
     el conmutador de vistas del panel. El fucsia se reserva para confirmar la reserva. */
  --fc-button-bg-color: var(--cream-dark);
  --fc-button-border-color: color-mix(in srgb, var(--ink) 18%, transparent);
  --fc-button-text-color: var(--ink);
  --fc-button-hover-bg-color: color-mix(in srgb, var(--ink) 12%, var(--cream-dark));
  --fc-button-hover-border-color: color-mix(in srgb, var(--ink) 28%, transparent);
  --fc-button-active-bg-color: var(--ink);
  --fc-button-active-border-color: var(--ink);
  --fc-today-bg-color: var(--orange-light);
}

/* FullCalendar aplica --fc-button-text-color a todos los estados; el botón pulsado va sobre
   ciruela y necesita el texto en papel. */
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  color: var(--cream);
}

.fc .fc-toolbar-title {
  font-family: var(--font-display);
  font-size: 1.15rem !important;
  color: var(--ink);
}

.fc-day-selected {
  background-color: var(--orange-solid) !important;
}

.fc-day-selected .fc-daygrid-day-number {
  color: white !important;
}

.fc-holiday-bg {
  pointer-events: none;
}

/* Un festivo es un aviso, no un error: mismo oro oscurecido que usa el panel. */
.fc-daygrid-day.fc-day-holiday {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(138, 99, 24, 0.06) 0px,
    rgba(138, 99, 24, 0.06) 6px,
    rgba(138, 99, 24, 0.12) 6px,
    rgba(138, 99, 24, 0.12) 12px
  );
  cursor: not-allowed !important;
}

.fc-daygrid-day.fc-day-holiday .fc-holiday-label {
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  padding: 2px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-light);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

.layout-calcom {
  display: flex;
  gap: 2rem;
  margin-top: 1.75rem;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
}

.calendar-column {
  flex: 1.2;
  min-width: 0;
  max-width: 100%;
}

.time-slots-column {
  flex: 1;
  min-width: 0;
  max-width: 320px;
  border-left: 1px solid var(--border);
  padding-left: 1.75rem;
  display: flex;
  flex-direction: column;
}

#selectedDateTitle {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.slots-container.vertical-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  max-height: 380px;
  padding-right: 6px;
}

.time-slot-btn {
  background: var(--white);
  border: 1px solid var(--orange);
  color: var(--orange-dark);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  transition: all var(--transition);
  width: 100%;
  min-height: 44px;
  touch-action: manipulation;
}

.time-slot-btn:hover {
  background: var(--orange-solid);
  color: white;
}

.fc-highlight {
  background: transparent !important;
}

.fc-daygrid-day,
.fc-daygrid-day-frame,
.fc-daygrid-day-number,
.fc-button {
  touch-action: manipulation;
}

/* En el móvil FullCalendar mete el mes en un scroller de ~160px y deja
   el resto escondido. Con la altura en auto el mes entero entra en la página. */
.fc .fc-view-harness {
  height: auto !important;
}

.fc .fc-scroller-harness-liquid {
  overflow: visible !important;
}

.fc .fc-scroller-liquid-absolute {
  position: relative !important;
  height: auto !important;
  overflow: visible !important;
}

.fc .fc-scrollgrid,
.fc .fc-daygrid-body,
.fc .fc-scrollgrid-sync-table {
  width: 100% !important;
}

@media (max-width: 768px) {
  .page-shell {
    padding: 12px 10px 32px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }

  .brand-bar {
    margin-bottom: 12px;
  }

  .container {
    padding: 1.1rem 0.9rem 1.25rem;
    border-radius: var(--radius-sm);
  }

  .salon-header {
    margin-bottom: 1.25rem;
  }

  .salon-header h1 {
    font-size: 1.45rem;
  }

  .salon-brand {
    flex-direction: column;
    text-align: center;
    gap: 0.6rem;
  }

  .service-checklist {
    max-height: 46vh;
    -webkit-overflow-scrolling: touch;
  }

  .service-check {
    min-height: 44px;
    align-items: center;
  }

  .layout-calcom {
    flex-direction: column;
    gap: 1.25rem;
  }

  .time-slots-column {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 1rem;
    max-width: 100%;
    width: 100%;
  }

  #calendar-container {
    min-height: 0;
    padding: 6px 4px 8px;
    overflow: hidden;
  }

  .fc {
    font-size: 0.85rem;
  }

  .fc .fc-toolbar.fc-header-toolbar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.5rem !important;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }

  .fc .fc-toolbar-title {
    font-size: 1rem !important;
  }

  .fc .fc-button {
    padding: 0.4rem 0.55rem;
    font-size: 0.85rem;
  }

  .fc .fc-col-header-cell-cushion,
  .fc .fc-daygrid-day-number {
    font-size: 0.78rem;
    padding: 4px 0;
  }

  .fc .fc-daygrid-day-frame {
    min-height: 2.5rem;
  }

  .fc-daygrid-day.fc-day-holiday .fc-holiday-label {
    display: none;
  }

  .slots-container.vertical-list {
    max-height: none;
    padding-right: 0;
  }

  .time-slot-btn {
    font-size: 1rem;
  }

  .modal {
    align-items: flex-end;
  }
}

/* Ficha del salón (la pinta el gateway en /reservar/<slug>) */
.salon-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem 2rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.salon-info-wide {
  grid-column: 1 / -1;
}

.salon-info-block h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
}

.salon-info-block p {
  margin: 0 0 0.4rem;
  color: var(--ink-light);
  font-size: 0.95rem;
  line-height: 1.5;
}

.salon-info-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warn);
}

.salon-info-block a {
  color: var(--ink);
  font-weight: 500;
}

.salon-info-note {
  font-size: 0.85rem;
}

.salon-hours {
  border-collapse: collapse;
  font-size: 0.92rem;
  color: var(--ink-light);
}

.salon-hours th {
  padding: 0.2rem 1.25rem 0.2rem 0;
  text-align: left;
  font-weight: 500;
  color: var(--ink);
}

.salon-hours td {
  padding: 0.2rem 0;
}

.salon-hours-tramo {
  white-space: nowrap;
}

.salon-services {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0 2rem;
}

.salon-services li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.salon-service-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.salon-service-name {
  color: var(--ink);
  font-weight: 500;
}

.salon-service-meta {
  flex-shrink: 0;
  color: var(--ink-light);
  white-space: nowrap;
}

.salon-info-block .salon-service-desc {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}

.site-footer {
  max-width: 900px;
  margin: 1.5rem auto 0;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-light);
}

.site-footer p {
  margin: 0.2rem 0;
}

.site-footer a {
  color: var(--ink-light);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
