/* Loomy Voice Agent - Dark Mode mit Vivid Gradients */

:root {
    --bg-primary: #0a0a14;
    --bg-secondary: #12121f;
    --bg-tertiary: #1a1a2e;
    --bg-card: rgba(20, 20, 35, 0.7);

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a85;

    --accent-1: #8b5cf6;      /* Vivid Purple */
    --accent-2: #06b6d4;      /* Cyan */
    --accent-3: #f472b6;      /* Pink */
    --accent-4: #4ade80;      /* Green */
    --accent-5: #fbbf24;      /* Gold */

    --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
    --gradient-secondary: linear-gradient(135deg, #f472b6 0%, #8b5cf6 100%);
    --gradient-tertiary: linear-gradient(135deg, #4ade80 0%, #06b6d4 100%);

    --border: rgba(139, 92, 246, 0.2);
    --border-hover: rgba(139, 92, 246, 0.4);

    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.3);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

    --radius: 12px;
    --radius-lg: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(244, 114, 182, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: bg-pulse 15s ease-in-out infinite;
}

@keyframes bg-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 14px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s;
}

.status-indicator.connected .status-dot {
    background: var(--accent-4);
    box-shadow: 0 0 8px var(--accent-4);
}

.status-indicator.recording .status-dot {
    background: var(--accent-3);
    box-shadow: 0 0 8px var(--accent-3);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.error .status-dot {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    flex: 1;
    overflow: hidden;
}

/* Settings Panel */
.settings-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    padding: 24px;
    overflow-y: auto;
}

.settings-panel h2 {
    font-size: 18px;
    margin-bottom: 20px;
    background: var(--gradient-secondary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-group select,
.setting-group input[type="range"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.setting-group select:hover,
.setting-group select:focus {
    border-color: var(--border-hover);
    outline: none;
}

.setting-group input[type="range"] {
    padding: 0;
    -webkit-appearance: none;
    background: transparent;
    height: 6px;
}

.setting-group input[type="range"]::-webkit-slider-runnable-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
    height: 4px;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--gradient-primary);
    border-radius: 50%;
    margin-top: -6px;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

.btn-secondary {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--accent-1);
    background: rgba(139, 92, 246, 0.1);
}

/* Chat Area */
.chat-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome-message {
    text-align: center;
    margin: auto;
    padding: 40px 20px;
    max-width: 500px;
}

.welcome-message h2 {
    font-size: 36px;
    margin-bottom: 16px;
    background: var(--gradient-tertiary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-message p {
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 15px;
}

.welcome-message .hint {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 16px;
    font-style: italic;
}

.message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    animation: message-in 0.3s ease-out;
    word-wrap: break-word;
    line-height: 1.5;
}

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

.message.user {
    align-self: flex-end;
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
    border-bottom-right-radius: 6px;
}

.message.assistant {
    align-self: flex-start;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 6px;
}

.message.system {
    align-self: center;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    font-size: 13px;
    padding: 8px 14px;
}

.message-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Voice Controls */
.voice-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px;
    gap: 12px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
}

.mic-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    position: relative;
}

.mic-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(139, 92, 246, 0.6);
}

.mic-button:active {
    transform: scale(0.98);
}

.mic-button.recording {
    background: linear-gradient(135deg, #f472b6 0%, #ef4444 100%);
    animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); }
}

.mic-button.processing {
    background: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
    pointer-events: none;
}

.mic-hint {
    color: var(--text-secondary);
    font-size: 13px;
    letter-spacing: 0.5px;
}

/* Visualizer */
.visualizer-container {
    height: 80px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#visualizer {
    width: 100%;
    height: 100%;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-1);
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .settings-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 200px;
    }

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

/* ====== Agent Picker ====== */

.agent-picker {
    position: relative;
    margin: 0 16px;
}

.agent-current {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.agent-current:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.agent-emoji {
    font-size: 18px;
    filter: drop-shadow(0 0 6px currentColor);
}

.agent-name {
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.agent-chevron {
    color: var(--text-muted);
    font-size: 10px;
}

.agent-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    z-index: 100;
    display: none;
    overflow: hidden;
}

.agent-dropdown.open {
    display: block;
}

.agent-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.agent-option:last-child {
    border-bottom: none;
}

.agent-option:hover {
    background: var(--bg-tertiary);
}

.agent-option.selected {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.15), transparent);
    border-left: 3px solid var(--accent-1);
}

.agent-option-emoji {
    font-size: 22px;
    width: 32px;
    text-align: center;
    filter: drop-shadow(0 0 6px currentColor);
}

.agent-option-info {
    flex: 1;
    min-width: 0;
}

.agent-option-name {
    font-weight: 600;
    color: var(--text-primary);
}

.agent-option-desc {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-option-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.agent-option-status.online {
    background: var(--accent-4);
    box-shadow: 0 0 8px var(--accent-4);
}

.agent-option-status.offline {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* ====== Text Input ====== */

.text-input {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    padding: 0 4px;
}

.text-input input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.text-input input:focus {
    border-color: var(--accent-1);
}

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

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

/* ====== Session Info ====== */

.session-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.session-id {
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 11px;
    color: var(--text-muted);
    word-break: break-all;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

/* ====== Thinking / Tool indicators ====== */

.message.thinking {
    opacity: 0.7;
    font-style: italic;
}

.message.thinking::after {
    content: '▎';
    animation: blink 1s steps(2) infinite;
    margin-left: 4px;
}

@keyframes blink {
    50% { opacity: 0; }
}

.message-meta .tool-badge {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 6px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 10px;
    color: var(--accent-1);
}

.message .agent-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 14px;
    filter: drop-shadow(0 0 4px currentColor);
}
