/* ═══════════════════════════════════════════
   JeanBooking Pro v1.4 — Frontend Booking Form
   ═══════════════════════════════════════════ */

.jbp-booking-form {
    --jbp-primary: #2563eb;
    --jbp-primary-light: #3b82f6;
    --jbp-accent: #1e40af;
    --jbp-bg: #ffffff;
    --jbp-surface: #f8fafc;
    --jbp-border: #e2e8f0;
    --jbp-text: #1e293b;
    --jbp-text-muted: #64748b;
    --jbp-success: #059669;
    --jbp-success-light: #ecfdf5;
    --jbp-danger: #dc2626;
    --jbp-radius: 16px;
    --jbp-shadow: 0 1px 3px rgba(0,0,0,.04), 0 8px 32px rgba(0,0,0,.06);

    max-width: 580px;
    margin: 0 auto;
    background: var(--jbp-bg);
    border-radius: var(--jbp-radius);
    box-shadow: var(--jbp-shadow);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--jbp-text);
    overflow: hidden;
    position: relative;
}
.jbp-booking-form *, .jbp-booking-form *::before, .jbp-booking-form *::after {
    box-sizing: border-box;
}

/* ─── Header ─── */
.jbp-header {
    padding: 32px 32px 0;
    text-align: center;
}
.jbp-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--jbp-text);
    letter-spacing: -0.025em;
    line-height: 1.3;
}
.jbp-subtitle {
    font-size: 14px;
    color: var(--jbp-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ─── Steps ─── */
.jbp-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 24px 32px;
}
.jbp-step {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: .4;
    transition: opacity .35s ease;
}
.jbp-step.active { opacity: 1; }
.jbp-step.done   { opacity: .75; }

.jbp-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--jbp-border);
    color: var(--jbp-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    transition: all .35s ease;
    flex-shrink: 0;
}
.jbp-step.active .jbp-step-num {
    background: var(--jbp-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .3);
}
.jbp-step.done .jbp-step-num {
    background: var(--jbp-success);
    color: #fff;
}
.jbp-step-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--jbp-text-muted);
    white-space: nowrap;
    transition: color .35s ease;
}
.jbp-step.active .jbp-step-label { color: var(--jbp-text); font-weight: 600; }

.jbp-step-line {
    width: 36px;
    height: 2px;
    background: var(--jbp-border);
    margin: 0 10px;
    flex-shrink: 0;
    border-radius: 2px;
    transition: background .35s ease;
}
.jbp-step.done + .jbp-step-line,
.jbp-step-line.done {
    background: var(--jbp-success);
}

/* ─── Panels ─── */
.jbp-panel {
    padding: 0 32px 32px;
}
.jbp-panel-animate {
    animation: jbpSlideIn .35s cubic-bezier(.4, 0, .2, 1);
}
@keyframes jbpSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes jbpFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ─── Calendar ─── */
.jbp-calendar-wrap {
    background: var(--jbp-surface);
    border: 1px solid var(--jbp-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.jbp-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.jbp-cal-month-year {
    font-size: 16px;
    font-weight: 700;
    color: var(--jbp-text);
}
.jbp-cal-prev,
.jbp-cal-next {
    background: var(--jbp-bg);
    border: 1px solid var(--jbp-border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 16px;
    color: var(--jbp-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
}
.jbp-cal-prev:hover,
.jbp-cal-next:hover {
    background: var(--jbp-primary);
    color: #fff;
    border-color: var(--jbp-primary);
}
.jbp-cal-prev:disabled {
    opacity: .3;
    cursor: default;
    pointer-events: none;
}
.jbp-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 6px;
}
.jbp-cal-weekdays span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--jbp-text-muted);
    text-align: center;
    padding: 6px 0;
}
.jbp-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}
.jbp-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s ease;
    border: none;
    background: none;
    color: var(--jbp-text);
    padding: 0;
    min-width: 36px;
    min-height: 36px;
}
.jbp-cal-day:hover:not(.disabled):not(.selected) {
    background: rgba(37, 99, 235, .08);
    color: var(--jbp-primary);
}
.jbp-cal-day.selected {
    background: var(--jbp-primary);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}
.jbp-cal-day.today:not(.selected) {
    box-shadow: inset 0 0 0 2px var(--jbp-primary);
    font-weight: 700;
    color: var(--jbp-primary);
}
.jbp-cal-day.disabled {
    color: #d1d5db;
    cursor: default;
    pointer-events: none;
}
.jbp-cal-day.other-month {
    color: #d1d5db;
}

/* ─── Time Slots ─── */
.jbp-slots-wrap {
    margin-top: 8px;
}
.jbp-slots-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--jbp-text);
}
.jbp-selected-date-label {
    font-size: 13px;
    color: var(--jbp-text-muted);
    margin-bottom: 16px;
}
.jbp-slots-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.jbp-slot-btn {
    background: var(--jbp-bg);
    border: 1.5px solid var(--jbp-border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
    text-align: center;
    color: var(--jbp-text);
    line-height: 1.4;
    width: 100%;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jbp-slot-btn:hover:not(.unavailable):not(.selected) {
    border-color: var(--jbp-primary-light);
    background: rgba(37, 99, 235, .04);
    color: var(--jbp-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .1);
}
.jbp-slot-btn.selected {
    border-color: var(--jbp-primary);
    background: var(--jbp-primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(37, 99, 235, .3);
    transform: translateY(-1px);
}
.jbp-slot-btn.unavailable {
    opacity: .35;
    cursor: not-allowed;
    background: var(--jbp-surface);
    pointer-events: none;
}
.jbp-slot-btn.unavailable .jbp-slot-time {
    text-decoration: line-through;
}
.jbp-slot-time {
    display: block;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.jbp-slot-avail {
    font-size: 10px;
    display: block;
    margin-top: 3px;
    opacity: .6;
    font-weight: 500;
}
.jbp-slot-btn.selected .jbp-slot-avail { opacity: .8; }

/* Slots loading skeleton */
.jbp-slots-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.jbp-skeleton-slot {
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--jbp-surface) 25%, #eef2f7 50%, var(--jbp-surface) 75%);
    background-size: 200% 100%;
    animation: jbpShimmer 1.5s ease infinite;
}
@keyframes jbpShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* No slots message */
.jbp-no-slots {
    text-align: center;
    color: var(--jbp-text-muted);
    font-size: 13px;
    padding: 24px 0;
    line-height: 1.6;
}

/* ─── Fields ─── */
.jbp-fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.jbp-field-row {
    display: flex;
    gap: 14px;
}
.jbp-field-half {
    flex: 1;
    min-width: 0;
}
@media (max-width: 480px) {
    .jbp-field-row {
        flex-direction: column;
        gap: 18px;
    }
}
.jbp-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--jbp-text);
    margin-bottom: 6px;
}
.jbp-req { color: var(--jbp-danger); }

.jbp-field input,
.jbp-field select,
.jbp-field textarea {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    border: 1.5px solid var(--jbp-border);
    border-radius: 10px;
    background: var(--jbp-bg);
    color: var(--jbp-text);
    transition: border-color .2s ease, box-shadow .2s ease;
    box-sizing: border-box;
    font-family: inherit;
}
.jbp-field input::placeholder,
.jbp-field textarea::placeholder {
    color: #94a3b8;
}
.jbp-field input:focus,
.jbp-field select:focus,
.jbp-field textarea:focus {
    outline: none;
    border-color: var(--jbp-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.jbp-field input.jbp-invalid,
.jbp-field select.jbp-invalid {
    border-color: var(--jbp-danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .08);
}
.jbp-field textarea {
    resize: vertical;
    min-height: 80px;
}

/* ─── Summary ─── */
.jbp-summary h4 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--jbp-text);
}
.jbp-summary-card {
    background: var(--jbp-surface);
    border: 1px solid var(--jbp-border);
    border-radius: 12px;
    overflow: hidden;
}
.jbp-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 18px;
    border-bottom: 1px solid var(--jbp-border);
    gap: 12px;
}
.jbp-summary-row:last-child { border-bottom: none; }

.jbp-summary-label {
    font-size: 13px;
    color: var(--jbp-text-muted);
    flex-shrink: 0;
}
.jbp-summary-value {
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

/* ─── Navigation ─── */
.jbp-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    gap: 12px;
}
.jbp-btn {
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all .2s ease;
    font-family: inherit;
    line-height: 1.4;
}
.jbp-btn-next,
.jbp-btn-submit {
    background: var(--jbp-primary);
    color: #fff;
}
.jbp-btn-next:hover:not(:disabled),
.jbp-btn-submit:hover:not(:disabled) {
    background: var(--jbp-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37, 99, 235, .25);
}
.jbp-btn-next:disabled,
.jbp-btn-submit:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.jbp-btn-back {
    background: var(--jbp-surface);
    color: var(--jbp-text-muted);
    border: 1px solid var(--jbp-border);
}
.jbp-btn-back:hover {
    background: var(--jbp-border);
    color: var(--jbp-text);
}

/* ─── Success ─── */
.jbp-success-panel {
    text-align: center;
    padding: 48px 32px;
}
.jbp-success-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--jbp-success-light);
    color: var(--jbp-success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
    margin: 0 auto 20px;
    animation: jbpPop .4s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes jbpPop {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}
.jbp-success-title {
    font-size: 21px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--jbp-text);
}
.jbp-success-msg {
    font-size: 14px;
    color: var(--jbp-text-muted);
    line-height: 1.6;
    margin: 0 0 4px;
}
.jbp-success-id {
    font-size: 13px;
    color: var(--jbp-text-muted);
    margin: 0 0 24px;
}
.jbp-btn-new {
    background: var(--jbp-bg);
    color: var(--jbp-primary);
    border: 1.5px solid var(--jbp-primary);
}
.jbp-btn-new:hover {
    background: var(--jbp-primary);
    color: #fff;
}

/* ─── Error ─── */
.jbp-error {
    margin: 0 32px 16px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #991b1b;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    animation: jbpFadeIn .25s ease;
}

/* ─── Loading ─── */
.jbp-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: jbpSpin .6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}
@keyframes jbpSpin {
    to { transform: rotate(360deg); }
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
    .jbp-booking-form {
        border-radius: 12px;
        margin: 0 8px;
    }
    .jbp-panel { padding: 0 20px 24px; }
    .jbp-header { padding: 24px 20px 0; }
    .jbp-steps { padding: 20px; }
    .jbp-step-label { display: none; }
    .jbp-slots-list { grid-template-columns: repeat(2, 1fr); }
    .jbp-cal-day { min-width: 30px; min-height: 30px; font-size: 12px; }
    .jbp-title { font-size: 19px; }
    .jbp-cal-month-year { font-size: 14px; }
    .jbp-calendar-wrap { padding: 14px; }
    .jbp-slot-btn { padding: 10px 8px; font-size: 12px; }
    .jbp-error { margin: 0 20px 12px; }
    .jbp-summary-row { padding: 11px 14px; }
    .jbp-nav { margin-top: 20px; }
    .jbp-btn { padding: 11px 20px; font-size: 13px; }
}

@media (max-width: 380px) {
    .jbp-booking-form { margin: 0; border-radius: 0; box-shadow: none; }
    .jbp-panel { padding: 0 16px 20px; }
    .jbp-header { padding: 20px 16px 0; }
    .jbp-steps { padding: 16px; }
    .jbp-slots-list { grid-template-columns: 1fr 1fr; gap: 8px; }
    .jbp-slot-btn { padding: 10px 6px; }
}

/* ─── Contact Notice ─── */
.jbp-contact-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 20px 24px 24px;
    padding: 14px 18px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 10px;
    color: #92400e;
    font-size: 13px;
    line-height: 1.5;
}
.jbp-notice-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ─── Slot Loading State ─── */
.jbp-slot-btn.jbp-slot-loading {
    opacity: 0.7;
    pointer-events: none;
}
.jbp-checking {
    font-size: 11px;
    color: var(--jbp-text-muted);
    font-style: italic;
}
@keyframes jbp-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
.jbp-slot-loading {
    animation: jbp-pulse 1.2s ease-in-out infinite;
}

/* ─── Lab Address Select ─── */
.jbp-field select#jbp-address {
    appearance: auto;
    cursor: pointer;
    background-color: var(--jbp-surface);
}
