/* Medical Appointment Booking – Public Styles */
.mab-booking-wrap * { box-sizing: border-box; }

.mab-booking-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 760px;
    margin: 32px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
    overflow: hidden;
}

/* Header */
.mab-header {
    padding: 28px 36px 20px;
    color: #fff;
}
.mab-header h2 { margin: 0 0 6px; font-size: 24px; }
.mab-header p  { margin: 0; opacity: .88; font-size: 15px; }

/* Progress steps */
.mab-steps {
    display: flex;
    padding: 0 36px;
    background: rgba(0,0,0,.12);
}
.mab-step {
    flex: 1;
    padding: 10px 0;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,.65);
    border-bottom: 3px solid transparent;
    cursor: default;
    transition: color .2s, border-color .2s;
}
.mab-step.active  { color: #fff; border-bottom-color: #fff; font-size: 14px; }
.mab-step.done    { color: rgba(255,255,255,.85); }

/* Body */
.mab-body { padding: 32px 36px; }

/* Step panels */
.mab-panel { display: none; }
.mab-panel.active { display: block; animation: mabFadeIn 0.3s ease; }
@keyframes mabFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.mab-panel h3 { margin: 0 0 20px; font-size: 18px; color: #1a1a2e; }

/* Grid of cards */
.mab-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}
.mab-card-item {
    border: 2px solid #e4e4e4;
    border-radius: 10px;
    padding: 18px 16px;
    cursor: pointer;
    transition: border-color .18s, background .18s, transform .15s;
    position: relative;
}
.mab-card-item:hover   { border-color: var(--mab-brand, #0073aa); transform: translateY(-2px); }
.mab-card-item.selected { border-color: var(--mab-brand, #0073aa); background: color-mix(in srgb, var(--mab-brand,#0073aa) 8%, #fff); }
.mab-card-item .mab-card-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.mab-card-item .mab-card-sub   { font-size: 13px; color: #666; }
.mab-card-item .mab-check {
    position: absolute; top: 10px; right: 10px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--mab-brand, #0073aa); color: #fff;
    display: none; align-items: center; justify-content: center; font-size: 12px;
}
.mab-card-item.selected .mab-check { display: flex; }

/* Doctor card with photo */
.mab-doctor-photo {
    width: 56px; height: 56px; border-radius: 50%;
    object-fit: cover; margin-bottom: 10px; background: #eee;
}

/* Date picker */
.mab-date-input {
    padding: 10px 14px; border: 2px solid #e4e4e4; border-radius: 8px;
    font-size: 16px; width: 100%; max-width: 260px;
    transition: border-color .18s;
}
.mab-date-input:focus { border-color: var(--mab-brand, #0073aa); outline: none; }

/* Slots */
.mab-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 16px;
}
.mab-slot {
    padding: 12px 8px;
    border: 2px solid #e8eaf0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    background: #fff;
    text-align: center;
    transition: all .15s;
}
.mab-slot:hover    { border-color: var(--mab-brand,#0073aa); color: var(--mab-brand,#0073aa); background: #f0f7ff; }
.mab-slot.selected { border-color: var(--mab-brand,#0073aa); background: var(--mab-brand,#0073aa); color: #fff; }
.mab-slot.mab-slot-booked {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    position: relative;
    text-decoration: line-through;
    opacity: 0.7;
}

/* Form fields */
.mab-field { margin-bottom: 18px; }
.mab-field label { display: block; font-weight: 600; margin-bottom: 6px; color: #333; font-size: 14px; }
.mab-field input,
.mab-field textarea {
    width: 100%; padding: 10px 14px;
    border: 2px solid #e4e4e4; border-radius: 8px;
    font-size: 15px; transition: border-color .18s;
}
.mab-field input:focus,
.mab-field textarea:focus { border-color: var(--mab-brand,#0073aa); outline: none; }
.mab-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Summary box */
.mab-summary {
    background: #f6f8fb; border-radius: 10px; padding: 20px 24px; margin-bottom: 20px;
}
.mab-summary h4 { margin: 0 0 14px; font-size: 16px; }
.mab-summary-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #eee; font-size: 14px; }
.mab-summary-row:last-child { border-bottom: none; }
.mab-summary-row span:first-child { color: #666; }
.mab-summary-row span:last-child  { font-weight: 600; }

/* Navigation */
.mab-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; }
.mab-btn {
    display: inline-block;
    padding: 12px 28px; border-radius: 8px; font-size: 15px; font-weight: 600;
    cursor: pointer; border: none; transition: opacity .2s, transform .15s;
    user-select: none; -webkit-user-select: none;
}
.mab-btn:hover { opacity: .88; transform: translateY(-1px); }
.mab-btn-primary { background: var(--mab-brand,#0073aa); color: #fff; }
.mab-btn-secondary { background: #f0f0f0; color: #333; }
.mab-success .mab-btn-secondary,
a.mab-btn-secondary[href],
#mab-book-another {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(220,38,38,.35) !important;
    font-size: 16px !important;
    padding: 14px 32px !important;
    border-radius: 10px !important;
}
.mab-success .mab-btn-secondary:hover,
a.mab-btn-secondary[href]:hover,
#mab-book-another:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(220,38,38,.45) !important;
}
.mab-btn.mab-next-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* Success */
.mab-success {
    text-align: center; padding: 40px 20px;
}
.mab-success-icon {
    width: 72px; height: 72px; border-radius: 50%;
    background: #d1e7dd; display: flex; align-items: center; justify-content: center;
    font-size: 36px; margin: 0 auto 20px;
}
.mab-success h3 { color: #0a3622; font-size: 22px; margin-bottom: 10px; }
.mab-success p  { color: #555; font-size: 15px; }

/* Error/loading */
.mab-loading { text-align:center; color:#666; padding:16px; font-size:14px; }
.mab-error   { color:#d63638; font-size:14px; padding:10px 0; }
.mab-info    { color:#666;    font-size:14px; padding:10px 0; }

/* Leave notice & on-leave message */
.mab-leave-notice {
    background: #fff3cd; border-left: 3px solid #ffc107;
    padding: 10px 14px; border-radius: 4px;
    font-size: 13px; color: #664d03; margin-bottom: 14px;
}
.mab-on-leave-msg {
    background: #f8d7da; border-left: 3px solid #d63638;
    padding: 14px 16px; border-radius: 4px;
    font-size: 14px; color: #58151c; margin-top: 12px;
}

/* Payment badge */
.mab-payment-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff3cd; color: #664d03; border-radius: 20px;
    padding: 6px 14px; font-size: 13px; font-weight: 600; margin-bottom: 16px;
}

@media (max-width: 580px) {
    .mab-booking-wrap { border-radius: 0; margin: 0; }
    .mab-body, .mab-header { padding: 20px; }
    .mab-steps { padding: 0 20px; }
    .mab-field-row { grid-template-columns: 1fr; }
    .mab-cards { grid-template-columns: 1fr 1fr; }
}

/* ── Custom Calendar ─────────────────────────────────────────────────── */
/* ── Beautiful Calendar ─────────────────────────────────────────────── */
.mab-cal-wrap {
    background: #fff;
    border: 2px solid #e8eaf0;
    border-radius: 16px;
    padding: 20px;
    max-width: 440px;
    box-shadow: 0 4px 20px rgba(0,0,0,.07);
}
.mab-cal-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.mab-cal-header span { font-weight: 700; font-size: 18px; color: #1a1d23; letter-spacing: -.3px; }
.mab-cal-nav {
    background: #f4f5f7; border: none; border-radius: 8px;
    width: 38px; height: 38px; cursor: pointer; font-size: 18px;
    color: #374151; transition: background .15s; display: flex; align-items: center; justify-content: center;
}
.mab-cal-nav:hover { background: var(--mab-brand,#0073aa); color: #fff; }
.mab-cal-nav:disabled { opacity: .25; cursor: not-allowed; }
.mab-cal-nav:disabled:hover { background: #f4f5f7; color: #374151; }
.mab-cal-dow {
    display: grid; grid-template-columns: repeat(7,1fr); text-align: center;
    margin-bottom: 8px; border-bottom: 2px solid #f3f4f6; padding-bottom: 8px;
}
.mab-cal-dow div { font-size: 12px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: .5px; padding: 4px 0; }
.mab-cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 5px; }
.mab-cal-day {
    aspect-ratio: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-radius: 10px; font-size: 16px; font-weight: 600;
    cursor: pointer; border: 2px solid transparent;
    transition: all .15s; position: relative; color: #1a1d23; min-height: 46px;
}
.mab-cal-day:hover:not(.mab-cal-disabled):not(.mab-cal-leave):not(.mab-cal-holiday):not(.mab-cal-empty) {
    background: #e8f4fb;
    border-color: var(--mab-brand,#0073aa); color: var(--mab-brand,#0073aa); transform: scale(1.08);
}
.mab-cal-day:not(.mab-cal-disabled):not(.mab-cal-leave):not(.mab-cal-holiday):not(.mab-cal-empty):not(.mab-cal-selected)::after {
    content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
    width: 5px; height: 5px; border-radius: 50%; background: #10b981;
}
.mab-cal-day.mab-cal-selected {
    background: var(--mab-brand,#0073aa) !important; color: #fff !important;
    border-color: var(--mab-brand,#0073aa) !important; transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(0,115,170,.35);
}
.mab-cal-day.mab-cal-selected::after { display: none; }
.mab-cal-day.mab-cal-today:not(.mab-cal-selected):not(.mab-cal-disabled) {
    border: none;
    color: var(--mab-brand,#0073aa);
    background: transparent;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.mab-cal-day.mab-cal-today.mab-cal-disabled {
    border: none;
    color: #d1d5db;
    background: #fafafa;
}
.mab-cal-day.mab-cal-disabled { color: #d1d5db; cursor: not-allowed; background: #fafafa; }
.mab-cal-day.mab-cal-disabled::after { display: none; }
.mab-cal-day.mab-cal-leave {
    background: #fff1f2 !important; color: #e11d48 !important;
    cursor: not-allowed; border-color: #fecdd3 !important;
}
.mab-cal-day.mab-cal-leave::after {
    content: "x"; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
    font-size: 9px; color: #e11d48; font-weight: 900;
    width: auto; height: auto; border-radius: 0; background: none;
}
.mab-cal-day.mab-cal-holiday {
    background: #fffbeb !important; color: #d97706 !important;
    cursor: not-allowed; border-color: #fcd34d !important;
}
.mab-cal-day.mab-cal-holiday::after {
    content: "*"; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
    font-size: 10px; color: #d97706; font-weight: 700;
    width: auto; height: auto; border-radius: 0; background: none;
}
.mab-cal-day.mab-cal-empty { cursor: default; }
.mab-cal-day.mab-cal-empty::after { display: none; }
.mab-cal-legend {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 16px; padding-top: 14px; border-top: 2px solid #f3f4f6;
}
.mab-leg-item {
    display: flex; align-items: center; gap: 7px;
    font-size: 12px; font-weight: 600; color: #374151;
    padding: 7px 12px; border-radius: 8px; background: #f9fafb;
    flex: 1; justify-content: center; min-width: 100px;
}
.mab-leg-dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.mab-leg-avail   { background: #d1fae5; }
.mab-leg-leave   { background: #fff1f2; border: 1.5px solid #fecdd3; }
.mab-leg-holiday { background: #fffbeb; border: 1.5px solid #fcd34d; }
.mab-leg-past    { background: #f3f4f6; border: 1.5px solid #e5e7eb; }
.mab-cal-loading { text-align: center; padding: 24px; color: #999; font-size: 13px; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile First
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tablet (max 768px) ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .mab-booking-wrap {
        border-radius: 12px;
        margin: 0 8px;
    }
    .mab-header {
        padding: 20px 18px 16px;
    }
    .mab-header h2 {
        font-size: 22px !important;
    }
    .mab-steps {
        padding: 0 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .mab-step {
        font-size: 11px;
        padding: 8px 4px;
        min-width: 60px;
        flex-shrink: 0;
    }
    .mab-body {
        padding: 22px 18px;
    }
    /* Cards grid - 2 cols on tablet */
    .mab-cards {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    /* Calendar */
    .mab-cal-wrap {
        max-width: 100%;
        padding: 14px;
    }
    .mab-cal-day {
        font-size: 14px;
        min-height: 38px;
        border-radius: 8px;
    }
    .mab-cal-header span {
        font-size: 16px;
    }
    /* Time slots - 3 cols on tablet */
    .mab-slots {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .mab-slot {
        padding: 10px 6px;
        font-size: 13px;
    }
    /* Form fields */
    .mab-field-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    /* Nav buttons */
    .mab-nav {
        margin-top: 20px;
    }
    .mab-btn {
        padding: 12px 22px;
        font-size: 14px;
    }
    /* Legend */
    .mab-cal-legend {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ── Mobile (max 480px) ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .mab-booking-wrap {
        border-radius: 10px;
        margin: 0 4px;
    }
    .mab-header {
        padding: 16px 14px 12px;
    }
    .mab-header h2 {
        font-size: 19px !important;
    }
    .mab-steps {
        padding: 0 8px;
        gap: 0;
    }
    .mab-step {
        font-size: 10px;
        padding: 8px 2px;
        min-width: 50px;
    }
    .mab-body {
        padding: 16px 14px;
    }
    /* Cards - 1 col on mobile */
    .mab-cards {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .mab-card-item {
        padding: 14px 16px;
        display: flex;
        align-items: center;
        gap: 12px;
        text-align: left;
    }
    .mab-card-item .mab-check {
        position: static;
        margin-left: auto;
    }
    /* Calendar - full width */
    .mab-cal-wrap {
        max-width: 100%;
        padding: 12px 10px;
        border-radius: 12px;
    }
    .mab-cal-grid {
        gap: 3px;
    }
    .mab-cal-day {
        font-size: 12px;
        min-height: 34px;
        border-radius: 7px;
    }
    .mab-cal-dow div {
        font-size: 10px;
    }
    .mab-cal-header span {
        font-size: 15px;
    }
    .mab-cal-nav {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }
    /* Hide green dot on very small screens */
    .mab-cal-day::after {
        width: 4px;
        height: 4px;
        bottom: 2px;
    }
    /* Time slots - 2 cols on mobile */
    .mab-slots {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    .mab-slot {
        padding: 10px 4px;
        font-size: 13px;
        border-radius: 8px;
    }
    /* Form fields - stack on mobile */
    .mab-field-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .mab-field input,
    .mab-field select,
    .mab-field textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    /* Nav buttons full width on mobile */
    .mab-nav {
        flex-direction: column-reverse;
        gap: 10px;
        margin-top: 20px;
    }
    .mab-btn {
        width: 100%;
        text-align: center;
        padding: 14px;
        font-size: 15px;
        border-radius: 10px;
    }
    /* Legend */
    .mab-cal-legend {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    /* Summary */
    .mab-summary-table td {
        font-size: 13px;
        padding: 8px 0;
    }
    /* Success */
    .mab-success {
        padding: 28px 14px;
    }
    .mab-success h3 {
        font-size: 20px;
    }
    #mab-conf-number {
        font-size: 32px !important;
        letter-spacing: 6px !important;
    }
    /* Payment badge */
    .mab-payment-badge {
        font-size: 12px;
        padding: 5px 12px;
    }
    /* Step tabs scroll hint */
    .mab-steps::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to right, transparent, rgba(255,255,255,.3));
        pointer-events: none;
    }
    .mab-steps {
        position: relative;
    }
}

/* ── Small mobile (max 360px) ───────────────────────────────────────────── */
@media (max-width: 360px) {
    .mab-header h2 { font-size: 17px !important; }
    .mab-step { font-size: 9px; min-width: 44px; }
    .mab-cal-day { font-size: 11px; min-height: 30px; }
    .mab-slots { grid-template-columns: repeat(2, 1fr); }
    .mab-slot { font-size: 12px; padding: 8px 2px; }
}

/* ── iOS Safari fix ─────────────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
    -webkit-appearance: none;
    appearance: none;
}

/* ── Touch targets ──────────────────────────────────────────────────────── */
@media (hover: none) {
    .mab-cal-day { min-height: 40px; }
    .mab-slot    { min-height: 44px; }
    .mab-btn     { min-height: 48px; }
    .mab-card-item { min-height: 56px; }
}

/* Step tab short/full labels */
.mab-step-short { display: none; }
.mab-step-full  { display: inline; }

@media (max-width: 380px) {
    .mab-step-short { display: inline; }
    .mab-step-full  { display: none; }
    .mab-step { font-size: 13px; font-weight: 700; }
}
