/* MUZE AI - Dark Neon Theme */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b0;
    --neon-cyan: #ffb347;          /* sunset gold (primary accent) */
    --neon-magenta: #ff5e78;       /* sunset coral/pink */
    --neon-purple: #a155e8;        /* twilight violet */
    --sunset-grad: linear-gradient(135deg, #2b1055 0%, #7597de 0%, #4a1e6b 18%, #a1358f 42%, #ff5e78 68%, #ff9a3d 86%, #ffd166 100%);
    --sunset-grad-soft: linear-gradient(135deg, rgba(161,85,232,0.35), rgba(255,94,120,0.35), rgba(255,179,71,0.35));
    --neon-glow: 0 0 10px rgba(255, 154, 61, 0.5);
    --border-color: #2a2a3a;
    --success: #00ff88;
    --warning: #ffaa00;
    --error: #ff3366;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #171029 0%, #221338 45%, #2d1530 75%, #3a1a2c 100%);
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.6;
    overflow: hidden;
}

.container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto auto 1fr;
    height: 100vh;
    gap: 0;
}

/* Header */
.header {
    grid-column: 1 / -1;
    background: linear-gradient(180deg, rgba(26,16,42,0.95), rgba(45,21,48,0.9));
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, #a155e8, #ff5e78, #ff9a3d, #ffd166) 1;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 24px rgba(255, 94, 120, 0.25);
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
}

.neon-text {
    background: linear-gradient(90deg, #ffd166, #ff9a3d, #ff5e78, #a155e8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 0 8px rgba(255, 154, 61, 0.4));
    animation: neon-pulse 3s ease-in-out infinite;
}

@keyframes neon-pulse {
    0%, 100% { text-shadow: 0 0 10px rgba(255, 154, 61, 0.55); }
    50% { text-shadow: 0 0 22px rgba(255, 94, 120, 0.85), 0 0 34px rgba(255, 209, 102, 0.45); }
}

.tagline {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success);
}

.status-dot.error {
    background: var(--error);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #a155e8, #ff5e78, #ff9a3d);
    border-radius: 4px;
}

.welcome-message {
    text-align: center;
    padding: 3rem;
    background: linear-gradient(160deg, rgba(43,26,58,0.9), rgba(34,19,48,0.9));
    border-radius: 12px;
    border: 1px solid transparent;
    border-image: linear-gradient(135deg, rgba(161,85,232,0.6), rgba(255,94,120,0.6), rgba(255,154,61,0.6)) 1;
}

.welcome-message h2 {
    color: var(--neon-cyan);
    font-size: 2rem;
    margin-bottom: 1rem;
    text-shadow: var(--neon-glow);
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.hint {
    font-size: 0.95rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 1rem;
}

.message {
    display: flex;
    gap: 1rem;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #ff5e78, #ff9a3d);
    color: #1a0f1e;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #a155e8, #ff5e78);
    color: #fff;
}

.message-content {
    max-width: 70%;
    background: linear-gradient(160deg, rgba(43,26,58,0.92), rgba(34,19,48,0.92));
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.message.user .message-content {
    background: linear-gradient(160deg, rgba(58,26,44,0.92), rgba(43,20,38,0.92));
    border-color: rgba(255, 94, 120, 0.55);
}

.message.assistant .message-content {
    border-color: rgba(255, 179, 71, 0.5);
}

.message-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.message-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.eta-badge {
    background: linear-gradient(135deg, #a155e8, #ff5e78);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.verified-badge {
    background: var(--success);
    color: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Input Area */
.input-area {
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
    padding: 1.5rem 2rem;
}

.input-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.control-btn, .fusion-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:hover, .fusion-btn:hover {
    background: var(--bg-primary);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(255, 154, 61, 0.3);
}

.model-select {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.model-select:focus {
    outline: none;
    border-color: var(--neon-cyan);
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
    max-height: 200px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(255, 154, 61, 0.2);
}

.send-btn {
    background: linear-gradient(135deg, #a155e8 0%, #ff5e78 45%, #ff9a3d 75%, #ffd166 100%);
    border: none;
    color: var(--bg-primary);
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff5e78 0%, #ff9a3d 50%, #ffd166 100%);
    box-shadow: 0 0 24px rgba(255, 94, 120, 0.6);
    transform: translateY(-1px);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.attached-files {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.attached-file {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.attached-file .remove-file {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar */
.sidebar {
    background: var(--bg-secondary);
    border-left: 2px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-section h3 {
    color: var(--neon-cyan);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-shadow: var(--neon-glow);
}

.status-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.status-item .label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.status-item .value {
    color: var(--text-primary);
    font-weight: 600;
}

.model-list, .learnings-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.model-item, .learning-item {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.model-item .model-name {
    color: var(--text-primary);
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 2px solid var(--neon-cyan);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(255, 154, 61, 0.3);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--neon-cyan);
    text-shadow: var(--neon-glow);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--error);
}

.modal-body {
    padding: 1.5rem;
}

.fusion-models {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.fusion-model-option {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.fusion-model-option:hover {
    border-color: var(--neon-cyan);
}

.fusion-model-option.selected {
    border-color: var(--neon-magenta);
    background: rgba(255, 0, 255, 0.1);
}

.fusion-model-option input[type="checkbox"] {
    margin-right: 0.5rem;
}

.selected-count {
    text-align: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-primary);
}

.btn-primary {
    background: var(--neon-cyan);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--neon-magenta);
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none;
    }
}


/* === Sunset Expansion v3 footer accent === */
.input-area {
    border-top: 2px solid transparent;
    border-image: linear-gradient(90deg, #a155e8, #ff5e78, #ff9a3d, #ffd166) 1;
}
/* MUZE AI - additions for v2 frontend: thinking indicator, badges, countdown */

.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}
.thinking-dots {
    display: inline-flex;
    gap: 5px;
}
.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon, #00d4ff);
    animation: bounce 1.2s infinite ease-in-out;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}
.thinking-text {
    color: var(--text-dim, #8899aa);
    font-size: 0.9em;
}
.eta-count {
    font-weight: 700;
    color: var(--neon, #00d4ff);
    font-variant-numeric: tabular-nums;
}

.message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    font-size: 0.75em;
    color: var(--text-dim, #8899aa);
    align-items: center;
}
.message-meta span {
    background: rgba(255,255,255,0.04);
    padding: 2px 8px;
    border-radius: 4px;
}

.verified-badge {
    background: rgba(0, 220, 130, 0.15) !important;
    color: #00dc82 !important;
    border: 1px solid rgba(0, 220, 130, 0.4);
    padding: 2px 8px;
    border-radius: 4px;
}
.lessons-badge {
    background: rgba(0, 212, 255, 0.12) !important;
    color: #00d4ff !important;
    border: 1px solid rgba(0, 212, 255, 0.35);
    padding: 2px 8px;
    border-radius: 4px;
}

.citations {
    margin-top: 8px;
    font-size: 0.8em;
    color: var(--text-dim, #8899aa);
}
.citations a {
    color: var(--neon, #00d4ff);
    text-decoration: none;
    word-break: break-all;
}
.citations a:hover { text-decoration: underline; }

.message-text pre {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
}
.message-text code {
    background: rgba(0,0,0,0.3);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}
.message-text pre code {
    background: none;
    padding: 0;
}
.message-text h3, .message-text h4 {
    margin: 10px 0 6px;
    color: var(--neon, #00d4ff);
}
.message-text h3 { font-size: 1.15em; }
.message-text h4 { font-size: 1.0em; }

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}
.status-dot.connected { background: #00dc82; box-shadow: 0 0 8px #00dc82; }
.status-dot.error { background: #ff4757; box-shadow: 0 0 8px #ff4757; }
.status-dot.disconnected { background: #ffa502; }
