/* ============================================================
   explore.css  —  SmartIV Ask Page
   Full-screen Gemini-inspired dark chat interface
   ============================================================ */

/* ===== CSS VARIABLES (mirrors index.html) ===== */
:root {
    --primary:        #0B6AFF;
    --primary-dark:   #0047CC;
    --primary-light:  #E8F0FF;
    --accent:         #00D4AA;
    --accent2:        #FF6B35;
    --dark:           #0A0F1E;
    --dark2:          #121929;
    --mid:            #1E2A45;
    --text:           #4A5568;
    --text-light:     #8892A4;
    --white:          #FFFFFF;
    --border:         #E2E8F0;
    --bg-light:       #F7F9FC;
    --gradient:       linear-gradient(135deg, #0B6AFF 0%, #00D4AA 100%);
    --gradient-dark:  linear-gradient(135deg, #0A0F1E 0%, #1E2A45 100%);
    --shadow:         0 4px 24px rgba(11, 106, 255, 0.12);
    --shadow-lg:      0 12px 48px rgba(11, 106, 255, 0.18);
    --radius:         16px;
    --radius-sm:      10px;
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--dark);
    color: var(--white);
    overflow-x: hidden;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ===== NAVBAR ===== */
nav#cb-navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    padding: 18px 0;
    background: rgba(10, 15, 30, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.4s;
}

nav#cb-navbar.scrolled {
    background: rgba(10, 15, 30, 0.95);
    padding: 13px 0;
    border-bottom-color: rgba(255,255,255,0.1);
}

.cb-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.cb-nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: 20px;
    color: var(--white);
    transition: opacity 0.2s;
}
.cb-nav-logo:hover { opacity: 0.85; }

.cb-nav-logo .logo-icon {
    width: 38px; height: 38px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px;
    flex-shrink: 0;
}

.cb-nav-links {
    display: flex;
    align-items: center;
    gap: 0;
}

.cb-nav-links a {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}
.cb-nav-links a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.cb-nav-cta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-left: 16px;
}

.cb-nav-github {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 100px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    transition: all 0.2s;
}
.cb-nav-github:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255,255,255,0.4);
}

.cb-nav-smartiv {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 100px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    transition: all 0.2s;
    white-space: nowrap;
}
.cb-nav-smartiv:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255,255,255,0.4);
}

/* hamburger */
.cb-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
}
.cb-hamburger span {
    width: 22px; height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

/* ===== MOBILE OVERLAY & DRAWER ===== */
.cb-mobile-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 998;
    backdrop-filter: blur(4px);
}
.cb-mobile-overlay.open { display: block; }

.cb-mobile-nav {
    position: fixed;
    top: 0; right: -300px;
    width: 280px; height: 100%;
    background: #111827;
    border-left: 1px solid rgba(255,255,255,0.08);
    z-index: 999;
    display: flex;
    flex-direction: column;
    padding: 80px 24px 32px;
    gap: 4px;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}
.cb-mobile-nav.open { right: 0; }

.cb-mobile-close {
    position: absolute;
    top: 20px; right: 20px;
    font-size: 20px;
    cursor: pointer;
    color: rgba(255,255,255,0.6);
    transition: color 0.2s;
}
.cb-mobile-close:hover { color: white; }

.cb-mobile-nav a {
    color: rgba(255,255,255,0.8);
    font-weight: 500;
    font-size: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    transition: all 0.2s;
}
.cb-mobile-nav a:hover {
    background: rgba(255,255,255,0.07);
    color: white;
}

/* ===== MAIN CHATBOT AREA ===== */
.cb-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- Landing screen (shown before any conversation) ---- */
.cb-landing {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 24px;
    position: relative;
    overflow: hidden;
}

/* Background glow orbs */
.cb-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    opacity: 0;
    animation: orbFadeIn 1.2s ease forwards;
}
.cb-orb-1 {
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(11, 106, 255, 0.22) 0%, transparent 70%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 0.3s;
}
.cb-orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(0, 212, 170, 0.12) 0%, transparent 70%);
    bottom: 10%; left: 10%;
    animation-delay: 0.6s;
}
.cb-orb-3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(11, 106, 255, 0.15) 0%, transparent 70%);
    top: 15%; right: 15%;
    animation-delay: 0.9s;
}

@keyframes orbFadeIn {
    to { opacity: 1; }
}

/* Subtle grid lines (matches hero) */
.cb-grid-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.cb-landing-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 780px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
}

/* SmartIV logo mark in heading area */
.cb-logo-mark {
    width: 64px; height: 64px;
    background: var(--gradient);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    color: white;
    margin-bottom: 28px;
    box-shadow: 0 8px 32px rgba(11, 106, 255, 0.4);
    animation: floatMark 4s ease-in-out infinite;
}

@keyframes floatMark {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}

.cb-heading {
    font-family: 'Sora', sans-serif;
    font-size: clamp(28px, 5vw, 52px);
    font-weight: 800;
    color: var(--white);
    line-height: 1.15;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.cb-heading .grad {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cb-subheading {
    font-size: clamp(14px, 2vw, 17px);
    color: rgba(255, 255, 255, 0.5);
    max-width: 560px;
    line-height: 1.7;
    margin-bottom: 40px;
}

/* ===== INPUT BAR ===== */
.cb-input-wrap {
    width: 100%;
    max-width: 720px;
    position: relative;
    margin-bottom: 28px;
}

.cb-input-bar {
    width: 100%;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 100px;
    padding: 6px 8px 6px 8px;
    gap: 8px;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.06);
}

.cb-input-bar:focus-within {
    border-color: rgba(11, 106, 255, 0.6);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 4px 32px rgba(0,0,0,0.3), 0 0 0 3px rgba(11, 106, 255, 0.15), inset 0 1px 0 rgba(255,255,255,0.08);
}

.cb-input-icon-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,0.6);
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.cb-input-icon-btn:hover {
    background: rgba(11, 106, 255, 0.2);
    border-color: rgba(11, 106, 255, 0.4);
    color: var(--primary);
}

.cb-input-field {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    padding: 8px 4px 8px 16px;
    min-width: 0;
}

.cb-input-field::placeholder {
    color: rgba(255,255,255,0.35);
}

.cb-send-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 16px;
    transition: all 0.25s;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(11, 106, 255, 0.4);
}
.cb-send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(11, 106, 255, 0.5);
}
.cb-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ===== SUGGESTION CHIPS ===== */
.cb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 720px;
}

.cb-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 100px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(6px);
}

.cb-chip:hover {
    background: rgba(11, 106, 255, 0.15);
    border-color: rgba(11, 106, 255, 0.4);
    color: white;
    transform: translateY(-1px);
}

.cb-chip i {
    font-size: 12px;
    color: var(--accent);
    opacity: 0.85;
}

/* ===== CONVERSATION AREA ===== */
.cb-conversation {
    display: none; /* hidden until first message */
    flex-direction: column;
    flex: 1;
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
    padding: 100px 24px 200px;
    gap: 24px;
    position: relative;
    z-index: 2;
}

.cb-conversation.active {
    display: flex;
}

/* Message bubbles */
.cb-msg {
    display: flex;
    gap: 12px;
    animation: msgIn 0.3s ease forwards;
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cb-msg.user-msg {
    flex-direction: row-reverse;
}

.cb-msg-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.cb-msg.user-msg .cb-msg-avatar {
    background: var(--gradient);
    color: white;
}

.cb-msg.bot-msg .cb-msg-avatar {
    background: rgba(11, 106, 255, 0.15);
    border: 1px solid rgba(11, 106, 255, 0.3);
    color: var(--primary);
}

.cb-msg-bubble {
    max-width: 75%;
    border-radius: 20px;
    padding: 14px 20px;
    font-size: 15px;
    line-height: 1.7;
}

.cb-msg.user-msg .cb-msg-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 6px;
}

.cb-msg.bot-msg .cb-msg-bubble {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.88);
    border-bottom-left-radius: 6px;
}

/* Source chips on bot response */
.cb-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.cb-source-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.25);
    color: var(--accent);
    cursor: pointer;
    transition: background 0.2s;
}
.cb-source-tag:hover {
    background: rgba(0,212,170,0.2);
}
.cb-source-tag i { font-size: 10px; }

/* Typing indicator */
.cb-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    width: fit-content;
}

.cb-typing-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    animation: typingBounce 1.2s ease-in-out infinite;
}
.cb-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.cb-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40%           { transform: translateY(-6px); opacity: 1; }
}

/* ===== STICKY BOTTOM INPUT (conversation mode) ===== */
.cb-bottom-input {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    background: linear-gradient(to top, rgba(10,15,30,0.98) 60%, transparent);
    padding: 20px 24px 28px;
}
.cb-bottom-input.active { display: block; }

.cb-bottom-input .cb-input-wrap {
    max-width: 780px;
    margin: 0 auto 0;
}

/* ===== SCROLL-TO-TOP ===== */
#cb-scrolltop {
    position: fixed;
    bottom: 100px; right: 24px;
    width: 42px; height: 42px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 16px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(11,106,255,0.4);
    z-index: 200;
}
#cb-scrolltop.show {
    opacity: 1;
    pointer-events: auto;
}
#cb-scrolltop:hover { background: var(--primary-dark); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .cb-nav-links { display: none; }
    .cb-hamburger { display: flex; }
}

@media (max-width: 600px) {
    .cb-heading { font-size: 28px; }
    .cb-subheading { font-size: 14px; }
    .cb-chips { gap: 8px; }
    .cb-chip { font-size: 12px; padding: 7px 14px; }
    .cb-input-field { font-size: 14px; }
    .cb-msg-bubble { max-width: 90%; font-size: 14px; }
    .cb-landing { padding: 80px 16px 40px; }
    .cb-conversation { padding: 80px 16px 200px; }
    .cb-bottom-input { padding: 12px 16px 16px; }
}

/* ===== MARKDOWN RENDERING STYLES ===== */

/* Paragraphs in bot messages */
.cb-md-p {
    margin: 0 0 10px 0;
    line-height: 1.75;
}
.cb-md-p:last-child { margin-bottom: 0; }

/* Headings inside bot messages */
.cb-md-h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--white);
    margin: 16px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.cb-md-h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    margin: 14px 0 6px;
}
.cb-md-h4 {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    margin: 12px 0 4px;
}

/* Horizontal rule */
.cb-md-hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 14px 0;
}

/* Unordered list */
.cb-md-ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 12px;
}

/* List items */
.cb-md-li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 6px;
    font-size: 14.5px;
    line-height: 1.65;
    color: rgba(255,255,255,0.85);
}
.cb-md-li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
}
.cb-md-li-num::before {
    content: '›';
    color: var(--primary);
}

/* Inline code */
.cb-inline-code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    background: rgba(11, 106, 255, 0.12);
    border: 1px solid rgba(11, 106, 255, 0.2);
    border-radius: 5px;
    padding: 1px 6px;
    color: #7dd3fc;
    white-space: nowrap;
}

/* Code block */
.cb-code-block {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255,255,255,0.1);
    border-left: 3px solid var(--primary);
    border-radius: 10px;
    padding: 14px 18px;
    margin: 12px 0;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
}
.cb-code-block code {
    font-family: 'Courier New', Courier, monospace;
    color: #a5f3fc;
    background: none;
    border: none;
    padding: 0;
    white-space: pre;
}

/* Streaming bubble cursor blink */
.streaming-bubble .streaming-content::after {
    content: '▋';
    display: inline-block;
    color: var(--accent);
    animation: cursorBlink 0.9s step-end infinite;
    margin-left: 2px;
    font-size: 13px;
    vertical-align: middle;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* Error bubble */
.cb-error-bubble {
    background: rgba(239, 68, 68, 0.08) !important;
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
    color: rgba(255, 255, 255, 0.85) !important;
}
.cb-error-bubble strong {
    color: #f87171;
}

/* ===== UTILITY ===== */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* API Key Setup Card inside chat */
.cb-setup-card {
    background: rgba(10, 15, 30, 0.4) !important;
    border: 1px solid rgba(11, 106, 255, 0.25) !important;
    padding: 20px !important;
    border-radius: 20px;
    margin-top: 5px;
    width: 100%;
}
.cb-setup-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}
.cb-setup-text {
    font-size: 13.5px;
    line-height: 1.6;
    color: rgba(255,255,255,0.75);
    margin-bottom: 15px;
}
.cb-setup-field-group {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.cb-setup-input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-size: 13.5px;
    font-family: monospace;
    outline: none;
    transition: all 0.2s;
}
.cb-setup-input:focus {
    border-color: var(--primary);
    background: rgba(255,255,255,0.1);
}
.cb-setup-btn {
    background: var(--gradient);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.cb-setup-btn:hover {
    opacity: 0.9;
}
.cb-setup-status {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
}
.cb-setup-status a {
    color: var(--accent);
    text-decoration: underline;
}
