/* EVA365 booking widget. No build step: served as-is by WidgetPageController. */
:root {
    --ew-primary: #2563eb;
    --ew-primary-contrast: #ffffff;
    --ew-text: #111827;
    --ew-muted: #6b7280;
    --ew-border: #e5e7eb;
    --ew-surface: #ffffff;
    --ew-surface-alt: #f9fafb;
    --ew-danger: #b91c1c;
    --ew-radius: 10px;
    color-scheme: light;
}

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

html, body {
    margin: 0;
    padding: 0;
    background: transparent;
    color: var(--ew-text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.ew-mode-page { background: var(--ew-surface-alt); }

.ew-root {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
}

.ew-mode-page .ew-root { padding: 24px 16px 48px; }

.ew-card {
    background: var(--ew-surface);
    border: 1px solid var(--ew-border);
    border-radius: var(--ew-radius);
    padding: 20px;
}

/* Header */
.ew-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.ew-logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: var(--ew-surface-alt); }
.ew-business-name { margin: 0; font-size: 18px; font-weight: 600; }
.ew-business-meta { margin: 0; color: var(--ew-muted); font-size: 13px; }

/* Stepper */
.ew-steps { display: flex; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }
.ew-steps li { flex: 1; height: 4px; border-radius: 2px; background: var(--ew-border); }
.ew-steps li.ew-done { background: var(--ew-primary); }

.ew-step-title { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.ew-step-sub { margin: 0 0 14px; color: var(--ew-muted); font-size: 13px; }

/* Option lists (services / resources) */
.ew-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 480px) { .ew-options { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ew-option {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-width: 0;
    padding: 18px 10px; border: 1px solid var(--ew-border); border-radius: var(--ew-radius);
    background: var(--ew-surface); color: inherit; font: inherit; text-align: center; cursor: pointer;
}
.ew-option:hover { border-color: var(--ew-primary); }
.ew-option:focus-visible, .ew-btn:focus-visible, .ew-date:focus-visible, .ew-month-nav:focus-visible, .ew-slot:focus-visible, .ew-link:focus-visible {
    outline: 2px solid var(--ew-primary); outline-offset: 2px;
}
.ew-option[aria-pressed="true"] { border-color: var(--ew-primary); box-shadow: 0 0 0 1px var(--ew-primary); }
.ew-option-img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.ew-option-img.ew-person-initials { border-radius: 50%; font-size: 15px; background: var(--ew-surface-alt); }
.ew-option-name { max-width: 100%; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }

/* Staff picker: photo, name, service */
.ew-people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .ew-people { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 720px) { .ew-people { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ew-person {
    display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
    padding: 16px 10px; border: 1px solid var(--ew-border); border-radius: var(--ew-radius);
    background: var(--ew-surface); color: inherit; font: inherit; text-align: center; cursor: pointer;
}
.ew-person:hover { border-color: var(--ew-primary); }
.ew-person:focus-visible { outline: 2px solid var(--ew-primary); outline-offset: 2px; }
.ew-person[aria-pressed="true"] { border-color: var(--ew-primary); box-shadow: 0 0 0 1px var(--ew-primary); }
.ew-person-img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; margin-bottom: 6px; background: var(--ew-surface-alt); }
.ew-person-initials {
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 600; color: var(--ew-primary); border: 1px solid var(--ew-border);
}
.ew-person-name { max-width: 100%; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ew-person-service { max-width: 100%; font-size: 13px; color: var(--ew-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Slot picker: month bar, day strip, time grid (sized to fit a 700px iframe) */
.ew-section-title { margin: 10px 0 6px; font-size: 14px; font-weight: 600; }
.ew-step-title + .ew-section-title { margin-top: 8px; }
.ew-section-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ew-section-note { font-size: 12px; color: var(--ew-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ew-month {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 6px; border: 1px solid var(--ew-border); border-radius: var(--ew-radius);
}
.ew-month-label { font-size: 15px; font-weight: 600; }
.ew-month-nav {
    width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent;
    color: var(--ew-muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.ew-month-nav:hover:not(:disabled) { background: var(--ew-surface-alt); color: var(--ew-text); }
.ew-month-nav:disabled { opacity: .35; cursor: not-allowed; }
.ew-dates {
    display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px;
    scroll-snap-type: x proximity; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.ew-date {
    flex: 0 0 72px; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 10px 6px; border: 1px solid var(--ew-border); border-radius: var(--ew-radius);
    background: var(--ew-surface); color: var(--ew-muted); font: inherit; line-height: 1.3; cursor: pointer; scroll-snap-align: start;
}
.ew-date:hover:not(:disabled) { border-color: var(--ew-primary); }
.ew-date:disabled { opacity: .5; cursor: not-allowed; }
.ew-date-dow { font-size: 12px; }
.ew-date-num { font-size: 17px; font-weight: 700; color: var(--ew-text); }
.ew-date:disabled .ew-date-num { color: var(--ew-muted); }
.ew-date-count { font-size: 11px; white-space: nowrap; }
.ew-date[aria-pressed="true"] { border-color: var(--ew-primary); box-shadow: 0 0 0 1px var(--ew-primary); }
.ew-date[aria-pressed="true"],
.ew-date[aria-pressed="true"] .ew-date-num { color: var(--ew-primary); }
/* Up to 4 rows visible; days with more slots scroll inside the grid, not the page */
.ew-slots {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
    max-height: 184px; overflow-y: auto; padding: 2px; scrollbar-width: thin;
}
@media (min-width: 440px) { .ew-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 680px) { .ew-slots { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ew-slot {
    padding: 9px 4px; border: 1px solid var(--ew-border); border-radius: var(--ew-radius);
    background: var(--ew-surface); color: inherit; font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.ew-slot:hover { border-color: var(--ew-primary); }
.ew-slot[aria-pressed="true"] { background: var(--ew-primary); color: var(--ew-primary-contrast); border-color: var(--ew-primary); }

/* Summary */
.ew-summary { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.ew-summary dt { color: var(--ew-muted); }
.ew-summary dd { margin: 0; font-weight: 500; }

/* Buttons & actions */
.ew-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 20px; }
.ew-btn {
    padding: 10px 18px; border-radius: 8px; border: 1px solid var(--ew-primary);
    background: var(--ew-primary); color: var(--ew-primary-contrast);
    font: inherit; font-weight: 500; cursor: pointer;
}
.ew-btn:disabled { opacity: .5; cursor: not-allowed; }
.ew-btn-ghost { background: transparent; color: var(--ew-text); border-color: var(--ew-border); }
.ew-link { background: none; border: 0; padding: 4px; color: var(--ew-primary); font: inherit; cursor: pointer; }
.ew-link:disabled { color: var(--ew-muted); opacity: .5; cursor: not-allowed; }

/* States */
.ew-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 0; color: var(--ew-muted); }
.ew-spinner { width: 18px; height: 18px; border: 2px solid var(--ew-border); border-top-color: var(--ew-primary); border-radius: 50%; animation: ew-spin .8s linear infinite; }
@keyframes ew-spin { to { transform: rotate(360deg); } }
.ew-empty { padding: 18px; text-align: center; color: var(--ew-muted); background: var(--ew-surface-alt); border-radius: var(--ew-radius); }
.ew-error { padding: 12px 14px; color: var(--ew-danger); background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; }
.ew-notice { padding: 20px; text-align: center; background: var(--ew-surface); border: 1px solid var(--ew-border); border-radius: var(--ew-radius); }
.ew-notice-title { margin: 0 0 6px; font-size: 17px; }
.ew-tz-note { margin: 10px 0 0; font-size: 12px; color: var(--ew-muted); }
.ew-footer { margin-top: 14px; text-align: center; font-size: 12px; color: var(--ew-muted); }

/* Booking form (phase 3) */
.ew-form { margin-top: 18px; display: grid; gap: 14px; }
.ew-field { display: grid; gap: 6px; }
.ew-label { font-size: 13px; font-weight: 500; }
.ew-input {
    width: 100%; padding: 10px 12px; font: inherit; color: inherit;
    background: var(--ew-surface); border: 1px solid var(--ew-border); border-radius: 8px;
}
.ew-input:focus { outline: 2px solid var(--ew-primary); outline-offset: 0; border-color: var(--ew-primary); }
.ew-input[aria-invalid="true"] { border-color: var(--ew-danger); }
textarea.ew-input { resize: vertical; min-height: 72px; }
.ew-field-error { margin: 0; font-size: 13px; color: var(--ew-danger); }
.ew-consent-label { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ew-muted); cursor: pointer; }
.ew-checkbox { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--ew-primary); flex: none; }
.ew-turnstile:empty { display: none; }
/* 4-digit code: an invisible input laid over the boxes */
.ew-otp { position: relative; display: flex; gap: 12px; width: max-content; max-width: 100%; margin: 6px 0 14px; }
.ew-otp-box {
    display: flex; align-items: center; justify-content: center; width: 56px; height: 64px;
    border: 1px solid var(--ew-border); border-radius: var(--ew-radius); background: var(--ew-surface-alt);
    color: var(--ew-muted); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ew-otp-box:not(.ew-filled) { font-weight: 400; font-size: 20px; }
.ew-otp-box.ew-filled { color: var(--ew-text); border-color: var(--ew-primary); }
.ew-otp-box.ew-active { border-color: var(--ew-text); box-shadow: 0 4px 12px rgba(17, 24, 39, .12); }
.ew-otp-input {
    position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0;
    font-size: 16px; color: transparent; caret-color: transparent; background: transparent; cursor: text;
}
.ew-otp:focus-within { outline: none; }
@media (max-width: 360px) { .ew-otp { gap: 8px; } .ew-otp-box { width: 48px; height: 56px; } }
.ew-verify-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }
.ew-success-note { margin: 8px 0 0; padding: 10px 12px; color: #166534; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; }
.ew-done { text-align: center; }
.ew-done .ew-summary { text-align: start; margin: 16px auto; max-width: 420px; }
.ew-done-icon {
    width: 52px; height: 52px; margin: 4px auto 12px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--ew-primary); color: var(--ew-primary-contrast); font-size: 26px; font-weight: 700;
}
.ew-done-text { margin: 8px 0 0; color: var(--ew-muted); }
.ew-actions-center { justify-content: center; flex-wrap: wrap; }
.ew-actions-wide { margin-top: 14px; }
.ew-actions-wide .ew-btn:last-child { flex: 1; }
a.ew-btn { text-decoration: none; display: inline-block; }

[dir="rtl"] .ew-month-nav { transform: scaleX(-1); }

@media (prefers-reduced-motion: reduce) {
    .ew-spinner { animation-duration: 2s; }
    .ew-option, .ew-date, .ew-slot { transition: none; }
}

@media (max-width: 420px) {
    .ew-root { padding: 10px; }
    .ew-card { padding: 14px; }
}
