/* CCAI — Chat-Specific Styles */

/* --- Welcome Screen --- */
#welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
}

.welcome-content {
    text-align: center;
    max-width: 400px;
}

.welcome-logo {
    font-size: 48px;
    font-weight: 700;
    color: var(--lime);
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.welcome-content h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 4px;
}

.welcome-content p {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 32px;
}

.welcome-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.prompt-chip {
    background: var(--dark-gray);
    border: 1px solid var(--border-gray);
    color: var(--white);
    font-family: var(--font);
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.prompt-chip:hover {
    background: var(--mid-gray);
    border-color: var(--lime);
}

/* --- Messages --- */
#messages {
    max-width: 768px;
    margin: 0 auto;
    padding: 16px 0 24px;
}

.message {
    margin-bottom: 20px;
    animation: fadeIn 0.2s ease;
}

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

.message-role {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.message.user .message-role {
    color: var(--light-blue);
}

.message.assistant .message-role {
    color: var(--lime);
}

.message-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--white);
    word-wrap: break-word;
}

.message.user .message-content {
    color: rgba(255, 255, 255, 0.85);
}

/* Markdown rendering within messages */
.message-content p {
    margin-bottom: 12px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content strong {
    font-weight: 700;
    color: var(--white);
}

.message-content em {
    font-style: italic;
    color: var(--violet);
}

.message-content ul, .message-content ol {
    margin: 8px 0 12px 20px;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content blockquote {
    border-left: 3px solid var(--lime);
    padding-left: 12px;
    margin: 12px 0;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.message-content code {
    background: var(--dark-gray);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
}

.message-content pre {
    background: var(--dark-gray);
    border: 1px solid var(--border-gray);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
}

.message-content pre code {
    background: none;
    padding: 0;
}

/* --- Typing Indicator --- */
#typing-indicator {
    max-width: 768px;
    margin: 0 auto;
    padding: 8px 0 24px;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 8px 16px;
    background: var(--dark-gray);
    border-radius: var(--radius);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--lime);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

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

/* --- Streaming cursor --- */
.streaming-cursor::after {
    content: '\u258C';
    color: var(--lime);
    animation: blink 0.8s infinite;
    margin-left: 1px;
}

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

/* --- Voice Button --- */
#voice-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    background: #1A1A1A;
    border: 2px solid #CDFF96;
    color: #CDFF96;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

#voice-btn:active {
    transform: scale(0.95);
}

#voice-btn.recording {
    background: #ff4444;
    border-color: #ff4444;
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(255, 68, 68, 0.3);
    animation: pulse-ring 1.5s ease-in-out infinite;
}

#voice-btn.loading {
    border-color: #BA9AFD;
    color: #BA9AFD;
    animation: pulse-loading 1s ease-in-out infinite;
}

#voice-btn.playing {
    background: #BA9AFD;
    border-color: #BA9AFD;
    color: #ffffff;
    animation: pulse-speak 1.5s ease-in-out infinite;
}

#voice-btn.unsupported {
    opacity: 0.3;
    pointer-events: none;
}

@keyframes pulse-ring {
    0%, 100% { box-shadow: 0 0 0 4px rgba(255, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(255, 68, 68, 0.1); }
}

@keyframes pulse-loading {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes pulse-speak {
    0%, 100% { box-shadow: 0 0 0 4px rgba(186, 154, 253, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(186, 154, 253, 0.1); }
}

/* --- Mobile --- */
@media (max-width: 480px) {
    .welcome-logo {
        font-size: 40px;
    }

    .welcome-content h2 {
        font-size: 20px;
    }

    .prompt-chip {
        font-size: 13px;
        padding: 6px 12px;
    }

    .message-content {
        font-size: 14px;
    }
}
