/* ================================================================
   AURA AI — Chat & Interactive Messages
   Autonomous AI Console / Conversational Stream / Holographic Cards
   ================================================================ */

/* ── Chat Messages Scroll View ── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    scroll-behavior: smooth;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(57, 255, 20, 0.15) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(57, 255, 20, 0.25);
    border-radius: 4px;
}

/* ── Futuristic Welcome Screen ── */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80%;
    text-align: center;
    padding: 30px 16px;
    animation: fadeInSmooth 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.welcome-logo-stage {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.welcome-logo-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1.5px dashed rgba(57, 255, 20, 0.4);
    animation: ringSpin 15s linear infinite;
}

.welcome-logo-disc {
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(57, 255, 20, 0.3) 0%, transparent 70%);
    filter: blur(15px);
    animation: auraLogoBreathe 5s infinite ease-in-out;
}

.welcome-logo-img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 16px var(--aura-green-glow));
    animation: auraLogoBreathe 5s infinite ease-in-out;
}

.welcome-title {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--text-primary);
    text-shadow: 0 0 24px rgba(57, 255, 20, 0.5);
    margin-bottom: 8px;
}

.welcome-subtitle {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-secondary);
    max-width: 520px;
    margin-bottom: 32px;
    letter-spacing: 0.3px;
}

.welcome-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    max-width: 780px;
    width: 100%;
}

.suggestion-card {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: rgba(8, 20, 17, 0.6);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
}

.suggestion-card:hover {
    background: rgba(12, 32, 26, 0.85);
    border-color: var(--aura-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 16px rgba(57, 255, 20, 0.2);
}

.suggestion-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.suggestion-text {
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.suggestion-card:hover .suggestion-text {
    color: var(--text-primary);
}

/* ── Messages Container ── */
.messages-container {
    max-width: 880px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* ── Individual Message Structure ── */
.message {
    display: flex;
    gap: 14px;
    animation: messageEntrance 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    max-width: 100%;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar-wrap {
    width: 36px;
    height: 36px;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
}

.message.assistant .message-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    filter: drop-shadow(0 0 8px var(--aura-green-glow));
}

.message.user .message-avatar-user {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    color: var(--aura-green);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.message-content {
    max-width: calc(100% - 50px);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.message.user .message-content {
    align-items: flex-end;
}

.message-bubble {
    padding: 16px 20px;
    font-size: 14.5px;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
    border-radius: var(--radius-lg);
    position: relative;
}

/* User Bubble */
.message.user .message-bubble {
    background: linear-gradient(135deg, #0c2620 0%, #081a15 100%);
    border: 1px solid var(--border-medium);
    border-top-right-radius: var(--radius-xs);
    color: var(--text-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(57, 255, 20, 0.05);
}

/* Assistant Bubble */
.message.assistant .message-bubble {
    background: rgba(6, 16, 13, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--aura-green);
    border-top-left-radius: var(--radius-xs);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ── Live Badge ── */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: rgba(57, 255, 20, 0.08);
    border: 1px solid var(--border-medium);
    color: var(--aura-green);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 10px;
    width: fit-content;
}

.live-badge .pulse-circle {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--aura-green);
    box-shadow: 0 0 6px var(--aura-green);
    animation: auraStatusPulse 1.8s infinite;
}

/* ── Sources Section ── */
.sources-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.sources-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.source-number {
    font-size: 11px;
    font-weight: 700;
    color: var(--aura-green);
    font-family: var(--font-mono);
}

.source-item a {
    font-size: 12.5px;
    color: var(--aura-cyan);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-item a:hover {
    text-decoration: underline;
    color: var(--aura-green-bright);
}

/* ── Message Actions ── */
.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.message:hover .message-actions {
    opacity: 1;
}

.msg-action-btn {
    padding: 5px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    background: var(--bg-glass-light);
    color: var(--text-tertiary);
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition-fast);
}

.msg-action-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--aura-green);
    color: var(--aura-green);
}

/* ── Thinking & Status Indicator ── */
.search-indicator {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    max-width: 880px;
    margin: 0 auto 12px;
    border-radius: var(--radius-md);
    background: rgba(8, 24, 20, 0.75);
    border: 1px solid var(--border-medium);
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.12);
    backdrop-filter: blur(20px);
    animation: fadeInSmooth 0.3s ease;
}

.search-indicator-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    animation: auraLogoGenerating 2s infinite ease-in-out;
}

.search-status-text {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--aura-green);
    letter-spacing: 0.5px;
}

/* ── Markdown & Typography Inside Bubble ── */
.message-bubble h1, .message-bubble h2, .message-bubble h3,
.message-bubble h4, .message-bubble h5, .message-bubble h6 {
    margin-top: 18px;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.message-bubble h1 { font-size: 22px; }
.message-bubble h2 { font-size: 18px; color: var(--aura-green); }
.message-bubble h3 { font-size: 16px; }
.message-bubble h1:first-child, .message-bubble h2:first-child, .message-bubble h3:first-child { margin-top: 0; }

.message-bubble p { margin-bottom: 10px; }
.message-bubble p:last-child { margin-bottom: 0; }

.message-bubble ul, .message-bubble ol {
    padding-left: 22px;
    margin-bottom: 10px;
}

.message-bubble li { margin-bottom: 5px; }

.message-bubble strong { font-weight: 700; color: #ffffff; }
.message-bubble em { font-style: italic; color: var(--text-secondary); }

.message-bubble a {
    color: var(--aura-cyan);
    text-decoration: none;
    border-bottom: 1px dotted var(--aura-cyan);
}
.message-bubble a:hover {
    color: var(--aura-green);
    border-bottom-style: solid;
}

.message-bubble blockquote {
    border-left: 3px solid var(--aura-green);
    padding: 10px 16px;
    margin: 12px 0;
    background: rgba(57, 255, 20, 0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

/* Code Blocks & Developer Console Styling */
.message-bubble code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: rgba(4, 12, 10, 0.85);
    border: 1px solid var(--border-subtle);
    padding: 2px 7px;
    border-radius: 4px;
    color: var(--aura-green);
}

.message-bubble pre {
    margin: 14px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-medium);
    background: #020605;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: rgba(6, 18, 15, 0.9);
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
}

.code-copy-btn {
    padding: 4px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    background: var(--bg-glass-light);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.code-copy-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--aura-green);
    border-color: var(--aura-green);
}

.message-bubble pre code {
    display: block;
    background: transparent;
    border: none;
    padding: 16px 18px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-primary);
    white-space: pre;
}

/* Syntax Highlighting */
.token-keyword { color: #55efc4; font-weight: 600; }
.token-string { color: #a8e6cf; }
.token-number { color: #ffeaa7; }
.token-comment { color: #5d7c72; font-style: italic; }
.token-function { color: #81ecec; }

/* ── Streaming Cursor ── */
.streaming-cursor {
    display: inline-block;
    width: 3px;
    height: 18px;
    background: var(--aura-green);
    box-shadow: 0 0 8px var(--aura-green);
    margin-left: 3px;
    animation: cursorBlink 0.9s step-end infinite;
    vertical-align: text-bottom;
}

/* ── Floating Rounded Chat Input ── */
.chat-input-container {
    padding: 0 20px 20px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    background: transparent;
    position: relative;
    z-index: 10;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    background: rgba(8, 20, 17, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-medium);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(57, 255, 20, 0.06);
    transition: all var(--transition-normal);
    max-width: 880px;
    margin: 0 auto;
    width: 100%;
}

.chat-input-wrapper:focus-within {
    border-color: var(--aura-green);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 24px rgba(57, 255, 20, 0.25);
    background: rgba(12, 28, 24, 0.95);
}

.input-action-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 8px;
    min-width: 40px;
    min-height: 40px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.input-action-btn:hover {
    color: var(--aura-green);
    background: var(--bg-glass-hover);
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: clamp(14px, 3.5vw, 15px);
    line-height: 1.55;
    resize: none;
    max-height: 140px;
    scrollbar-width: none;
}

.chat-input::placeholder {
    color: var(--text-tertiary);
}

.btn-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--aura-green);
    color: #030708;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: 0 0 16px rgba(57, 255, 20, 0.45);
    flex-shrink: 0;
}

.btn-send:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    background: var(--text-tertiary);
}

.btn-send:not(:disabled):hover {
    background: var(--aura-green-bright);
    box-shadow: 0 0 24px rgba(57, 255, 20, 0.7);
    transform: scale(1.06);
}

.input-footer-caption {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    max-width: 880px;
    margin-left: auto;
    margin-right: auto;
    letter-spacing: 0.3px;
}

/* ── Mobile Chat Responsive Enhancements (<= 768px) ── */
@media (max-width: 768px) {
    .chat-messages {
        padding: 14px 12px;
    }

    .welcome-screen {
        padding: 16px 8px;
    }

    .welcome-title {
        font-size: clamp(26px, 7vw, 32px);
    }

    .welcome-subtitle {
        font-size: 13.5px;
        margin-bottom: 20px;
    }

    .welcome-suggestions-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .suggestion-card {
        padding: 12px 14px;
    }

    .message {
        gap: 10px;
    }

    .message-avatar-wrap {
        width: 30px;
        height: 30px;
    }

    .message-content {
        max-width: calc(100% - 40px);
    }

    .message-bubble {
        padding: 12px 14px;
        font-size: 14px;
        line-height: 1.6;
    }

    .chat-input-container {
        padding: 0 10px 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    }

    .chat-input-wrapper {
        padding: 8px 12px;
        gap: 6px;
    }

    .btn-send {
        width: 38px;
        height: 38px;
    }

    .input-footer-caption {
        font-size: 10px;
        margin-top: 6px;
    }

    /* Scrollable Code Blocks & Tables */
    pre, .code-block {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
