/* ============================================================
   Rotowizards — Crystal Ball AI Advisor
   ============================================================ */

/* ── Break out of Astra container ────────────────────────── */
body.page-template-page-crystal-ball {
    background: var(--rw-dark, #0A0F1E) !important;
}

body.page-template-page-crystal-ball .ast-container,
body.page-template-page-crystal-ball #content,
body.page-template-page-crystal-ball #primary,
body.page-template-page-crystal-ball .site-content,
body.page-template-page-crystal-ball .ast-article-single,
body.page-template-page-crystal-ball .entry-content,
body.page-template-page-crystal-ball .ast-article-post {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    background: var(--rw-dark, #0A0F1E) !important;
}

/* ── Page wrapper ────────────────────────────────────────── */
.rw-cb-page {
    background: var(--rw-dark, #0A0F1E);
    color: var(--rw-text, #F9FAFB);
    min-height: 100vh;
    width: 100%;
    display: block;
}

.rw-cb-hero,
.rw-cb-section {
    width: 100%;
    box-sizing: border-box;
}

/* ── Hero ────────────────────────────────────────────────── */
.rw-cb-hero {
    background: var(--rw-surface, #111827);
    padding: 56px 24px 48px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--rw-border, rgba(255,255,255,0.08));
}

/* ── Disclaimer ──────────────────────────────────────────── */
.rw-cb-disclaimer {
    background: transparent;
    border-top: 1px solid var(--rw-border, rgba(255,255,255,0.08));
    padding: 10px 24px;
}

.rw-cb-disclaimer a {
    color: var(--rw-teal, #0ABFBC);
    text-decoration: none;
}

.rw-cb-disclaimer a:hover {
    text-decoration: underline;
}

.rw-cb-disclaimer-inner {
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--rw-text-muted, rgba(255,255,255,0.6));
    line-height: 1.5;
}

.rw-cb-disclaimer-icon {
    flex-shrink: 0;
    margin-top: 1px;
    font-size: 0.9rem;
}

.rw-cb-disclaimer p {
    margin: 0;
}

.rw-cb-disclaimer strong {
    color: var(--rw-teal, #0ABFBC);
    font-weight: 600;
}

.rw-cb-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(124,58,237,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124,58,237,0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.rw-cb-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
}

/* ── Crystal Ball Orb ────────────────────────────────────── */
.rw-cb-orb-wrap {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 28px;
}

.rw-cb-orb {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 32%,
        rgba(255, 255, 255, 0.22) 0%,
        rgba(167, 139, 250, 0.75) 22%,
        rgba(124, 58, 237, 0.85) 45%,
        rgba(10, 191, 188, 0.5)  68%,
        rgba(10, 15, 30, 0.95)  100%
    );
    box-shadow:
        0 0 30px rgba(124, 58, 237, 0.55),
        0 0 70px rgba(124, 58, 237, 0.25),
        0 0 120px rgba(10, 191, 188, 0.15),
        inset 0 0 30px rgba(255, 255, 255, 0.04);
    animation: rw-cb-pulse 4s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

/* Inner highlight — gives the sphere a 3-D feel */
.rw-cb-orb-shine {
    position: absolute;
    top: 12%;
    left: 18%;
    width: 38%;
    height: 28%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.45) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(5px);
    pointer-events: none;
}

/* Rotating inner nebula */
.rw-cb-orb::after {
    content: '';
    position: absolute;
    inset: -20%;
    background: conic-gradient(
        from 0deg,
        transparent            0deg,
        rgba(10,191,188,0.12) 70deg,
        transparent           140deg,
        rgba(124,58,237,0.12) 220deg,
        transparent           300deg
    );
    animation: rw-cb-spin 10s linear infinite;
    border-radius: 50%;
}

/* Outer ambient glow blob */
.rw-cb-orb-glow {
    position: absolute;
    inset: -40px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(124,58,237,0.18) 0%,
        rgba(10,191,188,0.08) 50%,
        transparent 70%
    );
    animation: rw-cb-pulse 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes rw-cb-pulse {
    0%, 100% {
        box-shadow:
            0 0 30px rgba(124,58,237,0.55),
            0 0 70px rgba(124,58,237,0.25),
            0 0 120px rgba(10,191,188,0.15),
            inset 0 0 30px rgba(255,255,255,0.04);
    }
    50% {
        box-shadow:
            0 0 45px rgba(124,58,237,0.75),
            0 0 90px rgba(124,58,237,0.35),
            0 0 150px rgba(10,191,188,0.22),
            inset 0 0 40px rgba(255,255,255,0.07);
    }
}

@keyframes rw-cb-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Hero text ───────────────────────────────────────────── */
.rw-cb-title {
    font-family: 'Barlow', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    color: #fff;
    margin: 0 0 10px;
    line-height: 1.1;
}

.rw-cb-tagline {
    font-size: 1.05rem;
    color: var(--rw-text-muted, #9CA3AF);
    margin: 0;
}

.rw-cb-admin-notice {
    margin-top: 20px;
    padding: 12px 18px;
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #F59E0B;
    text-align: left;
}

.rw-cb-admin-notice code {
    background: rgba(255,255,255,0.08);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
}

/* ── Section + inner ─────────────────────────────────────── */
.rw-cb-section {
    padding: 40px 24px 80px;
}

.rw-cb-inner {
    max-width: 780px;
    margin: 0 auto;
}

/* ── Gate (logged out) ───────────────────────────────────── */
.rw-cb-gate {
    text-align: center;
    padding: 60px 24px;
}

.rw-cb-gate-orb {
    font-size: 4rem;
    margin-bottom: 20px;
    display: block;
    filter: drop-shadow(0 0 20px rgba(124,58,237,0.5));
}

.rw-cb-gate h2 {
    font-family: 'Barlow', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    margin: 0 0 12px;
}

.rw-cb-gate p {
    color: var(--rw-text-muted, #9CA3AF);
    font-size: 1rem;
    margin: 0 0 28px;
}

.rw-cb-gate-ctas {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Context bar ─────────────────────────────────────────── */
.rw-cb-context-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.rw-cb-no-teams {
    font-size: 0.85rem;
    color: var(--rw-text-muted, #9CA3AF);
}

.rw-cb-no-teams a {
    color: var(--rw-teal, #0ABFBC);
    font-weight: 600;
    text-decoration: none;
}

.rw-cb-no-teams a:hover { text-decoration: underline; }

.rw-cb-context-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--rw-text-muted, #9CA3AF);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    /* Was flex-shrink:0, which forced this full sentence onto a single
       non-wrapping line — overflowing the viewport on mobile and pushing the
       nav off-screen. Let it shrink and wrap; min-width:0 permits shrinking
       below its min-content width. */
    flex-shrink: 1;
    min-width: 0;
}

/* The Crystal Ball team picker now uses the shared .rw-league-picker
   component (style.css). The per-source color rules that used to colorize
   each platform tab (ESPN green / Sleeper teal / Yahoo purple / etc.) are
   gone with the buttons — if we want to surface the source for the active
   league later, a small badge next to the picker is the cleanest way. */

.rw-cb-context-format {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--rw-teal, #0ABFBC);
    background: rgba(10,191,188,0.08);
    border: 1px solid rgba(10,191,188,0.2);
    border-radius: 100px;
    padding: 3px 10px;
    margin-left: auto;
}

/* ── Chat wrap ───────────────────────────────────────────── */
.rw-cb-chat-wrap {
    background: var(--rw-surface, #111827);
    border: 1px solid var(--rw-border, rgba(255,255,255,0.08));
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Suggestions ─────────────────────────────────────────── */
.rw-cb-suggestions {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--rw-border, rgba(255,255,255,0.06));
}

.rw-cb-suggestions-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--rw-text-muted, #9CA3AF);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 10px;
}

.rw-cb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rw-cb-chip {
    padding: 7px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--rw-border, rgba(255,255,255,0.1));
    border-radius: 100px;
    color: var(--rw-text, #F9FAFB);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rw-cb-chip:hover {
    background: rgba(124,58,237,0.12);
    border-color: rgba(124,58,237,0.35);
    color: #fff;
}

/* ── Messages ────────────────────────────────────────────── */
.rw-cb-messages {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 480px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.rw-cb-messages::-webkit-scrollbar { width: 4px; }
.rw-cb-messages::-webkit-scrollbar-track { background: transparent; }
.rw-cb-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Shared message layout */
.rw-cb-msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: rw-cb-fadein 0.25s ease;
}

@keyframes rw-cb-fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rw-cb-msg-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 2px;
    filter: drop-shadow(0 0 6px rgba(124,58,237,0.5));
}

.rw-cb-msg-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.65;
}

.rw-cb-msg-bubble p { margin: 0 0 8px; }
.rw-cb-msg-bubble p:last-child { margin-bottom: 0; }

/* AI message */
.rw-cb-msg-ai .rw-cb-msg-bubble {
    background: var(--rw-card, #1F2937);
    border: 1px solid var(--rw-border, rgba(255,255,255,0.08));
    border-top-left-radius: 4px;
    color: var(--rw-text, #F9FAFB);
}

/* User message */
.rw-cb-msg-user {
    flex-direction: row-reverse;
}

.rw-cb-msg-user .rw-cb-msg-bubble {
    background: var(--rw-gradient, linear-gradient(135deg, #0ABFBC, #7C3AED));
    color: #fff;
    border-top-right-radius: 4px;
}

/* ── Typing indicator ────────────────────────────────────── */
.rw-cb-typing[hidden] { display: none !important; }
.rw-cb-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 16px;
}

.rw-cb-typing-dots {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    background: var(--rw-card, #1F2937);
    border: 1px solid var(--rw-border, rgba(255,255,255,0.08));
    border-radius: 14px;
    border-top-left-radius: 4px;
}

.rw-cb-typing-dots span {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--rw-text-muted, #9CA3AF);
    animation: rw-cb-dot 1.2s ease-in-out infinite;
}

.rw-cb-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.rw-cb-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes rw-cb-dot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1;   }
}

/* ── Input ───────────────────────────────────────────────── */
.rw-cb-input-wrap {
    display: flex;
    gap: 0;
    padding: 16px;
    border-top: 1px solid var(--rw-border, rgba(255,255,255,0.08));
    background: var(--rw-dark, #0A0F1E);
}

.rw-cb-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--rw-surface, #111827);
    border: 1px solid var(--rw-border, rgba(255,255,255,0.12));
    border-right: none;
    border-radius: 10px 0 0 10px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s;
}

.rw-cb-input::placeholder { color: var(--rw-text-muted, #9CA3AF); }

.rw-cb-input:focus {
    border-color: var(--rw-purple, #7C3AED);
}

.rw-cb-send {
    padding: 12px 18px;
    background: var(--rw-gradient, linear-gradient(135deg, #0ABFBC, #7C3AED));
    border: none;
    border-radius: 0 10px 10px 0;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.rw-cb-send:hover { opacity: 0.9; }
.rw-cb-send:disabled { opacity: 0.4; cursor: not-allowed; }
.rw-cb-input:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .rw-cb-hero { padding: 40px 16px 36px; }
    .rw-cb-orb-wrap, .rw-cb-orb { width: 120px; height: 120px; }
    .rw-cb-section { padding: 24px 12px 60px; }
    .rw-cb-messages { max-height: 360px; }
    .rw-cb-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
    .rw-cb-chip { flex-shrink: 0; }
    .rw-cb-msg-bubble { max-width: 92%; }
}
