/**
 * Nicole Chat Widget Styles
 * Speeki Brand Guide Applied
 *
 * IMPORTANT: Widget CSS is ISOLATED from the design system.
 * Brand colors are hardcoded (same values as tokens) to prevent
 * dark mode conflicts when widget is embedded on third-party sites.
 * DO NOT import speeki-tokens.css here - it breaks dark mode handling.
 */

/* Google Fonts - DM Sans */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&display=swap');

/*
 * CSS Variables - Scoped to widget elements (NOT :root)
 * This prevents host page dark mode from affecting widget styles
 */

/* Light Mode - Default (scoped to widget elements) */
.nicole-window,
.nicole-bubble {
    /* Primary Colors */
    --nicole-primary: #00135D;        /* Speeki Blue */
    --nicole-primary-dark: #041558;   /* Dark Navy */
    --nicole-accent: #00EC7D;         /* Speeki Green */

    /* UI Colors */
    --nicole-bg: #ffffff;
    --nicole-text: #00135D;           /* Speeki Blue for text */
    --nicole-text-light: #5a6a7a;
    --nicole-border: #e1e7ef;
    --nicole-muted-bg: #edf2f7;
    --nicole-card-bg: #f6f7f9;

    /* Message Colors */
    --nicole-user-bg: #00135D;        /* Speeki Blue */
    --nicole-user-text: #ffffff;
    --nicole-assistant-bg: #f6f7f9;   /* Card Background */
    --nicole-assistant-text: #00135D;

    /* Effects */
    --nicole-shadow: 0 4px 24px rgba(0, 19, 93, 0.15);
    --nicole-radius: 16px;
    --nicole-bubble-size: 60px;

    /* Typography */
    --nicole-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Dark Mode - Override when .nicole-dark class is present */
.nicole-window.nicole-dark,
.nicole-bubble.nicole-dark {
    --nicole-bg: #0d1424;             /* Dark background */
    --nicole-text: #f0f4f8;           /* Light text */
    --nicole-text-light: #a0aec0;     /* Muted light text */
    --nicole-border: #2d3748;         /* Dark border */
    --nicole-muted-bg: #1a202c;       /* Dark muted */
    --nicole-card-bg: #1a202c;        /* Dark card */
    --nicole-assistant-bg: #1a202c;   /* Dark assistant bubble */
    --nicole-assistant-text: #f0f4f8; /* Light text in assistant bubble */
    --nicole-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Base Widget Styles */
.nicole-bubble,
.nicole-window,
.nicole-window * {
    font-family: var(--nicole-font);
    box-sizing: border-box;
}

/* Chat Bubble */
.nicole-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: var(--nicole-bubble-size);
    height: var(--nicole-bubble-size);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--nicole-primary) 0%, var(--nicole-primary-dark) 100%);
    border: none;
    cursor: pointer;
    box-shadow: var(--nicole-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 99998;
}

.nicole-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 32px rgba(0, 19, 93, 0.25);
}

.nicole-bubble svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.nicole-bubble.nicole-hidden {
    display: none;
}

/* Pulse animation for bubble */
.nicole-bubble::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--nicole-accent);
    opacity: 0;
    animation: nicole-pulse 2s ease-out infinite;
}

@keyframes nicole-pulse {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Chat Window */
.nicole-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    height: 560px;
    min-width: 320px;
    min-height: 400px;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--nicole-bg);
    border-radius: var(--nicole-radius);
    box-shadow: 0 8px 40px rgba(0, 19, 93, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.nicole-window.nicole-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Resize Handle - Top Left corner */
.nicole-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: nw-resize;
    z-index: 10;
    background: transparent;
}

.nicole-resize-handle::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 10px;
    height: 10px;
    border-left: 2px solid rgba(255, 255, 255, 0.5);
    border-top: 2px solid rgba(255, 255, 255, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nicole-window:hover .nicole-resize-handle::before {
    opacity: 1;
}

/* Header */
.nicole-header {
    background: linear-gradient(135deg, var(--nicole-primary) 0%, var(--nicole-primary-dark) 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.nicole-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nicole-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--nicole-accent);
    color: var(--nicole-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.nicole-header-text h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.nicole-header-text p {
    margin: 3px 0 0;
    font-size: 13px;
    opacity: 0.85;
    font-weight: 400;
}

.nicole-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.nicole-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nicole-close svg {
    width: 22px;
    height: 22px;
}

/* Messages Container */
.nicole-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--nicole-muted-bg);
}

/* ==========================================================================
   TYPOGRAPHY SYSTEM
   Based on Adobe Typography Guide principles:
   - Hierarchy: Clear visual distinction between content types
   - Tracking: Letter-spacing for readability
   - Leading: Line-height for comfortable reading
   - Line length: Optimal width (45-75 chars)
   - White space: Intentional breathing room
   ========================================================================== */

/* Message Bubbles - Base */
.nicole-message {
    max-width: 85%;
    padding: 16px 20px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.65;
    letter-spacing: -0.01em;
    word-wrap: break-word;
    animation: nicole-fade-in 0.3s ease;
}

/* Typography - Paragraphs */
.nicole-message p {
    margin: 0 0 14px 0;
}

.nicole-message p:last-child,
.nicole-message p:only-child {
    margin-bottom: 0;
}

/* Typography - Headings/Bold (Hierarchy Level 1) */
.nicole-message strong,
.nicole-message b {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Typography - First strong in paragraph acts as section header */
.nicole-message p > strong:first-child {
    display: inline;
    font-size: 14px;
}

/* Typography - Headings in messages (h3, h4) */
.nicole-message h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0 0 12px 0;
    color: var(--nicole-text);
    line-height: 1.4;
}

.nicole-message h3:not(:first-child) {
    margin-top: 18px;
}

.nicole-message h4 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 10px 0;
    color: var(--nicole-text);
    line-height: 1.4;
}

.nicole-message h4:not(:first-child) {
    margin-top: 14px;
}

/* Typography - Blockquotes (callouts/emphasis) */
.nicole-message blockquote {
    margin: 14px 0;
    padding: 12px 16px;
    border-left: 3px solid var(--nicole-accent);
    background: rgba(0, 236, 125, 0.06);
    border-radius: 0 8px 8px 0;
}

.nicole-message blockquote:first-child {
    margin-top: 0;
}

.nicole-message blockquote:last-child {
    margin-bottom: 0;
}

.nicole-message blockquote p {
    margin: 0;
    font-size: 14px;
    font-style: italic;
    color: var(--nicole-text);
    line-height: 1.55;
}

.nicole-message blockquote p + p {
    margin-top: 8px;
}

/* List styling - Hierarchy Level 2 */
.nicole-message ul,
.nicole-message ol {
    margin: 14px 0;
    padding-left: 24px;
}

.nicole-message ul:last-child,
.nicole-message ol:last-child {
    margin-bottom: 0;
}

.nicole-message li {
    margin: 10px 0;
    padding-left: 6px;
    line-height: 1.6;
}

.nicole-message li:first-child {
    margin-top: 0;
}

.nicole-message li:last-child {
    margin-bottom: 0;
}

.nicole-message li::marker {
    color: var(--nicole-accent);
    font-weight: 600;
}

/* Nested content in lists */
.nicole-message li p {
    margin: 6px 0;
}

.nicole-message li p:first-child {
    margin-top: 0;
}

/* CTA Question - Hierarchy Level 3 (Closing prompt) */
.nicole-cta-question {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--nicole-border);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: -0.01em;
    color: var(--nicole-text);
}

@keyframes nicole-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User Message - Compact, right-aligned */
.nicole-message.nicole-user {
    align-self: flex-end;
    background: var(--nicole-user-bg);
    color: var(--nicole-user-text);
    border-bottom-right-radius: 6px;
    font-weight: 500;
    padding: 12px 18px;
    letter-spacing: -0.005em;
    line-height: 1.5;
}

/* Assistant Message - Content-rich, left-aligned */
.nicole-message.nicole-assistant {
    align-self: flex-start;
    background: var(--nicole-bg);
    color: var(--nicole-assistant-text);
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 19, 93, 0.06);
}

/* Link styling in assistant messages */
.nicole-message.nicole-assistant a {
    color: var(--nicole-primary);
    text-decoration: underline;
    text-decoration-color: var(--nicole-accent);
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.nicole-message.nicole-assistant a:hover {
    color: var(--nicole-accent);
}

/* CTA (Call-to-Action) Message - Highlighted question bubble */
.nicole-message.nicole-cta {
    border-left: 3px solid var(--nicole-accent);
    background: linear-gradient(135deg, var(--nicole-bg) 0%, rgba(0, 236, 125, 0.08) 100%);
    font-weight: 500;
}

/* Action Buttons Container */
.nicole-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 4px;
    max-width: 85%;
    align-self: flex-start;
}

/* Action Button */
.nicole-action-btn {
    padding: 8px 16px;
    border: 1px solid var(--nicole-border);
    border-radius: 20px;
    background: var(--nicole-bg);
    color: var(--nicole-text);
    font-size: 13px;
    font-family: var(--nicole-font);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nicole-action-btn:hover {
    background: var(--nicole-primary);
    color: white;
    border-color: var(--nicole-primary);
    transform: translateY(-1px);
}

.nicole-action-btn:active {
    transform: translateY(0);
}

/* Action Prompt (fallback when no buttons extracted) */
.nicole-action-prompt {
    font-size: 13px;
    color: var(--nicole-text-light);
    font-style: italic;
    margin: 0;
    padding: 8px 0;
}

/* Quick Reply Buttons Container (Shadcn Vega style) */
.nicole-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 8px;
    max-width: 90%;
    align-self: flex-start;
    padding: 4px 0;
}

/* Quick Reply Button - Suggested actions with clear affordance */
.nicole-quick-reply-btn {
    padding: 10px 16px;
    border: 1.5px solid var(--nicole-primary);
    border-radius: 9999px;  /* Pill shape */
    background: rgba(0, 19, 93, 0.04);  /* Very light navy tint */
    color: var(--nicole-primary);
    font-size: 13px;
    font-family: var(--nicole-font);
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 19, 93, 0.08);
}

.nicole-quick-reply-btn:hover {
    background: var(--nicole-primary);
    color: white;
    border-color: var(--nicole-primary);
    box-shadow: 0 3px 10px rgba(0, 19, 93, 0.2);
    transform: translateY(-1px);
}

.nicole-quick-reply-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--nicole-accent);
}

.nicole-quick-reply-btn:active {
    transform: scale(0.98);
}

/* Typing Indicator */
.nicole-typing {
    align-self: flex-start;
    padding: 14px 18px;
    background: var(--nicole-bg);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    box-shadow: 0 2px 8px rgba(0, 19, 93, 0.06);
    min-width: 200px;
    max-width: 320px;
}

.nicole-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nicole-accent);
    animation: nicole-typing-bounce 1.4s infinite ease-in-out both;
}

.nicole-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.nicole-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes nicole-typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Typing Status (LLM-generated "thinking" message) */
.nicole-typing-status {
    display: none;
    font-size: 13px;
    color: var(--nicole-text-light);
    font-style: italic;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.nicole-typing-status-visible {
    display: inline;
    opacity: 1;
    max-width: 200px;
    margin-right: 8px;
    animation: nicole-status-appear 0.4s ease-out;
}

.nicole-typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

@keyframes nicole-status-appear {
    0% {
        opacity: 0;
        max-width: 0;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        max-width: 200px;
        transform: translateX(0);
    }
}

/* Input Area */
.nicole-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--nicole-border);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    background: #ffffff;
    background-color: #ffffff;
    color-scheme: light;
}

.nicole-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--nicole-border);
    border-radius: 24px;
    font-size: 14px;
    font-family: var(--nicole-font);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: #1e222a;
    -webkit-text-fill-color: #1e222a;
    background-color: #ffffff;
    color-scheme: light;
}

.nicole-input::placeholder {
    color: #6b7280;
    -webkit-text-fill-color: #6b7280;
    opacity: 1;
}

.nicole-input:focus {
    border-color: var(--nicole-primary);
    box-shadow: 0 0 0 3px rgba(0, 19, 93, 0.1);
}

.nicole-input:disabled {
    background: #f6f7f9;
    background-color: #f6f7f9;
    color: #6b7280;
    -webkit-text-fill-color: #6b7280;
    cursor: not-allowed;
}

.nicole-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--nicole-accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nicole-send:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0, 236, 125, 0.4);
}

.nicole-send:disabled {
    background: var(--nicole-border);
    cursor: not-allowed;
}

.nicole-send svg {
    width: 22px;
    height: 22px;
    fill: var(--nicole-primary);
}

/* GDPR Disclosure Footer */
.nicole-gdpr-disclosure {
    padding: 8px 16px;
    background: var(--nicole-muted-bg);
    border-top: 1px solid var(--nicole-border);
    text-align: center;
    font-size: 11px;
    color: var(--nicole-text-light);
    line-height: 1.4;
    flex-shrink: 0;
}

.nicole-gdpr-disclosure a {
    color: var(--nicole-primary);
    text-decoration: underline;
}

.nicole-gdpr-disclosure a:hover {
    color: var(--nicole-accent);
}

/* Error State */
.nicole-error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
    padding: 14px 18px;
    border-radius: 12px;
    margin: 8px 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nicole-error button {
    background: #c53030;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    margin-left: auto;
    font-family: var(--nicole-font);
    transition: background 0.2s ease;
}

.nicole-error button:hover {
    background: #9b2c2c;
}

/* Streaming cursor */
.nicole-streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--nicole-accent);
    margin-left: 2px;
    animation: nicole-cursor-blink 0.7s infinite;
    vertical-align: text-bottom;
}

@keyframes nicole-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .nicole-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100vh;
        max-height: 100dvh;
    }

    .nicole-bubble {
        bottom: 20px;
        right: 20px;
    }

    .nicole-message {
        max-width: 90%;
    }

    .nicole-header {
        padding: 16px 20px;
    }

    .nicole-messages {
        padding: 16px;
    }

    .nicole-actions {
        max-width: 95%;
    }

    .nicole-action-btn {
        padding: 10px 14px;
        font-size: 14px;
    }

    .nicole-quick-replies {
        max-width: 95%;
    }

    .nicole-quick-reply-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* Print styles - hide widget */
@media print {
    .nicole-bubble,
    .nicole-window {
        display: none !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .nicole-window,
    .nicole-bubble,
    .nicole-bubble::before,
    .nicole-message,
    .nicole-typing-dot {
        animation: none;
        transition: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --nicole-bg: #1e222a;
        --nicole-text: #e8ecf2;
        --nicole-text-light: #8b95a5;
        --nicole-border: #2d3748;
        --nicole-muted-bg: #171b22;
        --nicole-card-bg: #252a35;
        --nicole-assistant-bg: #252a35;
        --nicole-assistant-text: #e8ecf2;
        --nicole-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    }

    .nicole-message.nicole-assistant {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

    /* Dark mode link styling for better contrast */
    .nicole-message.nicole-assistant a {
        color: var(--nicole-accent);
        text-decoration-color: var(--nicole-accent);
    }

    .nicole-message.nicole-assistant a:hover {
        color: #5fffaa;
    }

    /* Dark mode typing indicator */
    .nicole-typing {
        background: var(--nicole-card-bg);
    }

    .nicole-typing-status {
        color: var(--nicole-text-light);
    }

    .nicole-typing-dot {
        background: var(--nicole-accent);
    }

    /* Dark mode GDPR disclosure link */
    .nicole-gdpr-disclosure a {
        color: var(--nicole-accent);
    }

    .nicole-gdpr-disclosure a:hover {
        color: #5fffaa;
    }

    /* Dark mode action buttons */
    .nicole-action-btn {
        background: var(--nicole-card-bg);
        border-color: var(--nicole-border);
        color: var(--nicole-text);
    }

    .nicole-action-btn:hover {
        background: var(--nicole-accent);
        color: var(--nicole-primary);
        border-color: var(--nicole-accent);
    }

    .nicole-action-prompt {
        color: var(--nicole-text-light);
    }

    /* Dark mode quick-reply buttons */
    .nicole-quick-reply-btn {
        background: rgba(0, 236, 125, 0.08);  /* Light accent tint */
        border-color: var(--nicole-accent);
        color: var(--nicole-text);
    }

    .nicole-quick-reply-btn:hover {
        background: var(--nicole-accent);
        color: var(--nicole-primary);
        border-color: var(--nicole-accent);
        transform: translateY(-1px);
    }

    .nicole-quick-reply-btn:focus {
        box-shadow: 0 0 0 2px var(--nicole-accent);
    }

    /* Dark mode CTA question */
    .nicole-cta-question {
        border-top-color: var(--nicole-border);
        color: var(--nicole-text);
    }

    /* Dark mode headings */
    .nicole-message h3,
    .nicole-message h4 {
        color: var(--nicole-text);
    }

    /* Dark mode blockquotes */
    .nicole-message blockquote {
        background: rgba(0, 236, 125, 0.08);
        border-left-color: var(--nicole-accent);
    }

    .nicole-message blockquote p {
        color: var(--nicole-text);
    }
}

/* ==========================================================================
   WORKFLOW STEPS
   Observable progress indicators during response generation
   ========================================================================== */

/* Workflow steps container inside typing indicator */
.nicole-workflow-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

/* Individual step */
.nicole-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1.4;
    transition: opacity 0.2s ease, color 0.2s ease;
}

/* Step icon */
.nicole-step-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

/* Step label */
.nicole-step-label {
    color: var(--nicole-text-light);
    font-weight: 400;
}

/* Active step - currently in progress */
.nicole-step-active {
    opacity: 1;
}

.nicole-step-active .nicole-step-icon {
    color: var(--nicole-accent);
    animation: nicole-step-pulse 1.2s ease-in-out infinite;
}

.nicole-step-active .nicole-step-label {
    color: var(--nicole-text);
    font-weight: 500;
}

/* Completed step */
.nicole-step-complete {
    opacity: 0.7;
}

.nicole-step-complete .nicole-step-icon {
    color: var(--nicole-accent);
}

.nicole-step-complete .nicole-step-label {
    color: var(--nicole-text-light);
}

/* Pulse animation for active step icon */
@keyframes nicole-step-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* Dark mode workflow steps */
@media (prefers-color-scheme: dark) {
    .nicole-workflow-steps {
        border-bottom-color: var(--nicole-border);
    }

    .nicole-step-active .nicole-step-label {
        color: var(--nicole-text);
    }

    .nicole-step-complete .nicole-step-label {
        color: var(--nicole-text-light);
    }
}

/* Mobile responsive - workflow steps */
@media (max-width: 480px) {
    .nicole-workflow-steps {
        gap: 4px;
        min-width: 140px;
    }

    .nicole-step {
        font-size: 11px;
    }

    .nicole-step-icon {
        width: 14px;
        height: 14px;
        font-size: 9px;
    }
}

/* Reduced motion - workflow steps */
@media (prefers-reduced-motion: reduce) {
    .nicole-step-active .nicole-step-icon {
        animation: none;
    }
}

/* Scrollbar styling */
.nicole-messages::-webkit-scrollbar {
    width: 6px;
}

.nicole-messages::-webkit-scrollbar-track {
    background: transparent;
}

.nicole-messages::-webkit-scrollbar-thumb {
    background: var(--nicole-border);
    border-radius: 3px;
}

.nicole-messages::-webkit-scrollbar-thumb:hover {
    background: var(--nicole-text-light);
}

/* Firefox scrollbar */
.nicole-messages {
    scrollbar-width: thin;
    scrollbar-color: var(--nicole-border) transparent;
}

/* Knowledge Source Badge Container */
.nicole-knowledge-badge-container {
    margin-top: 10px;
    width: fit-content;
}

/* Knowledge Source Badge (Test Mode Only) */
.nicole-knowledge-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    opacity: 0.9;
    width: fit-content;
    transition: opacity 0.2s ease;
}

.nicole-knowledge-badge:hover {
    opacity: 1;
}

/* Sources Panel (expanded view) */
.nicole-sources-panel {
    margin-top: 8px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 11px;
}

.nicole-source-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #e9ecef;
}

.nicole-source-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.nicole-source-item:first-child {
    padding-top: 0;
}

.nicole-source-item .source-rank {
    color: #6c757d;
    font-weight: 600;
    flex-shrink: 0;
    width: 20px;
}

.nicole-source-item .source-url {
    color: #00135D;
    text-decoration: none;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nicole-source-item .source-url:hover {
    text-decoration: underline;
    color: #00EC7D;
}

.nicole-source-item .source-score {
    color: #059669;
    font-weight: 600;
    flex-shrink: 0;
    background: rgba(0, 200, 100, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.nicole-knowledge-badge .badge-icon {
    font-size: 12px;
}

.nicole-knowledge-badge .badge-label {
    letter-spacing: 0.02em;
}

/* RAG badges - green tones based on confidence */
.nicole-knowledge-badge.badge-rag-high {
    background: rgba(0, 200, 100, 0.15);
    color: #059669;
    border: 1px solid rgba(0, 200, 100, 0.3);
}

.nicole-knowledge-badge.badge-rag-medium {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.nicole-knowledge-badge.badge-rag-low {
    background: rgba(249, 115, 22, 0.15);
    color: #c2410c;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* LLM badge - gray */
.nicole-knowledge-badge.badge-llm {
    background: rgba(113, 113, 122, 0.15);
    color: #52525b;
    border: 1px solid rgba(113, 113, 122, 0.3);
}

/* Golden badge - gold/amber for curated authoritative content */
.nicole-knowledge-badge.badge-golden {
    background: rgba(251, 191, 36, 0.2);
    color: #b45309;
    border: 1px solid rgba(251, 191, 36, 0.5);
}

/* Dark mode knowledge badges */
@media (prefers-color-scheme: dark) {
    .nicole-knowledge-badge.badge-rag-high {
        background: rgba(0, 200, 100, 0.2);
        color: #34d399;
        border-color: rgba(0, 200, 100, 0.4);
    }

    .nicole-knowledge-badge.badge-rag-medium {
        background: rgba(245, 158, 11, 0.2);
        color: #fbbf24;
        border-color: rgba(245, 158, 11, 0.4);
    }

    .nicole-knowledge-badge.badge-rag-low {
        background: rgba(249, 115, 22, 0.2);
        color: #fb923c;
        border-color: rgba(249, 115, 22, 0.4);
    }

    .nicole-knowledge-badge.badge-llm {
        background: rgba(113, 113, 122, 0.2);
        color: #a1a1aa;
        border-color: rgba(113, 113, 122, 0.4);
    }

    .nicole-knowledge-badge.badge-golden {
        background: rgba(251, 191, 36, 0.25);
        color: #fbbf24;
        border-color: rgba(251, 191, 36, 0.5);
    }
}

/* ==========================================================================
   THINKING STREAM
   Professional "behind the scenes" peek at Nicole's reasoning
   ========================================================================== */

.nicole-thinking-stream {
    margin-top: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(0, 236, 125, 0.08) 0%, rgba(0, 19, 93, 0.04) 100%);
    border-radius: 8px;
    border-left: 2px solid var(--nicole-accent);
    position: relative;
    overflow: hidden;
    width: 100%;
    animation: nicole-thinking-breathe 3s ease-in-out infinite;
}

/* Breathing animation for the container */
@keyframes nicole-thinking-breathe {
    0%, 100% {
        opacity: 0.95;
        border-color: rgba(0, 19, 93, 0.08);
    }
    50% {
        opacity: 1;
        border-color: rgba(0, 236, 125, 0.15);
    }
}

/* Header with icon and label */
.nicole-thinking-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Animated thinking icon */
.nicole-thinking-icon {
    width: 16px;
    height: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nicole-thinking-icon::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--nicole-accent);
    border-radius: 50%;
    animation: nicole-thinking-pulse 1.5s ease-in-out infinite;
}

.nicole-thinking-icon::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--nicole-accent);
    border-radius: 50%;
    opacity: 0;
    animation: nicole-thinking-ring 1.5s ease-out infinite;
}

@keyframes nicole-thinking-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

@keyframes nicole-thinking-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Label text */
.nicole-thinking-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--nicole-text-light);
    letter-spacing: 0.01em;
}

/* Animated ellipsis */
.nicole-thinking-ellipsis {
    display: inline-flex;
    gap: 2px;
    margin-left: 2px;
}

.nicole-thinking-ellipsis span {
    width: 3px;
    height: 3px;
    background: var(--nicole-text-light);
    border-radius: 50%;
    animation: nicole-ellipsis-bounce 1.4s ease-in-out infinite;
}

.nicole-thinking-ellipsis span:nth-child(1) {
    animation-delay: 0s;
}

.nicole-thinking-ellipsis span:nth-child(2) {
    animation-delay: 0.2s;
}

.nicole-thinking-ellipsis span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes nicole-ellipsis-bounce {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.nicole-thinking-timer {
    font-size: 11px;
    font-weight: 600;
    color: var(--nicole-accent);
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    min-width: 28px;
    text-align: right;
}

.nicole-thinking-context {
    font-size: 12px;
    color: var(--nicole-text-light);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 19, 93, 0.06);
    opacity: 0.85;
}

.nicole-thinking-context:empty {
    display: none;
}

.nicole-thinking-content {
    font-size: 12px;
    line-height: 1.5;
    color: var(--nicole-text-light);
    opacity: 0.85;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 19, 93, 0.06);
    max-height: 80px;
    overflow: hidden;
    position: relative;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    letter-spacing: -0.02em;
}

.nicole-thinking-content:empty {
    display: none;
}

/* Fade mask at the end of text */
.nicole-thinking-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: linear-gradient(to bottom, transparent, var(--nicole-bg));
    pointer-events: none;
}

/* Typing cursor effect */
.nicole-thinking-cursor {
    display: inline-block;
    width: 1px;
    height: 12px;
    background: var(--nicole-accent);
    margin-left: 2px;
    animation: nicole-cursor-blink 0.8s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes nicole-cursor-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* Dark mode thinking stream */
@media (prefers-color-scheme: dark) {
    .nicole-thinking-stream {
        background: linear-gradient(135deg, rgba(0, 236, 125, 0.05) 0%, rgba(0, 19, 93, 0.08) 100%);
        border-color: rgba(0, 236, 125, 0.1);
    }

    @keyframes nicole-thinking-breathe {
        0%, 100% {
            opacity: 0.95;
            border-color: rgba(0, 236, 125, 0.1);
        }
        50% {
            opacity: 1;
            border-color: rgba(0, 236, 125, 0.25);
        }
    }

    .nicole-thinking-content::after {
        background: linear-gradient(to bottom, transparent, rgba(37, 42, 53, 0.95));
    }
}

/* Reduced motion - thinking stream */
@media (prefers-reduced-motion: reduce) {
    .nicole-thinking-stream {
        animation: none;
    }

    .nicole-thinking-icon::before,
    .nicole-thinking-icon::after,
    .nicole-thinking-ellipsis span,
    .nicole-thinking-cursor {
        animation: none;
    }

    .nicole-thinking-icon::before {
        opacity: 1;
    }

    .nicole-thinking-ellipsis span {
        opacity: 0.6;
    }

    .nicole-thinking-cursor {
        opacity: 1;
    }
}

/* Mobile responsive - thinking stream */
@media (max-width: 480px) {
    .nicole-thinking-stream {
        padding: 10px 12px;
        margin-top: 10px;
    }

    .nicole-thinking-label {
        font-size: 10px;
    }

    .nicole-thinking-content {
        font-size: 10px;
        max-height: 40px;
    }
}
