/**
 * EMC Booking — Public Widget Styles
 * Mobile-first, no frameworks.
 * Uses CSS custom properties --emc-brand / --emc-accent injected per-tenant.
 */

:root {
    --emc-brand: #2563eb;
    --emc-accent: #10b981;
}

/* ── Container ── */
.emc-booking-widget {
    max-width: 600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: #1f2937;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
    overflow: hidden;
}

/* ── Steps / transitions ── */
.emc-booking-step {
    padding: 24px;
    animation: emcFadeIn .25s ease;
}
.emc-booking-step[hidden] { display: none; }
@keyframes emcFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Session type cards ── */
.emc-booking-types-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 480px) { .emc-booking-types-list { grid-template-columns: 1fr 1fr; } }

.emc-booking-types-list .emc-type-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.emc-type-card:hover {
    border-color: var(--emc-brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--emc-brand) 10%, transparent);
}
.emc-type-card .emc-type-title { font-weight: 600; font-size: 15px; margin: 0 0 4px; }
.emc-type-card .emc-type-meta  { font-size: 13px; color: #6b7280; }
.emc-type-card .emc-type-price { font-weight: 600; color: var(--emc-brand); margin-top: 8px; }

/* ── Calendar ── */
.emc-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.emc-cal-header .emc-cal-month { font-weight: 600; font-size: 16px; }
.emc-cal-header button {
    background: none; border: 1px solid #e5e7eb; border-radius: 8px;
    width: 34px; height: 34px; cursor: pointer; font-size: 16px; color: #374151;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.emc-cal-header button:hover { background: #f3f4f6; }

.emc-cal-grid { user-select: none; }
.emc-cal-days,
.emc-cal-dates { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.emc-cal-days span,
.emc-cal-days abbr { font-size: 12px; color: #9ca3af; font-weight: 500; padding: 8px 0; text-decoration: none; }

.emc-cal-cell {
    width: 38px; height: 38px; margin: 2px auto;
    display: flex; align-items: center; justify-content: center;
    padding: 0; border: 1px solid transparent; border-radius: 50%;
    background: transparent; color: inherit; font: inherit; font-size: 14px;
    transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.emc-cal-disabled { color: #d1d5db; cursor: default; }
.emc-cal-available { background: color-mix(in srgb, var(--emc-brand) 8%, white); color: var(--emc-brand); cursor: pointer; font-weight: 500; }
.emc-cal-available:hover { background: color-mix(in srgb, var(--emc-brand) 15%, white); }
.emc-cal-selected { background: var(--emc-brand) !important; color: #fff !important; }
.emc-cal-today { box-shadow: inset 0 0 0 1px var(--emc-brand); }

/* ── Time slots ── */
.emc-booking-slots-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}
.emc-booking-slots-list button {
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.emc-booking-slots-list button:hover { border-color: var(--emc-brand); background: color-mix(in srgb, var(--emc-brand) 8%, white); }
.emc-booking-slots-list button.selected { background: var(--emc-brand); color: #fff; border-color: var(--emc-brand); }

/* ── Form ── */
.emc-booking-form label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: #374151; }
.emc-field { margin-bottom: 16px; }
.emc-field input,
.emc-field textarea,
.emc-field select {
    width: 100%; padding: 10px 12px;
    border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 14px; transition: border-color .15s;
    box-sizing: border-box;
}
.emc-field input:focus,
.emc-field textarea:focus,
.emc-field select:focus { outline: none; border-color: var(--emc-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--emc-brand) 10%, transparent); }

/* ── Submit button ── */
.emc-booking-submit {
    width: 100%; padding: 12px;
    background: var(--emc-brand); color: #fff; border: none; border-radius: 8px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    transition: background .15s, opacity .15s;
}
.emc-booking-submit:hover { opacity: 0.9; filter: brightness(0.9); }
.emc-booking-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Loading overlay ── */
.emc-booking-loading {
    position: absolute; inset: 0;
    background: rgba(255,255,255,.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 10;
}

/* ── Error banner ── */
.emc-booking-error {
    background: #fef2f2; color: #991b1b;
    border: 1px solid #fecaca; border-radius: 8px;
    padding: 12px 16px; font-size: 14px; margin-bottom: 16px;
}

/* ── Confirmation ── */
.emc-confirm-icon {
    width: 64px; height: 64px; margin: 0 auto 16px;
    background: color-mix(in srgb, var(--emc-accent) 20%, white); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--emc-accent); font-size: 32px;
}

/* ── Providers grid ── */
.emc-providers-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 480px) { .emc-providers-grid { grid-template-columns: 1fr 1fr; } }

.emc-provider-card {
    border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 20px; text-align: center;
    transition: box-shadow .15s;
}
.emc-provider-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }

.emc-provider-photo--placeholder {
    width: 56px; height: 56px; margin: 0 auto 12px;
    border-radius: 50%; background: color-mix(in srgb, var(--emc-brand) 8%, white); color: var(--emc-brand);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700;
}
.emc-provider-card img {
    width: 56px; height: 56px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; display: block;
}

.emc-verified {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--emc-accent); font-weight: 500;
}
.emc-verified::before { content: '\2713'; }

.emc-tag {
    display: inline-block; padding: 2px 8px;
    background: #f3f4f6; border-radius: 999px;
    font-size: 11px; color: #6b7280; margin: 2px;
}

.emc-stars { color: #f59e0b; font-size: 14px; letter-spacing: 1px; }

/* ── Shared buttons ── */
.emc-btn--primary {
    display: inline-block; padding: 10px 20px;
    background: var(--emc-brand); color: #fff; border: none; border-radius: 8px;
    font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: background .15s, opacity .15s;
}
.emc-btn--primary:hover { opacity: 0.9; filter: brightness(0.9); }

/* ── Spinner ── */
.emc-spinner {
    width: 28px; height: 28px;
    border: 3px solid #e5e7eb; border-top-color: var(--emc-brand);
    border-radius: 50%;
    animation: emcSpin .6s linear infinite;
}
@keyframes emcSpin { to { transform: rotate(360deg); } }

/* ── Member pricing ── */
.emc-price-original {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 0.9em;
}
.emc-price-member {
    color: var(--emc-accent);
    font-weight: 700;
}
.emc-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 6px;
}
.emc-badge--discount {
    background: #d1fae5;
    color: #059669;
}
.emc-type-locked {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #9ca3af;
}
.emc-type-card--locked {
    opacity: 0.6;
    cursor: not-allowed !important;
}
.emc-type-card--locked:hover {
    border-color: #e5e7eb;
    box-shadow: none;
}

/* ── Cart (multi-créneaux) ── */
.emc-cart-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.emc-cart-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px;
}
.emc-cart-row-info { display: flex; flex-direction: column; }
.emc-cart-row-info strong { font-size: 14px; }
.emc-cart-row-info span { font-size: 13px; color: #6b7280; }
.emc-cart-row-right { display: flex; align-items: center; gap: 12px; }
.emc-cart-row-right > span { font-weight: 600; color: var(--emc-brand); }
.emc-cart-remove {
    background: none; border: none; cursor: pointer; font-size: 18px; line-height: 1;
    color: #9ca3af; padding: 0 4px;
}
.emc-cart-remove:hover { color: #ef4444; }
.emc-cart-total { text-align: right; font-size: 16px; margin-bottom: 16px; }
.emc-cart-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.emc-cart-add {
    flex: 1; min-width: 160px; padding: 11px; border: 1px solid var(--emc-brand); background: #fff;
    color: var(--emc-brand); border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.emc-cart-add:hover { background: color-mix(in srgb, var(--emc-brand) 8%, white); }
.emc-cart-pay {
    flex: 1; min-width: 160px; padding: 11px; border: none; background: var(--emc-brand);
    color: #fff; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.emc-cart-pay:hover { filter: brightness(0.95); }
.emc-cart-pay:disabled { opacity: .5; cursor: not-allowed; }
.emc-cart-reassure {
    display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center;
    margin: 14px 0 0; font-size: 12.5px; color: #6b7280; text-align: center;
}
.emc-cart-reassure span { display: inline-flex; align-items: center; gap: 4px; }

/* Required ACA legal acceptance before a paid checkout. */
.emc-legal-acceptance {
    margin: 18px 0;
    padding: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
}
.emc-legal-acceptance legend {
    padding: 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
}
.emc-legal-acceptance__label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.55;
    cursor: pointer;
}
.emc-legal-acceptance__label input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex: 0 0 auto;
}
.emc-legal-acceptance a {
    color: var(--emc-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.emc-legal-acceptance a:focus-visible,
.emc-legal-acceptance__label input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--emc-brand) 35%, transparent);
    outline-offset: 3px;
}
.emc-legal-acceptance__details,
.emc-legal-acceptance__parental {
    margin: 10px 0 0 30px;
    color: #475569;
    font-size: 13px;
    line-height: 1.45;
}
.emc-legal-acceptance__error {
    min-height: 1.2em;
    margin: 8px 0 0 30px;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
}
.emc-booking-review-list {
    margin: 10px 0 14px;
    padding: 0;
    list-style: none;
}
.emc-booking-review-list > div,
.emc-booking-review-list > li {
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}
.emc-booking-review-list > div {
    display: grid;
    grid-template-columns: minmax(110px, 0.42fr) 1fr;
    gap: 10px;
}
.emc-booking-review-list dt {
    color: #64748b;
}
.emc-booking-review-list dd {
    margin: 0;
    font-weight: 600;
}
.emc-booking-review-edit {
    margin: 2px 0 14px;
    padding: 9px 12px;
    border: 1px solid var(--emc-brand);
    border-radius: 8px;
    background: #fff;
    color: var(--emc-brand);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.emc-booking-review-edit:hover,
.emc-booking-review-edit:focus-visible {
    background: color-mix(in srgb, var(--emc-brand) 8%, white);
}

/* ── Provider public page (responsive) ── */
.emc-provider-header {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 30px;
}
.emc-provider-service-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
@media (max-width: 560px) {
    .emc-provider-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .emc-provider-service-row {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }
    .emc-provider-service-row a {
        text-align: center;
    }
}
