/* ============================================
   AI Meeting Simulator - Dark Mode Styles
   Clean, modern "Zoom-like" meeting interface
   ============================================ */

/* --- CSS Variables / Design Tokens --- */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-hover: #1e1e2a;
    --bg-input: #1a1a25;
    
    --border-color: #2a2a3a;
    --border-focus: #6366f1;
    
    --text-primary: #f1f1f3;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-dim: rgba(99, 102, 241, 0.15);
    
    --success: #22c55e;
    --success-dim: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Screen Management --- */
.screen {
    display: none;
    width: 100%;
    height: 100vh;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* ============================================ */
/* JOIN SCREEN */
/* ============================================ */
.join-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, var(--bg-primary) 70%);
}

.join-card {
    width: 100%;
    max-width: 480px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

/* Brand */
.brand {
    text-align: center;
    margin-bottom: 32px;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--accent-dim);
    color: var(--accent);
    margin-bottom: 16px;
}

.brand h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.brand-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Join Form */
.join-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea {
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group textarea {
    resize: vertical;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    min-height: 60px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.form-hint code {
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-join {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 8px;
}

/* Join Status */
.join-status {
    padding: 12px 16px;
    margin-top: 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: center;
}

.join-status.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.join-status.success {
    background: var(--success-dim);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

/* Join Footer */
.join-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.join-footer p {
    font-size: 13px;
    color: var(--text-muted);
}

.join-footer strong {
    color: var(--text-secondary);
}

/* ============================================ */
/* MEETING SCREEN */
/* ============================================ */
#meeting-screen {
    flex-direction: column;
    height: 100vh;
}

/* Meeting Header */
.meeting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    min-height: 56px;
    flex-shrink: 0;
}

.header-left,
.header-right {
    flex: 0 0 auto;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
}

.meeting-timer {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.meeting-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger);
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.meeting-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--danger);
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Meeting Content */
.meeting-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 20px;
    gap: 20px;
    min-height: 0;
}

/* Avatar Section */
.avatar-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    min-width: 0;
}

.avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.avatar-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    padding: 4px;
    background: var(--border-color);
    transition: background var(--transition-slow);
}

.avatar-ring.speaking {
    background: linear-gradient(135deg, var(--accent), #a855f7, var(--accent));
    animation: rotate-ring 3s linear infinite;
}

@keyframes rotate-ring {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(360deg); }
}

.avatar-ring-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-face {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
}

.avatar-pulse {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.avatar-pulse.pulsing {
    opacity: 1;
    animation: avatar-pulse 1.2s ease-in-out infinite;
}

@keyframes avatar-pulse {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.05); opacity: 0.3; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

.avatar-initials {
    font-size: 42px;
    font-weight: 700;
    color: var(--text-primary);
    user-select: none;
}

.avatar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-dot.speaking-dot {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
    animation: pulse-dot 0.5s ease-in-out infinite;
}

.status-dot.offline {
    background: var(--text-muted);
}

.avatar-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.avatar-role {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Hints Section */
.hints-section {
    width: 100%;
    max-width: 500px;
}

.hints-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.hints-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.hint-card {
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.hint-card:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent-hover);
    transform: translateY(-1px);
}

/* Panel Section */
.panel-section {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* Controls Card */
.controls-card {
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.controls-card h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 12px;
}

.control-btn:hover {
    background: var(--bg-hover);
}

.control-btn.active {
    border-color: var(--success);
    color: var(--success);
}

.control-btn.muted {
    border-color: var(--danger);
    color: var(--danger);
}

.control-btn svg {
    width: 22px;
    height: 22px;
}

/* Audio Level Meter */
.audio-meter {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meter-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meter-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.meter-fill {
    width: 0%;
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 100ms ease;
}

.meter-fill.active {
    background: var(--accent);
}

/* Transcript Card */
.transcript-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 0;
}

.transcript-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.transcript-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.transcript-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    min-height: 0;
}

.transcript-body::-webkit-scrollbar {
    width: 4px;
}

.transcript-body::-webkit-scrollbar-track {
    background: transparent;
}

.transcript-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.transcript-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 20px;
}

.transcript-empty p {
    margin-bottom: 4px;
}

.transcript-hint {
    font-size: 11px !important;
    color: var(--text-muted) !important;
}

/* Transcript Messages */
.transcript-message {
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
    animation: fadeIn 300ms ease;
}

.transcript-message.alex {
    background: var(--accent-dim);
    border-left: 3px solid var(--accent);
}

.transcript-message.user {
    background: var(--bg-hover);
    border-left: 3px solid var(--text-muted);
}

.transcript-message .msg-role {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.transcript-message.alex .msg-role {
    color: var(--accent);
}

.transcript-message .msg-text {
    color: var(--text-primary);
}

.transcript-message .msg-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Connection Bar */
.connection-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 8px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.connection-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.conn-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}

.conn-dot.connected {
    background: var(--success);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.conn-dot.disconnected {
    background: var(--danger);
}

.connection-item code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

/* ============================================ */
/* RESPONSIVE */
/* ============================================ */
@media (max-width: 768px) {
    .meeting-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .avatar-section {
        flex-shrink: 0;
    }
    
    .panel-section {
        width: 100%;
        flex: 1;
    }
    
    .avatar-ring {
        width: 120px;
        height: 120px;
    }
    
    .avatar-face {
        width: 90px;
        height: 90px;
    }
    
    .avatar-initials {
        font-size: 30px;
    }
    
    .hints-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .join-card {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .join-card {
        padding: 20px;
    }
    
    .brand h1 {
        font-size: 18px;
    }
    
    .connection-bar {
        gap: 12px;
        flex-wrap: wrap;
    }
}