/**
 * Online Booking Wizard styles (mobile-first, RTL).
 * Reuses the plugin's --ortho-* design tokens with safe fallbacks so the
 * wizard also looks correct on themes that don't load the main stylesheet.
 *
 * @package Orthopedic_Appointments
 */

.ortho-booking {
    --ob-primary: var(--ortho-primary, #111827);
    --ob-accent: var(--ortho-accent, #2563eb);
    --ob-surface: var(--ortho-surface, #ffffff);
    --ob-soft: var(--ortho-surface-soft, #f3f4f6);
    --ob-border: var(--ortho-border, #e5e7eb);
    --ob-text: var(--ortho-text, #111827);
    --ob-muted: var(--ortho-muted, #6b7280);
    --ob-success: var(--ortho-success, #16a34a);
    --ob-danger: var(--ortho-danger, #ef4444);
    --ob-radius: 14px;

    direction: rtl;
    text-align: right;
    width: min(100%, 720px);
    max-width: 720px !important;
    margin: 0 auto;
    color: var(--ob-text);
    font-family: inherit;
    line-height: 1.7;
}

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

.ob-loading,
.ortho-booking-loading {
    padding: 40px 16px;
    text-align: center;
    color: var(--ob-muted);
}

/* Progress chips */
.ob-progress-wrap {
    margin: 0 0 18px;
}
.ob-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 2px 8px;
    color: var(--ob-muted);
    font-size: 12px;
}
.ob-progress-meta span:first-child {
    color: var(--ob-text);
    font-weight: 700;
}
.ob-progress {
    display: flex;
    gap: 6px;
    margin: 0;
}
.ob-step {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    font-size: 12px;
    color: var(--ob-muted);
    padding: 7px 4px;
    border-radius: 9px;
    background: var(--ob-soft);
    border: 1px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ob-step.is-done {
    color: var(--ob-success);
    background: rgba(22, 163, 74, .08);
}
.ob-step-check { margin-left: 4px; }
.ob-step.is-current {
    color: #fff;
    background: var(--ob-accent);
    border-color: var(--ob-accent);
    font-weight: 700;
}

/* Card / panel */
.ob-card {
    background: var(--ob-surface);
    border: 1px solid var(--ob-border);
    border-radius: var(--ob-radius);
    padding: 18px;
    box-shadow: 0 8px 28px rgba(17, 24, 39, 0.06);
}
.ob-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 14px;
}
.ob-sub { color: var(--ob-muted); font-size: 13px; margin: -8px 0 14px; }

/* Selectable option list */
.ob-options { display: grid; gap: 10px; }
.ob-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: right;
    padding: 14px 16px;
    border: 1.5px solid var(--ob-border);
    border-radius: 12px;
    background: var(--ob-surface);
    color: var(--ob-text);
    font-size: 15px;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .05s;
}
.ob-option:hover { border-color: var(--ob-accent); }
.ob-option:active { transform: scale(.99); }
.ob-option.is-selected { border-color: var(--ob-accent); background: rgba(37, 99, 235, .06); }
.ob-option .ob-option-meta { color: var(--ob-muted); font-size: 13px; }

/* Calendar */
.ob-cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 12px;
}
.ob-cal-head button {
    border: 1px solid var(--ob-border);
    background: var(--ob-surface);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    font-size: 18px;
    cursor: pointer;
    color: var(--ob-text);
}
.ob-cal-head button[disabled] { opacity: .35; cursor: not-allowed; }
.ob-cal-title { font-weight: 700; }
.ob-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.ob-cal-wd {
    text-align: center;
    font-size: 11px;
    color: var(--ob-muted);
    padding: 4px 0;
}
.ob-cal-day {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--ob-border);
    background: var(--ob-surface);
    font-size: 14px;
    cursor: pointer;
    color: var(--ob-text);
}
.ob-cal-day.is-empty { border: none; background: transparent; cursor: default; }
.ob-cal-day.is-disabled { color: var(--ob-muted); background: var(--ob-soft); cursor: not-allowed; opacity: .55; }
.ob-cal-day.is-available { border-color: rgba(22, 163, 74, .5); }
.ob-cal-day.is-available:hover { border-color: var(--ob-accent); }
.ob-cal-day.is-selected { background: var(--ob-accent); color: #fff; border-color: var(--ob-accent); }

/* No-availability / waitlist */
.ob-empty-state {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--ob-border);
    border-radius: 12px;
    background: rgba(37, 99, 235, .04);
}
.ob-empty-icon {
    float: right;
    width: 34px;
    height: 34px;
    margin: 0 0 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(37, 99, 235, .12);
    color: var(--ob-accent);
    font-weight: 800;
}
.ob-empty-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 38px;
}
.ob-empty-copy strong { color: var(--ob-text); }
.ob-empty-copy span { color: var(--ob-muted); font-size: 13px; }
.ob-waitlist-form {
    clear: both;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}
.ob-waitlist-form .ob-field { margin: 0; }
.ob-waitlist-form .ob-btn,
.ob-waitlist-form .ob-privacy-note,
.ob-waitlist-form #ob-waitlist-msg {
    grid-column: 1 / -1;
}
.ob-privacy-note {
    color: var(--ob-muted);
    font-size: 11px;
    text-align: center;
}
.ob-waitlist-form #ob-waitlist-msg .ob-alert {
    margin: 0;
}

/* Slots */
.ob-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
}
.ob-slot {
    padding: 11px 6px;
    text-align: center;
    border: 1.5px solid var(--ob-border);
    border-radius: 10px;
    background: var(--ob-surface);
    cursor: pointer;
    font-size: 15px;
    color: var(--ob-text);
    direction: ltr;
}
.ob-slot:hover { border-color: var(--ob-accent); }
.ob-slot.is-selected { background: var(--ob-accent); color: #fff; border-color: var(--ob-accent); }

/* Form */
.ob-field { margin: 0 0 14px; }
.ob-field label { display: block; font-size: 13px; margin: 0 0 6px; color: var(--ob-muted); }
.ob-field input,
.ob-field textarea,
.ob-field select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--ob-border);
    border-radius: 11px;
    font: inherit;
    background: var(--ob-surface);
    color: var(--ob-text);
}
.ob-field input:focus,
.ob-field textarea:focus,
.ob-field select:focus { outline: none; border-color: var(--ob-accent); }
.ob-genders { display: flex; gap: 8px; }
.ob-genders .ob-gender {
    flex: 1;
    text-align: center;
    padding: 11px;
    border: 1.5px solid var(--ob-border);
    border-radius: 11px;
    cursor: pointer;
}
.ob-genders .ob-gender.is-selected { border-color: var(--ob-accent); background: rgba(37,99,235,.06); }

.ob-otp-row { display: flex; gap: 8px; align-items: stretch; }
.ob-otp-row input { flex: 1; }

/* Footer / buttons */
.ob-footer {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}
.ob-btn {
    flex: 1;
    padding: 13px 18px;
    border-radius: 12px;
    border: none;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.ob-btn-primary { background: var(--ob-accent); color: #fff; }
.ob-btn-primary[disabled] { opacity: .5; cursor: not-allowed; }
.ob-btn-ghost { background: var(--ob-soft); color: var(--ob-text); flex: 0 0 auto; min-width: 92px; }
.ob-btn-block { width: 100%; flex: none; }

/* Summary / result */
.ob-summary { list-style: none; margin: 0 0 8px; padding: 0; }
.ob-summary li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--ob-border);
}
.ob-summary li span:first-child { color: var(--ob-muted); }
.ob-summary li span:last-child { font-weight: 600; }

.ob-result-icon {
    width: 64px; height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 34px; color: #fff;
    background: var(--ob-success);
}
.ob-result-icon.is-fail { background: var(--ob-danger); }
.ob-center { text-align: center; }

.ob-alert {
    padding: 11px 14px;
    border-radius: 10px;
    margin: 0 0 14px;
    font-size: 14px;
}
.ob-alert-error { background: rgba(239, 68, 68, .1); color: var(--ob-danger); }
.ob-alert-success { background: rgba(22, 163, 74, .1); color: var(--ob-success); }
.ob-alert-info { background: var(--ob-soft); color: var(--ob-muted); }

.ob-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.ob-badge-confirmed { background: rgba(22,163,74,.12); color: var(--ob-success); }
.ob-badge-cancelled { background: rgba(239,68,68,.12); color: var(--ob-danger); }
.ob-badge-pending { background: var(--ob-soft); color: var(--ob-muted); }

@media (max-width: 480px) {
    .ortho-booking { width: 100%; max-width: 100% !important; }
    .ob-card { padding: 14px; border-radius: 12px; }
    .ob-progress-meta { font-size: 11px; }
    .ob-step { font-size: 10px; padding: 7px 2px; }
    .ob-step-check { display: none; }
    .ob-waitlist-form { grid-template-columns: 1fr; }
}

/* Dark mode (matches the plugin's theme toggle attribute) */
html[data-od-theme="dark"] .ortho-booking {
    --ob-surface: #1f2937;
    --ob-soft: #111827;
    --ob-border: #374151;
    --ob-text: #f3f4f6;
    --ob-muted: #9ca3af;
}
