/* =====================================================================
   Appointment booking panel on mycard.aspx.
   Everything is scoped to .appt-* so existing card styles are untouched.
   Uses the card's tokens from mycardstyle.css (--primary, --accent, --border).
   ===================================================================== */
.appt {
    --appt-accent: var(--accent, #2563eb);
    --appt-accent-soft: #eff4ff;
    --appt-ink: var(--primary, #0f172a);
    --appt-muted: #64748b;
    --appt-line: var(--border, #e2e8f0);
    --appt-ok: #10b981;
    --appt-warn: #f59e0b;
    --appt-danger: #e5484d;
    font-family: Inter, 'Segoe UI', Arial, sans-serif;
    color: var(--appt-ink);
}

.appt-head { margin-bottom: 16px; }
.appt-title { font-family: Sora, Inter, sans-serif; font-size: 18px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.2px; }
.appt-sub { font-size: 13px; color: var(--appt-muted); margin: 0; line-height: 1.5; }

/* progress */
.appt-progress { display: flex; gap: 6px; margin: 14px 0 18px; }
.appt-progress span { flex: 1; height: 4px; border-radius: 4px; background: var(--appt-line); transition: background .3s; }
.appt-progress span.on { background: var(--appt-accent); }
.appt-step-label { font-size: 12px; font-weight: 600; color: var(--appt-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.appt-link { background: none; border: 0; padding: 0; color: var(--appt-accent); font-weight: 600; font-size: 12.5px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.appt-link:hover { text-decoration: underline; }

/* services */
.appt-services { display: grid; gap: 10px; }
.appt-service {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
    background: #fff; border: 1.5px solid var(--appt-line); border-radius: 14px; padding: 14px;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.appt-service:hover { border-color: #bfd0fb; transform: translateY(-1px); box-shadow: 0 8px 18px -12px rgba(37,99,235,.55); }
.appt-service.selected { border-color: var(--appt-accent); background: var(--appt-accent-soft); }
.appt-service-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; background: var(--appt-accent-soft); color: var(--appt-accent); display: grid; place-items: center; }
.appt-service.selected .appt-service-icon { background: var(--appt-accent); color: #fff; }
.appt-service-icon svg { width: 20px; height: 20px; }
/* service / provider photo set on the admin page */
.appt-service-icon.has-photo { width: 56px; height: 56px; flex-basis: 56px; padding: 0; overflow: hidden; background: #f1f5f9; }
.appt-service.selected .appt-service-icon.has-photo { background: #f1f5f9; box-shadow: 0 0 0 2px var(--appt-accent); }
.appt-summary-icon.has-photo { width: 48px; height: 48px; flex-basis: 48px; overflow: hidden; background: #f1f5f9; }
.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.appt-service-body { flex: 1; min-width: 0; }
.appt-service-name { font-weight: 700; font-size: 15px; }
.appt-service-desc { font-size: 12.5px; color: var(--appt-muted); margin-top: 2px; }
.appt-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.appt-pill { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: #f1f5f9; color: #334155; }
.appt-fee { font-weight: 700; font-size: 15px; white-space: nowrap; }

/* dates */
.appt-dates-wrap { position: relative; margin: 0 -4px 16px; }
.appt-dates { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px; scrollbar-width: none; }
.appt-dates::-webkit-scrollbar { display: none; }
.appt-date {
    flex: 0 0 66px; scroll-snap-align: start; border: 1.5px solid var(--appt-line); background: #fff; border-radius: 14px;
    padding: 9px 4px; text-align: center; cursor: pointer; transition: all .15s; color: var(--appt-ink);
}
.appt-date .wd { display: block; font-size: 11px; font-weight: 600; color: var(--appt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-date .dd { display: block; font-size: 20px; font-weight: 800; line-height: 1.2; font-family: Sora, Inter, sans-serif; }
.appt-date .mm { display: block; font-size: 11px; color: var(--appt-muted); }
.appt-date:hover:not(:disabled) { border-color: #bfd0fb; }
.appt-date.selected { background: var(--appt-accent); border-color: var(--appt-accent); color: #fff; }
.appt-date.selected .wd, .appt-date.selected .mm { color: rgba(255,255,255,.85); }
.appt-date:disabled { opacity: .4; cursor: not-allowed; background: #f8fafc; }
.appt-date:disabled .dd { text-decoration: line-through; text-decoration-thickness: 1.5px; }

/* slots */
.appt-period { font-size: 12px; font-weight: 700; color: var(--appt-muted); margin: 12px 0 8px; display: flex; align-items: center; gap: 6px; }
.appt-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.appt-slot {
    border: 1.5px solid var(--appt-line); background: #fff; border-radius: 10px; padding: 10px 4px;
    font-weight: 600; font-size: 13.5px; cursor: pointer; color: var(--appt-ink); transition: all .15s;
}
.appt-slot:hover { border-color: var(--appt-accent); color: var(--appt-accent); }
.appt-slot.selected { background: var(--appt-accent); border-color: var(--appt-accent); color: #fff; }
/* taken by another booking - locked until the owner cancels it */
.appt-slot.booked, .appt-slot.booked:hover {
    background: #f1f5f9; border-color: #e2e8f0; color: #94a3b8; cursor: not-allowed;
    text-decoration: line-through; padding: 6px 4px;
}
.appt-slot.booked small { display: block; font-size: 10.5px; font-weight: 600; text-decoration: none; color: #b42318; letter-spacing: .02em; }
.appt-legend { display: flex; gap: 14px; font-size: 12px; color: var(--appt-muted); margin: 10px 0 2px; }
.appt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.appt-dot { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--appt-line); background: #fff; display: inline-block; }
.appt-dot.booked { background: #f1f5f9; border-color: #e2e8f0; }
.appt-empty { text-align: center; padding: 26px 12px; color: var(--appt-muted); font-size: 13.5px; background: #f8fafc; border-radius: 14px; }
.appt-empty strong { display: block; color: var(--appt-ink); margin-bottom: 3px; font-size: 14.5px; }

/* form */
.appt-summary { display: flex; gap: 12px; align-items: center; background: var(--appt-accent-soft); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; }
.appt-summary-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; background: var(--appt-accent); color: #fff; display: grid; place-items: center; }
.appt-summary-icon svg { width: 20px; height: 20px; }
.appt-summary b { display: block; font-size: 14.5px; }
.appt-summary span { font-size: 12.5px; color: #475569; }
.appt-field { margin-bottom: 13px; }
.appt-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.appt-field label em { font-style: normal; font-weight: 500; color: var(--appt-muted); font-size: 12px; }
.appt-input {
    width: 100%; height: 46px; border: 1.5px solid var(--appt-line); border-radius: 12px; padding: 0 14px;
    font-size: 15px; font-family: inherit; color: var(--appt-ink); background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea.appt-input { height: 78px; padding: 11px 14px; resize: vertical; }
.appt-input:focus { outline: none; border-color: var(--appt-accent); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.appt-input.invalid { border-color: var(--appt-danger); }
.appt-err { color: var(--appt-danger); font-size: 12px; margin-top: 5px; font-weight: 500; display: none; }
.appt-err.show { display: block; }
.appt-seg { display: flex; background: #f1f5f9; border-radius: 12px; padding: 4px; gap: 4px; }
.appt-seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 9px; font-weight: 600; font-size: 13.5px; color: #475569; cursor: pointer; }
.appt-seg button.on { background: #fff; color: var(--appt-accent); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.appt-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* buttons */
.appt-actions { display: flex; gap: 10px; margin-top: 16px; }
.appt-btn {
    flex: 1; height: 48px; border: 0; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer;
    background: var(--appt-accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 10px 20px -10px rgba(37,99,235,.8); transition: transform .15s, opacity .15s; font-family: inherit; text-decoration: none;
}
.appt-btn:hover { transform: translateY(-1px); color: #fff; }
.appt-btn:disabled { opacity: .6; transform: none; cursor: default; }
.appt-btn.ghost { background: #f1f5f9; color: var(--appt-ink); box-shadow: none; flex: 0 0 auto; padding: 0 18px; }
.appt-btn.wa { background: #25d366; box-shadow: 0 10px 20px -10px rgba(37,211,102,.8); }
.appt-btn svg { width: 18px; height: 18px; }
.appt-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: apptSpin .7s linear infinite; }
.appt-loading { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 28px; color: var(--appt-muted); font-size: 13.5px; }
.appt-loading .appt-spinner { border-color: #cbd5e1; border-top-color: var(--appt-accent); }
@keyframes apptSpin { to { transform: rotate(360deg); } }

.appt-alert { display: none; background: #fdecec; color: #b42318; border: 1px solid #f8c9c9; border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.appt-alert.show { display: block; }

/* done */
.appt-done { text-align: center; padding: 6px 0 2px; }
.appt-done-badge { width: 70px; height: 70px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: #e7f8f0; color: var(--appt-ok); animation: apptPop .35s cubic-bezier(.2,1.4,.4,1); }
.appt-done-badge.pending { background: #fff5e0; color: var(--appt-warn); }
.appt-done-badge svg { width: 34px; height: 34px; }
@keyframes apptPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.appt-done h4 { font-family: Sora, Inter, sans-serif; font-weight: 700; font-size: 19px; margin: 0 0 4px; }
.appt-done p { color: var(--appt-muted); font-size: 13.5px; margin: 0 0 14px; }
.appt-ref { display: inline-flex; align-items: center; gap: 8px; background: #f1f5f9; border-radius: 10px; padding: 8px 14px; font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 16px; letter-spacing: .08em; margin-bottom: 14px; }
.appt-ref button { border: 0; background: none; color: var(--appt-accent); font-family: Inter, sans-serif; font-size: 12px; font-weight: 700; cursor: pointer; letter-spacing: 0; }
.appt-receipt { text-align: left; border: 1px solid var(--appt-line); border-radius: 14px; padding: 4px 14px; font-size: 13.5px; }
.appt-receipt div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--appt-line); }
.appt-receipt div:last-child { border-bottom: 0; }
.appt-receipt span { color: var(--appt-muted); }
.appt-receipt b { text-align: right; }
.appt-note { font-size: 12.5px; color: #475569; background: #f8fafc; border-radius: 10px; padding: 10px 12px; margin-top: 12px; text-align: left; }

.appt-foot { text-align: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--appt-line); }
.appt-foot-note { font-size: 12.5px; color: var(--appt-muted); }

@media (prefers-reduced-motion: reduce) {
    .appt *, .appt *::before { animation: none !important; transition: none !important; }
}
@media (max-width: 400px) {
    .appt-slots { grid-template-columns: repeat(3, 1fr); }
    .appt-service { padding: 12px; }
}
