/* ═══════════════════════════════════════════════════════════════════════════
   Aurora Booking Chatbot — Styles
   ═══════════════════════════════════════════════════════════════════════════
   All colors derived from --abc-accent (injected via PHP inline style).
   Mobile-first, fully responsive.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ─── */
:root {
    /* --abc-accent is set dynamically via PHP; fallback here */
    --abc-accent: #1a6b8a;
    --abc-accent-light: color-mix(in srgb, var(--abc-accent) 12%, white);
    --abc-accent-dark: color-mix(in srgb, var(--abc-accent) 85%, black);
    --abc-radius: 16px;
    --abc-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    --abc-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --abc-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FLOATING BUBBLE
   ═══════════════════════════════════════════════════════════════════════════ */

.abc-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--abc-accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--abc-shadow);
    transition: transform var(--abc-transition), box-shadow var(--abc-transition);
    animation: abc-pulse 2.5s ease-in-out infinite;
}

.abc-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.24);
}

.abc-bubble:focus-visible {
    outline: 3px solid var(--abc-accent);
    outline-offset: 3px;
}

/* Pulse animation — subtle scale + shadow */
@keyframes abc-pulse {
    0%, 100% {
        box-shadow: var(--abc-shadow), 0 0 0 0 rgba(26, 107, 138, 0.4);
    }
    50% {
        box-shadow: var(--abc-shadow), 0 0 0 12px rgba(26, 107, 138, 0);
    }
}

/* Hide bubble when chat is open */
.abc-bubble.abc-hidden {
    transform: scale(0);
    pointer-events: none;
}

.abc-bubble-icon {
    width: 28px;
    height: 28px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.abc-chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    width: 380px;
    max-height: 560px;
    display: flex;
    flex-direction: column;
    border-radius: var(--abc-radius);
    overflow: hidden;
    box-shadow: var(--abc-shadow);
    background: #fff;
    /* Hidden by default — transitions */
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity var(--abc-transition), transform var(--abc-transition);
}

/* Open state */
.abc-chatbot.abc-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ─── Header ─── */
.abc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--abc-accent);
    color: #fff;
    flex-shrink: 0;
}

.abc-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.abc-avatar {
    font-size: 22px;
    line-height: 1;
}

.abc-header-name {
    font-weight: 600;
    font-size: 16px;
}

.abc-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.abc-close:hover,
.abc-close:focus-visible {
    opacity: 1;
}

.abc-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ─── Messages area ─── */
.abc-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 200px;
    max-height: 400px;
}

/* Scrollbar styling */
.abc-messages::-webkit-scrollbar {
    width: 5px;
}
.abc-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

/* ─── Message bubbles ─── */
.abc-msg {
    max-width: 90%;
    opacity: 0;
    transform: translateY(10px);
    animation: abc-msg-in 0.35s ease forwards;
}

@keyframes abc-msg-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bot messages */
.abc-msg-bot {
    align-self: flex-start;
}

.abc-msg-bot .abc-msg-bubble {
    background: var(--abc-accent-light, #eef5f8);
    color: #1a1a1a;
    border-radius: 4px 16px 16px 16px;
    padding: 14px 18px;
    font-size: 14.5px;
    line-height: 1.55;
    white-space: pre-line;
}

/* User messages */
.abc-msg-user {
    align-self: flex-end;
}

.abc-msg-user .abc-msg-bubble {
    background: var(--abc-accent);
    color: #fff;
    border-radius: 16px 4px 16px 16px;
    padding: 12px 18px;
    font-size: 14.5px;
    line-height: 1.5;
}

/* ─── Typing indicator ─── */
.abc-typing {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    background: var(--abc-accent-light, #eef5f8);
    border-radius: 4px 16px 16px 16px;
    align-self: flex-start;
    width: fit-content;
}

.abc-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--abc-accent);
    opacity: 0.4;
    animation: abc-typing-bounce 1.2s ease-in-out infinite;
}

.abc-typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}
.abc-typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes abc-typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHIP SELECTORS (dates & services)
   ═══════════════════════════════════════════════════════════════════════════ */

.abc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    list-style: none;
    padding: 0;
}

/* Horizontal scroll for date chips */
.abc-chips-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.abc-chips-scroll::-webkit-scrollbar {
    height: 3px;
}
.abc-chips-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 3px;
}

.abc-chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: 24px;
    border: 1.5px solid #d4dbe0;
    background: #fff;
    color: #333;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    scroll-snap-align: start;
    user-select: none;
    -webkit-user-select: none;
}

.abc-chip:hover {
    border-color: var(--abc-accent);
    color: var(--abc-accent);
    background: var(--abc-accent-light, #eef5f8);
}

.abc-chip:focus-visible {
    outline: 3px solid var(--abc-accent);
    outline-offset: 2px;
}

.abc-chip.abc-chip-selected {
    background: var(--abc-accent);
    color: #fff;
    border-color: var(--abc-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SUMMARY CARD (Step 3)
   ═══════════════════════════════════════════════════════════════════════════ */

.abc-summary-card {
    background: #f8fafb;
    border-radius: 12px;
    padding: 18px;
    margin-top: 10px;
    border: 1px solid #e5eaed;
}

.abc-summary-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 14.5px;
    color: #333;
}

.abc-summary-row span:first-child {
    font-size: 18px;
    flex-shrink: 0;
}

.abc-cta {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    background: var(--abc-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}

.abc-cta:hover {
    background: var(--abc-accent-dark, #14566e);
    transform: translateY(-1px);
}

.abc-cta:focus-visible {
    outline: 3px solid var(--abc-accent);
    outline-offset: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER (Restart button)
   ═══════════════════════════════════════════════════════════════════════════ */

.abc-footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    text-align: center;
    flex-shrink: 0;
    display: none;  /* shown via JS when conversation is complete */
}

.abc-footer.abc-visible {
    display: block;
}

.abc-restart {
    background: none;
    border: 1px solid #d4dbe0;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.abc-restart:hover {
    border-color: var(--abc-accent);
    color: var(--abc-accent);
}

.abc-restart:focus-visible {
    outline: 3px solid var(--abc-accent);
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .abc-chatbot {
        width: 90vw;
        right: 5vw;
        bottom: 16px;
        max-height: calc(100dvh - 32px);
    }

    .abc-bubble {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .abc-bubble-icon {
        width: 24px;
        height: 24px;
    }

    .abc-messages {
        padding: 16px;
        max-height: calc(100dvh - 180px);
    }

    .abc-msg-bot .abc-msg-bubble,
    .abc-msg-user .abc-msg-bubble {
        font-size: 14px;
    }

    .abc-chip {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* Small height screens (landscape mobile) */
@media (max-height: 600px) {
    .abc-chatbot {
        max-height: calc(100dvh - 32px);
    }

    .abc-messages {
        max-height: calc(100dvh - 180px);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY — REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .abc-bubble {
        animation: none;
    }

    .abc-chatbot,
    .abc-msg,
    .abc-chip,
    .abc-cta {
        transition: none;
        animation: none;
    }

    .abc-msg {
        opacity: 1;
        transform: none;
    }

    .abc-typing-dot {
        animation: none;
        opacity: 0.6;
    }
}
