/**
 * Ace — landing-page floating assistant styles.
 * Landing-theme colours (--orange #FF6A00 + --green #CAEB34) reused
 * from legal-page-shell.js. Kept minimal: FAB, glass panel, message
 * bubbles, chips, input. Every selector under .landing-ace-* so we
 * don't collide with any host page's own CSS (including the club-site
 * .el-ace-* widget if a visitor lands there in the same tab).
 */

:root {
    --landing-ace-orange: #FF6A00;
    --landing-ace-green:  #CAEB34;
    --landing-ace-dark:   #1A1A1A;
    --landing-ace-dark2:  #0F0F0F;
    --landing-ace-light:  #FAFAFA;
    --landing-ace-muted:  rgba(250, 250, 250, 0.7);
}

/* ── FAB ─────────────────────────────────────────────────────── */
.landing-ace-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(135deg, var(--landing-ace-orange), #ff8a3a);
    color: #fff;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 12px 32px rgba(255, 106, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
    padding: 0;
}
.landing-ace-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(255, 106, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4); }
.landing-ace-fab.is-hidden { opacity: 0; transform: scale(0.8); pointer-events: none; }
.landing-ace-fab-avatar {
    font-size: 32px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px; height: 64px;
    border-radius: 50%;
    overflow: hidden;
}
.landing-ace-fab-avatar i { color: #fff; }
.landing-ace-fab-avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
/* Fallback icon sits BEHIND the img by default; only visible if img.onerror fires. */
.landing-ace-fab-avatar-img + .landing-ace-avatar-fallback { display: none; font-size: 32px; color: #fff; }
.landing-ace-fab-pulse {
    position: absolute; inset: -2px;
    border-radius: 50%;
    border: 2px solid rgba(255, 106, 0, 0.5);
    animation: landing-ace-pulse 2.2s ease-out infinite;
    pointer-events: none;
}
@keyframes landing-ace-pulse {
    0%   { transform: scale(1);   opacity: 0.7; }
    100% { transform: scale(1.4); opacity: 0;   }
}
.landing-ace-fab-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--landing-ace-green);
    border: 2px solid var(--landing-ace-dark);
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 0 12px rgba(202, 235, 52, 0.7);
}
.landing-ace-fab-dot.is-visible { opacity: 1; transform: scale(1); }

/* ── Panel ───────────────────────────────────────────────────── */
.landing-ace-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 400px;
    height: 620px;
    max-height: calc(100vh - 40px);
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 8px 24px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    transform: translateY(24px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    color: var(--landing-ace-light);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
}
.landing-ace-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.landing-ace-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(255, 106, 0, 0.15), rgba(202, 235, 52, 0.08));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.landing-ace-head-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--landing-ace-orange), #ff8a3a);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 22px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}
.landing-ace-head-avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.landing-ace-head-avatar-img + .landing-ace-avatar-fallback { display: none; }
.landing-ace-head-text { flex: 1; min-width: 0; }
.landing-ace-head-name {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--landing-ace-light);
}
.landing-ace-head-status {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px;
    color: var(--landing-ace-muted);
    margin-top: 2px;
}
.landing-ace-head-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--landing-ace-green);
    box-shadow: 0 0 8px rgba(202, 235, 52, 0.6);
}
.landing-ace-head-close,
.landing-ace-head-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: var(--landing-ace-light);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}
.landing-ace-head-close:hover,
.landing-ace-head-icon:hover { background: rgba(255, 255, 255, 0.12); }
/* Hide dock-toggle button under 720px — mobile forces floating anyway. */
@media (max-width: 720px) {
    .landing-ace-head-icon { display: none; }
}

/* Log */
.landing-ace-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.landing-ace-log::-webkit-scrollbar { width: 6px; }
.landing-ace-log::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Messages */
.landing-ace-msg { display: flex; gap: 8px; }
.landing-ace-msg--user { justify-content: flex-end; }
.landing-ace-msg-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--landing-ace-orange), #ff8a3a);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    overflow: hidden;
}
.landing-ace-msg-avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.landing-ace-msg-avatar-img + .landing-ace-avatar-fallback { display: none; }
.landing-ace-msg-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}
.landing-ace-msg--bot .landing-ace-msg-bubble {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--landing-ace-light);
    border-top-left-radius: 4px;
}
.landing-ace-msg--user .landing-ace-msg-bubble {
    background: linear-gradient(135deg, var(--landing-ace-orange), #ff8a3a);
    color: #fff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(255, 106, 0, 0.25);
}
.landing-ace-msg-body p { margin: 0 0 8px; }
.landing-ace-msg-body p:last-child { margin: 0; }
.landing-ace-msg-body strong { color: var(--landing-ace-green); font-weight: 600; }
.landing-ace-msg-body em { color: rgba(250, 250, 250, 0.85); font-style: italic; }
.landing-ace-msg--user .landing-ace-msg-body strong,
.landing-ace-msg--user .landing-ace-msg-body em { color: #fff; }
.landing-ace-md-list {
    margin: 6px 0 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.landing-ace-md-list li { line-height: 1.5; }

/* CTA chips inside bot bubbles */
.landing-ace-ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.landing-ace-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(202, 235, 52, 0.12);
    color: var(--landing-ace-green);
    border: 1px solid rgba(202, 235, 52, 0.35);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: background 0.2s ease, color 0.2s ease;
}
.landing-ace-cta:hover {
    background: var(--landing-ace-green);
    color: var(--landing-ace-dark);
}
.landing-ace-cta i { font-size: 14px; }

/* Thinking dots */
.landing-ace-msg--thinking .landing-ace-msg-bubble {
    display: flex; gap: 4px;
    padding: 12px 16px;
}
.landing-ace-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    animation: landing-ace-bounce 1.4s ease-in-out infinite;
}
.landing-ace-dot:nth-child(2) { animation-delay: 0.15s; }
.landing-ace-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes landing-ace-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-6px); opacity: 1; }
}

/* Suggestions */
.landing-ace-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.landing-ace-chip {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--landing-ace-light);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.landing-ace-chip:hover {
    background: rgba(255, 106, 0, 0.15);
    border-color: rgba(255, 106, 0, 0.5);
    color: var(--landing-ace-light);
}

/* Form */
.landing-ace-form {
    display: flex;
    gap: 8px;
    padding: 12px 16px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    align-items: flex-end;
}
.landing-ace-input {
    flex: 1;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    color: var(--landing-ace-light);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    min-height: 44px;
    max-height: 180px;
    transition: border-color 0.2s ease;
}
.landing-ace-input:focus { border-color: rgba(255, 106, 0, 0.6); }
.landing-ace-input::placeholder { color: rgba(250, 250, 250, 0.35); }
.landing-ace-send {
    width: 44px; height: 44px;
    flex-shrink: 0;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--landing-ace-orange), #ff8a3a);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 12px rgba(255, 106, 0, 0.3);
}
.landing-ace-send:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255, 106, 0, 0.45); }
.landing-ace-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Resize handle (float mode — top-left corner) ─────────── */
.landing-ace-resize {
    position: absolute;
    top: 0; left: 0;
    width: 18px; height: 18px;
    cursor: nwse-resize;
    z-index: 10;
    background:
        linear-gradient(135deg, transparent 0 40%,
                        rgba(255, 255, 255, 0.35) 40% 50%,
                        transparent 50% 60%,
                        rgba(255, 255, 255, 0.35) 60% 70%,
                        transparent 70%);
    border-top-left-radius: 20px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}
.landing-ace-resize:hover { opacity: 1; }
/* Hide in dock mode + mobile — resize doesn't apply there. */
.landing-ace-panel--docked .landing-ace-resize { display: none; }
@media (max-width: 720px) {
    .landing-ace-resize { display: none; }
}

/* ── Dock grip (dock mode — left edge) ────────────────────── */
.landing-ace-dock-grip {
    position: absolute;
    top: 0; left: 0;
    width: 6px; height: 100%;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    display: none;
}
.landing-ace-panel--docked .landing-ace-dock-grip {
    display: block;
    background: linear-gradient(90deg, rgba(255, 106, 0, 0.35), transparent);
}
.landing-ace-panel--docked .landing-ace-dock-grip:hover {
    background: linear-gradient(90deg, rgba(255, 106, 0, 0.7), transparent);
}

/* ── Docked mode (desktop only) ───────────────────────────── */
:root { --landing-ace-dock-w: 400px; }
.landing-ace-panel--docked {
    /* Fixed to right edge, full height. Suppresses the drop-shadow
       from the floating card so it reads as a real dock column. */
    right: 0 !important;
    bottom: 0 !important;
    top: 0 !important;
    width: var(--landing-ace-dock-w) !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    border-right: none;
    border-top: none;
    border-bottom: none;
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.45);
}
/* When docked + open, push page content to the LEFT so nothing hides
   under the panel. Applied on body via JS. */
body.landing-ace-docked {
    padding-right: var(--landing-ace-dock-w);
    transition: padding-right 0.2s ease;
}
@media (max-width: 720px) {
    body.landing-ace-docked { padding-right: 0; }
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .landing-ace-panel {
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    .landing-ace-fab {
        right: 16px;
        bottom: 16px;
    }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .landing-ace-fab-pulse,
    .landing-ace-dot { animation: none; }
    .landing-ace-panel,
    .landing-ace-fab { transition: none; }
}
