/*
 * TASK-013 — Calendly-style slot picker.
 *
 * Shared between /book-call/ (pool mode, anonymous) and /advisor/my/book/
 * (paid mode, advisor name + avatar). Mobile-first, brand-aligned, smooth.
 *
 * Brand tokens (matches home.css):
 *   - Primary CTA: linear-gradient(135deg, #e05a0a, #f28c28)
 *   - Body bg:    #F8FBFF
 *   - Card:       #ffffff
 *   - 12px radius
 *   - Poppins font
 */

.slot-picker {
    --sp-orange: #e05a0a;
    --sp-orange-light: #f28c28;
    --sp-cta: linear-gradient(135deg, #e05a0a, #f28c28);
    --sp-blue: #2563eb;
    --sp-ink: #0f172a;
    --sp-ink-soft: #334155;
    --sp-muted: #64748b;
    --sp-line: #e2e8f0;
    --sp-bg: #f8fbff;
    --sp-card: #ffffff;
    --sp-radius: 12px;
    --sp-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(37, 99, 235, 0.06);

    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--sp-ink);
    background: var(--sp-card);
    border: 1px solid var(--sp-line);
    border-radius: 16px;
    box-shadow: var(--sp-shadow);
    overflow: hidden;
    max-width: 760px;
    margin: 0 auto;
}

/* ── Header ───────────────────────────────────────────────────────── */
.sp-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.1rem 1.35rem 0.9rem;
    border-bottom: 1px solid var(--sp-line);
    flex-wrap: wrap;
}
.sp-advisor {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}
.sp-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fde6d0, #fef3c7);
    color: var(--sp-orange);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}
.sp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sp-advisor__name {
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin: 0;
}
.sp-advisor__tagline {
    font-size: 0.78rem;
    color: var(--sp-muted);
    margin: 0.15rem 0 0;
    line-height: 1.3;
}
.sp-tz-pill {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.85rem;
    background: #f8fafc;
    border: 1px solid var(--sp-line);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--sp-ink-soft);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.sp-tz-pill:hover {
    background: #fff;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.sp-tz-pill__caret { color: var(--sp-muted); font-size: 0.7rem; }

.sp-cross-tz-note {
    grid-column: 1 / -1;
    margin: 0 1.35rem 0.5rem;
    padding: 0.55rem 0.85rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    color: #9a3412;
    font-size: 0.82rem;
    line-height: 1.4;
}
.sp-cross-tz-note[hidden] { display: none; }

/* ── Two-column body ──────────────────────────────────────────────── */
.sp-body {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    min-height: 380px;
}

/* Left column — month grid */
.sp-cal {
    padding: 1.1rem 1.25rem;
    border-right: 1px solid var(--sp-line);
}
.sp-cal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}
.sp-cal__title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    margin: 0;
}
.sp-cal__nav {
    display: flex;
    gap: 0.25rem;
}
.sp-cal__nav button {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--sp-line);
    background: #fff;
    color: var(--sp-ink-soft);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.sp-cal__nav button:hover:not([disabled]) {
    background: var(--sp-bg);
    border-color: #cbd5e1;
    color: var(--sp-ink);
}
.sp-cal__nav button[disabled] { opacity: 0.4; cursor: not-allowed; }

.sp-cal__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.18rem;
}
.sp-cal__dow {
    text-align: center;
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--sp-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.5rem 0 0.4rem;
}
.sp-day {
    aspect-ratio: 1 / 1;
    border: none;
    background: transparent;
    border-radius: 10px;
    color: var(--sp-ink);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-day:hover:not([disabled]) {
    background: rgba(224, 90, 10, 0.08);
    color: var(--sp-orange);
}
.sp-day[disabled] { color: #cbd5e1; cursor: not-allowed; }
.sp-day--other-month { color: #cbd5e1; }
.sp-day--today { font-weight: 700; color: var(--sp-blue); }
.sp-day--has-slots::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--sp-orange);
}
.sp-day--selected,
.sp-day[aria-selected="true"] {
    background: var(--sp-cta);
    color: #fff;
    box-shadow: 0 4px 12px rgba(224, 90, 10, 0.30);
}
.sp-day--selected::after,
.sp-day[aria-selected="true"]::after { background: #fff; }

/* Right column — time pills */
.sp-times {
    padding: 1.1rem 1.25rem 1.5rem;
    min-width: 0;
}
.sp-times__header {
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.005em;
}
/* ── Social-proof badge ("{N} people booked today") ───────────────── */
.sp-proof {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.85rem;
    padding: 0.4rem 0.7rem 0.4rem 0.6rem;
    border-radius: 999px;
    background: #fff4ea;
    border: 1px solid rgba(224, 90, 10, 0.22);
    color: #7c2d12;
    font-size: 0.82rem;
    line-height: 1.2;
    box-shadow: 0 0 0 0 rgba(224, 90, 10, 0.35);
    animation: sp-proof-glow 2.6s ease-out infinite;
}
.sp-proof[hidden] { display: none; }
.sp-proof__text strong {
    color: var(--sp-orange);
    font-weight: 700;
}
.sp-proof__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sp-orange);
    box-shadow: 0 0 0 0 rgba(224, 90, 10, 0.5);
    animation: sp-proof-pulse 1.8s ease-out infinite;
    flex-shrink: 0;
}
@keyframes sp-proof-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(224, 90, 10, 0.5); }
    70%  { box-shadow: 0 0 0 7px rgba(224, 90, 10, 0); }
    100% { box-shadow: 0 0 0 0 rgba(224, 90, 10, 0); }
}
@keyframes sp-proof-glow {
    0%   { box-shadow: 0 0 0 0 rgba(224, 90, 10, 0.18); }
    60%  { box-shadow: 0 0 14px 2px rgba(224, 90, 10, 0.12); }
    100% { box-shadow: 0 0 0 0 rgba(224, 90, 10, 0.18); }
}
@media (prefers-reduced-motion: reduce) {
    .sp-proof, .sp-proof__dot { animation: none; }
}
.sp-times__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.25rem;
}
.sp-time-pill {
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--sp-line);
    background: #fff;
    color: var(--sp-ink);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
    text-align: center;
}
.sp-time-pill:hover {
    transform: scale(1.03);
    border-color: var(--sp-orange);
    box-shadow: 0 4px 12px rgba(224, 90, 10, 0.12);
}
.sp-time-pill[aria-selected="true"] {
    background: var(--sp-cta);
    color: #fff;
    border-color: transparent;
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(224, 90, 10, 0.28);
}
.sp-times__empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--sp-muted);
    padding: 2rem 1rem;
    font-size: 0.9rem;
}

/* ── Confirm bar (sticky, animated) ───────────────────────────────── */
.sp-confirm {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--sp-line);
    padding: 0.95rem 1.35rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    transform: translateY(110%);
    transition: transform 0.25s ease-out;
}
.sp-confirm[data-active="true"] {
    transform: translateY(0);
}
.sp-confirm__summary {
    flex: 1;
    min-width: 0;
}
.sp-confirm__line1 {
    font-size: 0.9rem;
    color: var(--sp-muted);
    margin: 0 0 0.15rem;
}
.sp-confirm__line2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--sp-ink);
    letter-spacing: -0.005em;
    margin: 0;
}
.sp-confirm__btn {
    background: var(--sp-cta);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(224, 90, 10, 0.25);
    transition: transform 0.15s, box-shadow 0.15s;
}
.sp-confirm__btn:hover { transform: translateY(-1px); }

/* ── TZ dropdown (positioned absolutely) ──────────────────────────── */
.sp-tz-menu {
    position: absolute;
    background: #fff;
    border: 1px solid var(--sp-line);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.10);
    padding: 0.4rem;
    min-width: 240px;
    z-index: 100;
    display: none;
    max-height: 320px;
    overflow-y: auto;
}
.sp-tz-menu[data-open="true"] { display: block; }
.sp-tz-menu input {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--sp-line);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}
.sp-tz-menu input:focus { outline: none; border-color: var(--sp-orange); }
.sp-tz-menu button {
    display: block;
    width: 100%;
    padding: 0.55rem 0.7rem;
    background: transparent;
    border: none;
    text-align: left;
    font-family: inherit;
    font-size: 0.86rem;
    color: var(--sp-ink-soft);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.1s;
}
.sp-tz-menu button:hover,
.sp-tz-menu button[aria-selected="true"] {
    background: var(--sp-bg);
    color: var(--sp-ink);
}
.sp-tz-menu__divider {
    height: 1px;
    background: var(--sp-line);
    margin: 0.3rem 0;
}

/* ── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .sp-body {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .sp-cal {
        border-right: none;
        border-bottom: 1px solid var(--sp-line);
        padding: 0.85rem 1rem 0.6rem;
    }
    .sp-cal__grid {
        gap: 0.1rem;
    }
    .sp-day { font-size: 0.82rem; }
    .sp-times {
        padding: 0.85rem 1rem 1.5rem;
    }
    .sp-times__list {
        grid-template-columns: repeat(2, 1fr);
        max-height: 220px;
    }
    .sp-header {
        padding: 0.9rem 1rem;
    }
    .sp-confirm {
        padding: 0.85rem 1rem;
    }
    .sp-confirm__btn {
        width: 100%;
    }
}

/* ── Focus rings for keyboard nav ─────────────────────────────────── */
.sp-day:focus-visible,
.sp-time-pill:focus-visible,
.sp-tz-pill:focus-visible,
.sp-cal__nav button:focus-visible {
    outline: 2px solid var(--sp-orange);
    outline-offset: 2px;
}
