/* 
 * Enhanced UI v3.0 - Modern Dark Theme 
 * Designed for Professional Conference Assistant
 */

:root {
    /* Color Palette */
    --primary: #6366f1;       /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --primary-light: #818cf8;
    
    --secondary: #0f172a;     /* Slate 900 */
    --secondary-light: #1e293b; /* Slate 800 */
    
    --accent: #06b6d4;        /* Cyan 500 */
    --success: #10b981;       /* Emerald 500 */
    --warning: #f59e0b;       /* Amber 500 */
    --danger: #ef4444;        /* Red 500 */
    
    /* Backgrounds */
    --bg-main: #020617;       /* Slate 950 */
    --bg-panel: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity */
    --bg-panel-border: rgba(255, 255, 255, 0.1);
    
    /* Text */
    --text-main: #f8fafc;     /* Slate 50 */
    --text-muted: #94a3b8;    /* Slate 400 */
    --text-dim: #64748b;      /* Slate 500 */
    
    /* UI Elements */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    
    --font-main: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    height: 100vh;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Layout Structure */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: radial-gradient(circle at top right, #1e1b4b, transparent 40%),
                radial-gradient(circle at bottom left, #0f172a, transparent 40%);
}

/* Header */
.app-header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bg-panel-border);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
}

.logo i {
    color: var(--primary);
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.version-badge {
    font-size: 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.meeting-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 12px;
    border-radius: 6px;
}

.speaker-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.speaker-indicator.primary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(79, 70, 229, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
}

.btn-settings {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-settings:hover {
    color: var(--text-main);
    transform: rotate(30deg);
}

/* Main Content Grid */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 400px; /* Transcription gets more space */
    gap: 24px;
    padding: 24px;
    overflow: hidden;
}

/* Panels */
.panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--bg-panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h2 i {
    color: var(--text-muted);
}

/* Transcription Panel Specifics */
.transcription-panel {
    position: relative;
}

/* Voice Visualizer */
.voice-visualizer {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--bg-panel-border);
}

.visualizer-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 30px;
}

.visualizer-bars span {
    width: 6px;
    background: var(--primary);
    border-radius: 999px;
    height: 4px;
    transition: height 0.1s ease;
    animation: bounce 1s infinite ease-in-out;
}

@keyframes bounce {
    0%, 100% { height: 4px; opacity: 0.5; }
    50% { height: 16px; opacity: 1; }
}

/* Controls */
.control-buttons {
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.btn {
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: var(--font-main);
}

.btn-large {
    padding: 12px 32px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Transcript Area */
.transcript-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    background: rgba(0,0,0,0.1);
}

.current-speech .placeholder {
    text-align: center;
    color: var(--text-dim);
    margin-top: 40px;
    font-size: 1.1rem;
}

/* Speech Bubbles */
.speech-bubble {
    padding: 16px;
    border-radius: 16px;
    max-width: 85%;
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
    position: relative;
    border: 1px solid var(--bg-panel-border);
}

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

/* Primary Speaker */
.speech-bubble.speaker-primary {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    margin-right: auto;
    border-top-left-radius: 4px;
}

.speech-bubble.speaker-primary .speaker-name {
    color: var(--primary-light);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: block;
}

/* Secondary Speaker / Others */
.speech-bubble.speaker-secondary {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
    margin-left: auto;
    border-top-right-radius: 4px;
}

.speech-bubble.speaker-secondary .speaker-name {
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: block;
    text-align: right;
}

/* Analysis Panel Specifics */
.analysis-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
}

.sub-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* For Flexbox scrolling */
}

/* Badges */
.badge {
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
}
.badge-ai { background: var(--primary); }
.badge-summary { background: var(--accent); color: #000; }

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-dim);
    text-align: center;
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

.api-hint {
    font-size: 0.75rem;
    margin-top: 8px;
    color: var(--text-dim);
    border-top: 1px solid var(--bg-panel-border);
    padding-top: 8px;
}

/* Content Lists */
.questions-list, .ai-answers-list, .meeting-summary {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Stats Bar */
.stats-bar {
    height: 48px;
    background: #020617;
    border-top: 1px solid var(--bg-panel-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    font-size: 0.85rem;
}

.stat-item {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-item i { color: var(--text-dim); }
.stat-item strong { color: var(--text-main); font-weight: 600; }

.export-buttons {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-secondary { background: var(--secondary-light); color: var(--text-muted); }
.btn-export { background: var(--accent); color: #000; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius-lg);
    width: 600px;
    max-width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--bg-panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-size: 1.2rem; }

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Form Elements */
.setting-section { margin-bottom: 24px; }
.setting-section h4 { margin-bottom: 16px; color: var(--primary-light); font-size: 1rem; }

.setting-group { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.setting-group label { font-size: 0.9rem; font-weight: 500; }

input[type="text"], input[type="password"], textarea, select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius-sm);
    padding: 10px;
    color: var(--text-main);
    font-family: inherit;
    width: 100%;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Additional specific styles from original logic */
.speaker-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--bg-panel-border);
}

.speaker-hint-box {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.api-key-input-wrapper { display: flex; gap: 8px; }

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }
    .analysis-panel {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .analysis-panel { grid-template-columns: 1fr; }
    .app-header h1 { display: none; }
}

/* Utility */
.setting-divider {
    height: 1px;
    background: var(--bg-panel-border);
    margin: 20px 0;
}
.setting-hint { font-size: 0.8rem; color: var(--text-dim); }

/* Preset Buttons */
.preset-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-preset {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-panel-border);
    color: var(--text-muted);
}

.btn-preset:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}