/*
 * Apollo Chat Widget — chat-widget.css v2.0.0
 * Minimal: Tailwind CDN handles all utility classes.
 * This file only contains: animations, float panel transition,
 * verify-form show/hide toggle, and structural rules Tailwind can't cover.
 */

/* ── Animations ─────────────────────────────────────────────────────────────── */

@keyframes apollo-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-5px); }
}

@keyframes apollo-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .35; }
}

.apollo-live-dot {
    animation: apollo-pulse 2s infinite;
}

.apollo-dot:nth-child(1) { animation: apollo-bounce 1.2s infinite 0s; }
.apollo-dot:nth-child(2) { animation: apollo-bounce 1.2s infinite .2s; }
.apollo-dot:nth-child(3) { animation: apollo-bounce 1.2s infinite .4s; }

/* ── Uniform field base — overrides any WordPress theme interference ─────────── */
/* All selects, inputs and the verify button inside the widget share one token set */

.apollo-chat .apollo-field {
    box-sizing: border-box;
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}

/* Native select arrow — re-add after resetting appearance */
.apollo-chat .apollo-club-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.apollo-chat .apollo-field:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* Chat input — pill shape to differentiate the send row */
.apollo-chat .apollo-field--chat {
    height: 40px;
    border-radius: 9999px;
    padding: 0 16px;
    flex: 1;
}

/* Dark mode */
.apollo-chat.dark .apollo-field {
    color: #e2e8f0;
    background: #1e293b;
    border-color: #334155;
}

.apollo-chat.dark .apollo-field:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96,165,250,.15);
}

/* Verify button — matches field height, clean blue */
.apollo-chat .apollo-verify-btn {
    box-sizing: border-box;
    height: 38px;
    padding: 0 16px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: #3b82f6;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
    flex-shrink: 0;
}

.apollo-chat .apollo-verify-btn:hover { background: #2563eb; }

/* ── Verify form toggle ──────────────────────────────────────────────────────── */

.apollo-chat .apollo-verify-form {
    display: none;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 6px;
    align-items: center;
}

.apollo-chat .apollo-verify-form.is-visible {
    display: flex !important;
}

/* Force fields to respect flex — beats theme's width:100%/display:block rules */
.apollo-chat .apollo-verify-form .apollo-club-select {
    flex: 1 1 0% !important;
    width: auto !important;
    min-width: 0 !important;
    display: block !important;
}

.apollo-chat .apollo-verify-form .apollo-area-input {
    flex: 0 0 90px !important;
    width: 90px !important;
    min-width: 0 !important;
    display: block !important;
}

.apollo-chat .apollo-verify-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    display: block !important;
}

/* ── Floating panel open/close transition ────────────────────────────────────── */

.apollo-float-panel {
    transform-origin: bottom right;
    transition: opacity .2s ease, transform .2s ease;
}

.apollo-float-panel[aria-hidden="true"] {
    opacity: 0;
    transform: scale(.93) translateY(8px);
    pointer-events: none;
}

.apollo-float-panel[aria-hidden="false"] {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* ── Scrollbar (messages area) ───────────────────────────────────────────────── */

.apollo-messages::-webkit-scrollbar       { width: 4px; }
.apollo-messages::-webkit-scrollbar-track { background: transparent; }
.apollo-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }

/* Matches when JS adds .dark to the .apollo-chat container (class strategy) */
.dark .apollo-messages::-webkit-scrollbar-thumb { background: #475569; }

/* ── Disclaimer bar ──────────────────────────────────────────────────────────── */

.apollo-disclaimer {
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    padding: 4px 8px 2px;
    line-height: 1.5;
}

.dark .apollo-disclaimer { color: #64748b; }

.apollo-privacy-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 10px;
    color: #ef4444;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}

.apollo-privacy-link:hover { color: #dc2626; }

/* ── Turnstile verification overlay (inside .apollo-messages) ────────────────── */

.apollo-turnstile-overlay {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
}

.apollo-turnstile-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: apollo-spin 0.75s linear infinite;
}

@keyframes apollo-spin {
    to { transform: rotate(360deg); }
}

.apollo-turnstile-overlay-text {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    margin: 0;
}

.apollo-turnstile-overlay.is-error .apollo-turnstile-spinner {
    display: none;
}

.apollo-turnstile-error-icon {
    font-size: 28px;
    line-height: 1;
}

.apollo-turnstile-overlay.is-error .apollo-turnstile-overlay-text {
    color: #ef4444;
}

/* ── Privacy Policy modal ────────────────────────────────────────────────────── */

.apollo-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, .45);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.apollo-modal-backdrop.is-open {
    display: flex;
}

.apollo-modal-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.apollo-modal-header {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.apollo-modal-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.apollo-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color .15s;
}

.apollo-modal-close:hover { color: #334155; }

.apollo-modal-body {
    padding: 18px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.65;
    color: #334155;
}

.apollo-modal-body p          { margin: 0 0 0.75em; }
.apollo-modal-body p:last-child { margin-bottom: 0; }
.apollo-modal-body ul,
.apollo-modal-body ol         { margin: 0.4em 0 0.75em 1.4em; padding: 0; }
.apollo-modal-body li         { margin: 0.25em 0; }
.apollo-modal-body strong     { font-weight: 600; }
.apollo-modal-body a          { color: #3b82f6; text-decoration: underline; }

/* ── Markdown rendering inside AI message bubbles ────────────────────────────── */

.apollo-answer p                { margin: 0 0 0.45em; line-height: 1.55; }
.apollo-answer p:last-child     { margin-bottom: 0; }
.apollo-answer ol,
.apollo-answer ul               { margin: 0.3em 0 0.45em 1.3em; padding: 0; }
.apollo-answer ol               { list-style-type: decimal; }
.apollo-answer ul               { list-style-type: disc; }
.apollo-answer li               { margin: 0.2em 0; line-height: 1.5; }
.apollo-answer li + li          { margin-top: 0.25em; }
.apollo-answer strong           { font-weight: 600; }
