/**
 * style.css - Modern UI styling for Hermes Voice Interface
 */

:root {
    --primary-color: #4ade80;
    --primary-dark: #22c55e;
    --secondary-color: #3b82f6;
    --accent-color: #8b5cf6;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-indicator {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.status-indicator.connected {
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-color);
}

.status-indicator.disconnected {
    color: #ef4444;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.voice-select {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.voice-select:hover {
    border-color: var(--primary-color);
}

.voice-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

.btn-fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
}

.btn-fullscreen:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
}

/* Conversation Container */
.conversation-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    min-height: 300px;
    max-height: calc(100vh - 350px);
}

.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.welcome-message h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.welcome-message p {
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.feature-list {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.feature-list span {
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.3s ease;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.message-content {
    flex: 1;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.message.user .message-content {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.message.assistant .message-content {
    background: rgba(74, 222, 128, 0.05);
    border-color: rgba(74, 222, 128, 0.2);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.message-author {
    font-weight: 600;
    color: var(--text-primary);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-text {
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* Input Area */
.input-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: rgba(30, 41, 59, 0.8);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

/* Recording Indicator */
.recording-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: #ef4444;
    font-weight: 500;
}

.recording-indicator.active {
    display: flex;
    animation: pulse 1.5s infinite;
}

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

.recording-pulse {
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* Thinking Indicator */
.thinking-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-md);
    color: var(--accent-color);
    font-weight: 500;
}

.thinking-indicator.active {
    display: flex;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

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

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Audio Visualizer */
.audio-visualizer {
    width: 100%;
    height: 60px;
    border-radius: var(--radius-md);
    background: var(--bg-darker);
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Push to Talk Button */
.btn-push-to-talk {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    border-radius: var(--radius-xl);
    color: var(--bg-darker);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 14px rgba(74, 222, 128, 0.3);
}

.btn-push-to-talk:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.4);
}

.btn-push-to-talk:active:not(:disabled) {
    transform: translateY(0);
}

.btn-push-to-talk:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-push-to-talk.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
    animation: recordingPulse 1s infinite;
}

@keyframes recordingPulse {
    0%, 100% {
        box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(239, 68, 68, 0.6);
    }
}

.mic-icon {
    font-size: 1.25rem;
}

/* Text Input Container */
.text-input-container {
    flex: 1;
    display: flex;
    gap: 0.5rem;
    min-width: 200px;
}

.text-input {
    flex: 1;
    padding: 0.875rem 1rem;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

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

.btn-send {
    padding: 0.875rem 1.25rem;
    background: var(--secondary-color);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-send:hover {
    background: #2563eb;
}

/* Voice Mode Button */
.btn-voice-mode {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-voice-mode:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn-voice-mode.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }
    
    .header-left h1 {
        font-size: 1.25rem;
    }
    
    .voice-select {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn-push-to-talk {
        width: 100%;
        justify-content: center;
    }
    
    .text-input-container {
        width: 100%;
    }
    
    .conversation-container {
        max-height: calc(100vh - 400px);
    }
    
    .feature-list {
        gap: 0.75rem;
    }
    
    .feature-list span {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .header-right {
        gap: 0.5rem;
    }
    
    .btn-fullscreen {
        width: 36px;
        height: 36px;
    }
    
    .message {
        gap: 0.75rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .welcome-message h2 {
        font-size: 1.25rem;
    }
    
    .welcome-message p {
        font-size: 0.9rem;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-darker);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: rgba(74, 222, 128, 0.3);
    color: var(--text-primary);
}
