/* Web de iDinely: los mismos colores que la app (mobile/src/constants/theme.ts) */
:root {
  --text: #1c1917;
  --text-secondary: #78716c;
  --background: #ffffff;
  --surface: #fafaf9;
  --element: #f5f5f4;
  --border: #e7e5e4;
  --primary: #ea580c;
  --primary-hover: #c2410c;
  --primary-soft: #ffedd5;
  --on-primary: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning-soft: #fef3c7;
  --hero-glow: #ffedd5;
  --callout-bg: #ffedd5;
  --callout-border: transparent;
  --header-bg: rgb(255 255 255 / 88%);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 20px;
  --shadow: 0 1px 2px rgb(28 25 23 / 6%), 0 4px 16px rgb(28 25 23 / 6%);
  --content: 1080px;
  --gutter: 20px;
  --header-height: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #fafaf9;
    --text-secondary: #a8a29e;
    --background: #0c0a09;
    --surface: #141210;
    --element: #1c1917;
    --border: #292524;
    --primary: #f97316;
    --primary-hover: #fb923c;
    --primary-soft: #431407;
    --danger: #f87171;
    --danger-soft: #450a0a;
    --success: #4ade80;
    --success-soft: #052e16;
    --warning-soft: #422006;
    --hero-glow: rgb(249 115 22 / 14%);
    --callout-bg: rgb(249 115 22 / 8%);
    --callout-border: rgb(249 115 22 / 22%);
    --header-bg: rgb(12 10 9 / 85%);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a29e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --shadow: none;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-height) + 16px); }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

main { flex: 1; }

a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 6vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: 1.125rem; }
h1.h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2.h3 { font-size: 1.125rem; }
p { margin: 0 0 1em; text-wrap: pretty; }

.container {
  width: 100%; max-width: var(--content); margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.container.narrow { max-width: 480px; }
.container.medium { max-width: 760px; }
.muted { color: var(--text-secondary); }
.small { font-size: 0.875rem; }
.center { text-align: center; }

/* Cabecera */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.site-header > .container { display: flex; align-items: center; gap: 16px; min-height: var(--header-height); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand img { width: 32px; height: 32px; border-radius: 8px; display: block; }
.nav { display: flex; align-items: center; gap: 8px 20px; margin-left: auto; }
.nav a:not(.button), .nav .link {
  color: var(--text-secondary); text-decoration: none; font-weight: 500;
  background: none; border: 0; padding: 0; font: inherit; font-weight: 500; cursor: pointer;
}
.nav a:not(.button):hover, .nav a[aria-current='page'], .nav .link:hover { color: var(--text); }
.nav form { margin: 0; display: contents; }
.menu-toggle {
  display: none; margin-left: auto; width: 44px; height: 44px; margin-right: -10px;
  border: 0; border-radius: var(--radius-m); background: transparent; color: var(--text); cursor: pointer;
  align-items: center; justify-content: center;
}
.menu-toggle svg { width: 24px; height: 24px; }
.menu-toggle .close, .site-header.open .menu-toggle .open { display: none; }
.site-header.open .menu-toggle .close { display: block; }

@media (max-width: 719px) {
  .js .menu-toggle { display: inline-flex; }
  .js .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0; margin: 0;
    padding: 8px max(var(--gutter), env(safe-area-inset-right)) 20px max(var(--gutter), env(safe-area-inset-left));
    background: var(--background); border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 32px rgb(0 0 0 / 12%);
  }
  .js .site-header.open .nav { display: flex; }
  .js .nav a:not(.button), .js .nav .link {
    display: flex; align-items: center; min-height: 52px; font-size: 1.05rem; color: var(--text);
    border-bottom: 1px solid var(--border); text-align: left; width: 100%;
  }
  .js .nav .button { margin-top: 16px; min-height: 48px; font-size: 1rem; }
  /* Sin JS los enlaces quedan a la vista y pasan a otra fila si no caben */
  html:not(.js) .site-header > .container { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  html:not(.js) .nav { flex-wrap: wrap; }
}

/* Botones */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--primary); color: var(--on-primary); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; text-align: center;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.button:hover { background: var(--primary-hover); color: var(--on-primary); }
.button:active { transform: translateY(1px); }
.button.secondary { background: var(--element); color: var(--text); border-color: var(--border); }
.button.secondary:hover { background: var(--border); color: var(--text); }
.button.danger { background: transparent; color: var(--danger); border-color: var(--border); }
.button.danger:hover { background: var(--danger-soft); }
.button.small { min-height: 36px; padding: 0 14px; font-size: 0.9rem; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Portada */
.hero {
  padding: 80px 0 64px;
  background: radial-gradient(120% 100% at 50% 0%, var(--hero-glow) 0%, transparent 70%), var(--background);
}
.hero .lead { font-size: clamp(1.075rem, 2.5vw, 1.2rem); color: var(--text-secondary); max-width: 38em; }
.hero .actions { margin-top: 28px; }
.eyebrow { display: inline-block; font-size: 0.85rem; font-weight: 600; color: var(--primary); margin-bottom: 12px; letter-spacing: 0.02em; }
.section { padding: 64px 0; }
.section.alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section > .container > h2 { margin-bottom: 24px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.feature { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--background); }
.feature h3 { margin-bottom: 6px; }
.feature .icon { width: 44px; height: 44px; border-radius: var(--radius-m); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: 16px; }
.feature .icon svg { width: 24px; height: 24px; }
.feature p { color: var(--text-secondary); margin: 0; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.steps li { counter-increment: step; padding: 24px; border-radius: var(--radius-l); background: var(--background); border: 1px solid var(--border); }
.steps li h3 { margin-bottom: 6px; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-weight: 700; margin-bottom: 14px; }
.steps li p { color: var(--text-secondary); margin: 0; }
.callout { display: flex; gap: 20px 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 32px; border-radius: var(--radius-l); background: var(--callout-bg); border: 1px solid var(--callout-border); }
.callout > div { flex: 1 1 18em; }
.callout h2 { margin: 0 0 6px; }
.callout p { margin: 0; }

/* Tarjetas y formularios */
.page { padding: 40px 0 64px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-header h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); margin: 0; overflow-wrap: anywhere; }
.back { display: inline-flex; align-items: center; min-height: 32px; margin-bottom: 12px; color: var(--text-secondary); text-decoration: none; font-weight: 500; }
.back:hover { color: var(--text); }
.card { background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card h2 { font-size: 1.25rem; }
.card > .hint { margin-top: -6px; }
.stack > * + * { margin-top: 16px; }

.field label, .field legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
.field .helptext { display: block; color: var(--text-secondary); font-size: 0.875rem; margin-top: 6px; }
.field fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
input[type='text'], input[type='email'], input[type='password'], input[type='url'], input[type='search'],
input[type='tel'], input[type='time'], input[type='number'], select, textarea {
  -webkit-appearance: none; appearance: none;
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--radius-m);
  border: 1px solid var(--border); background: var(--background); color: var(--text);
  font: inherit; font-size: 16px; /* 16px evita el zoom automático de iOS */
}
input::placeholder, textarea::placeholder { color: var(--text-secondary); opacity: 0.8; }
select { padding-right: 40px; background: var(--chevron) no-repeat right 12px center / 18px, var(--background); }
input[type='time'] { text-align: left; }
input[type='time']::-webkit-date-and-time-value { text-align: left; }
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.button:focus-visible, a:focus-visible, .menu-toggle:focus-visible, .chips label:has(input:focus-visible) {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
form .button[type='submit']:only-of-type { min-width: 10em; }
.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--danger); font-size: 0.9rem; }
.errorlist.nonfield { padding: 12px 14px; border-radius: var(--radius-m); background: var(--danger-soft); margin: 0 0 16px; }

/* Selección múltiple como «chips» */
.chips div { display: flex; flex-wrap: wrap; gap: 8px; }
.chips div div { display: contents; }
.chips label {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500;
  min-height: 40px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--element); cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }

/* Horario */
.hours { width: 100%; border-collapse: collapse; }
.hours th { text-align: left; font-weight: 600; padding: 18px 12px 10px 0; width: 7.5em; vertical-align: top; }
.hours td { padding: 8px 0; }
.hours tr + tr { border-top: 1px solid var(--border); }
.slots { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.slot { display: flex; align-items: center; gap: 8px; }
.slot input { width: 8em; }

/* Listas */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; gap: 12px 16px; padding: 14px 0; flex-wrap: wrap; }
.list li:first-child { padding-top: 0; }
.list li:last-child { padding-bottom: 0; }
.list li + li { border-top: 1px solid var(--border); }
.list .grow { flex: 1 1 12em; min-width: 0; }
.list .title { font-weight: 600; overflow-wrap: anywhere; }
.list .muted { overflow-wrap: anywhere; }
.thumb { width: 56px; height: 56px; border-radius: var(--radius-m); object-fit: cover; background: var(--element); flex: none; display: grid; place-items: center; color: var(--text-secondary); }
.thumb svg { width: 24px; height: 24px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--element); color: var(--text-secondary); white-space: nowrap; }
.badge.pending { background: var(--warning-soft); color: var(--text); }
.badge.approved { background: var(--success-soft); color: var(--success); }
.badge.rejected { background: var(--danger-soft); color: var(--danger); }
.empty { text-align: center; padding: 24px 8px; color: var(--text-secondary); }
.empty p:last-of-type { margin-bottom: 16px; }

.photo-box { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.photo-box > img, .photo-box > .placeholder { width: 160px; height: 120px; flex: none; border-radius: var(--radius-m); object-fit: cover; background: var(--element); display: grid; place-items: center; color: var(--text-secondary); }
.photo-box > .stack { flex: 1 1 16em; min-width: 0; }

.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; }
input[type='file'] { font: inherit; font-size: 0.9rem; color: var(--text-secondary); max-width: 100%; min-width: 0; }
input[type='file']::file-selector-button { font: inherit; font-weight: 500; margin-right: 10px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--element); color: var(--text); cursor: pointer; }

/* Avisos */
.messages { list-style: none; padding: 0; margin: 0 0 20px; }
.messages li { padding: 12px 16px; border-radius: var(--radius-m); background: var(--success-soft); }
.messages li.error { background: var(--danger-soft); }
.messages li + li { margin-top: 8px; }

.sticky-save {
  position: sticky; bottom: 0; z-index: 5; margin-top: 8px;
  padding: 16px 0 max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, var(--background) 70%, transparent);
}

/* Pie */
.site-footer {
  border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 0.875rem;
  padding: 28px 0 max(28px, env(safe-area-inset-bottom));
}
.site-footer .container { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
.site-footer a { color: var(--text-secondary); }
.site-footer a:hover { color: var(--text); }

/* Móvil */
@media (max-width: 560px) {
  :root { --gutter: 16px; --header-height: 60px; }
  .hero { padding: 40px 0 44px; }
  .section { padding: 44px 0; }
  .page { padding: 20px 0 48px; }
  .card { padding: 20px; border-radius: 16px; margin-bottom: 16px; }
  .feature, .steps li { padding: 20px; }
  .callout { padding: 24px 20px; }
  /* Botones principales a todo el ancho: más fáciles de pulsar y sin anchos irregulares */
  .hero .actions .button, .callout > .button, .page-header > .button, .empty .button,
  .stack > .button, .sticky-save .button { width: 100%; }
  .hero .actions { flex-direction: column; align-items: stretch; }
  .page-header { margin-bottom: 20px; }
  .hours th { display: block; width: auto; padding: 14px 0 6px; }
  .hours td { display: block; padding: 0 0 14px; }
  .slots { flex-direction: column; gap: 8px; }
  .slot input { width: auto; flex: 1; min-width: 0; }
  .photo-box > img, .photo-box > .placeholder { width: 100%; height: auto; aspect-ratio: 4 / 3; }
  .photo-box > .placeholder { height: 140px; aspect-ratio: auto; }
  .search { flex-direction: column; }
  .photo-box .actions { flex-direction: column; align-items: stretch; }
  .photo-box .button { width: 100%; }
  .site-footer .container { flex-direction: column; }
}
