/* ============================================
   AudioCom - Voice Chat Application Styles
   Modern Dark Theme with Glassmorphism
   ============================================ */

:root {
    /* Colors - Deep Ocean Theme */
    --bg-primary: #0a0f1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-hover: #374151;
    
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --accent-glow: rgba(99, 102, 241, 0.4);
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Glass Effect */
    --glass-bg: rgba(17, 24, 39, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    
    /* Spacing */
    --sidebar-width: 280px;
    --header-height: 60px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 60%, rgba(168, 85, 247, 0.1) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   Glass Effects & Cards
   ============================================ */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.glass-card {
    background: rgba(31, 41, 55, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
}

/* ============================================
   Layout
   ============================================ */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.main-app.hidden {
    display: none;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo svg {
    width: 28px;
    height: 28px;
    stroke: var(--accent-primary);
}

.sidebar-section {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sidebar-section::-webkit-scrollbar {
    width: 6px;
}

.sidebar-section::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-section::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Room List */
.room-list {
    list-style: none;
}

.room-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

.room-item:hover {
    background: var(--bg-hover);
}

.room-item.active {
    background: var(--accent-primary);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.room-item svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-secondary);
    flex-shrink: 0;
}

.room-item.active svg {
    stroke: var(--text-primary);
}

.room-item-info {
    flex: 1;
    min-width: 0;
}

.room-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-item-users {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.room-item.active .room-item-users {
    color: rgba(255, 255, 255, 0.7);
}

/* User List */
.user-list {
    list-style: none;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.user-item:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    position: relative;
}

.user-avatar.speaking {
    animation: speaking-pulse 1s ease-in-out infinite;
}

@keyframes speaking-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 var(--accent-glow);
    }
    50% {
        box-shadow: 0 0 0 8px transparent;
    }
}

.status-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.status-indicator.online {
    background: var(--success);
}

.status-indicator.offline {
    background: var(--text-muted);
}

.status-indicator.muted {
    background: var(--danger);
}

.user-item-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-item-status {
    display: flex;
    gap: 4px;
}

.user-item-status svg {
    width: 14px;
    height: 14px;
    stroke: var(--danger);
}

/* Sidebar Footer - User Panel */
.sidebar-footer {
    border-top: 1px solid var(--glass-border);
    padding: 12px 16px;
}

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

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

.user-info #current-username {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .room-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-controls {
    display: flex;
    gap: 4px;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Voice Controls Bar */
.voice-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--glass-border);
}

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

.room-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.room-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent-primary);
}

.room-details h2 {
    font-size: 1rem;
    font-weight: 600;
}

.room-details span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.voice-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.voice-btn svg {
    width: 20px;
    height: 20px;
}

.voice-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}

.voice-btn.active {
    background: var(--danger);
}

/* Video button - active state is green (video on is positive) */
#video-btn.active {
    background: var(--success);
}

.voice-btn.disconnect {
    background: transparent;
    border: 2px solid var(--danger);
}

.voice-btn.disconnect:hover {
    background: var(--danger);
}

.voice-btn.disconnect svg {
    stroke: var(--danger);
}

.voice-btn.disconnect:hover svg {
    stroke: var(--text-primary);
}

.voice-btn .hidden {
    display: none;
}

/* Speaking indicator for VAD */
.voice-btn.speaking {
    background: var(--success);
    animation: pulse-speaking 1s infinite;
}

@keyframes pulse-speaking {
    0%, 100% { box-shadow: 0 0 0 0 rgba(67, 181, 129, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(67, 181, 129, 0); }
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
    --pulse-color: var(--success);
}

.indicator.connected {
    background: var(--pulse-color, var(--success));
}

.indicator.disconnected {
    background: var(--danger);
}

.indicator .pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--pulse-color, inherit);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

#connection-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 70px;
    cursor: help;
}

/* Voice Activity Grid */
.voice-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Video Grid */
.video-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
    min-height: 200px;
}

.video-grid.hidden {
    display: none;
}

.video-grid.grid-1 {
    grid-template-columns: 1fr;
    max-width: 800px;
    margin: 0 auto 24px;
}

.video-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.video-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
}

.video-grid.grid-many {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.video-tile {
    position: relative;
    background: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border: 2px solid transparent;
    transition: all var(--transition-normal);
}

.video-tile.local {
    border-color: var(--accent-primary);
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-tile .video-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
}

.video-tile.speaking {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

/* Voice Grid */
.voice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    min-height: 200px;
}

.voice-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
    text-align: center;
}

.voice-placeholder svg {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    stroke: var(--text-muted);
    opacity: 0.5;
}

.voice-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.voice-card.speaking {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.voice-card .user-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.voice-card .user-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.voice-card .user-room {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.voice-card .user-status-icons {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    min-height: 20px;
}

.voice-card .status-icon {
    font-size: 0.9rem;
    opacity: 0.8;
}

.voice-card .voice-indicator {
    display: flex;
    gap: 3px;
    margin-top: 12px;
}

.voice-indicator .bar {
    width: 4px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 2px;
    transform: scaleY(0.3);
    transition: background var(--transition-fast);
}

/* Only animate when speaking AND not muted */
.voice-card.speaking:not(.muted) .voice-indicator .bar {
    background: var(--success);
    animation: voice-bar 0.5s ease-in-out infinite;
}

/* Show red/muted indicator when muted */
.voice-card.muted .voice-indicator .bar {
    background: var(--danger);
    opacity: 0.5;
}

.voice-indicator .bar:nth-child(1) { animation-delay: 0s; }
.voice-indicator .bar:nth-child(2) { animation-delay: 0.1s; }
.voice-indicator .bar:nth-child(3) { animation-delay: 0.2s; }
.voice-indicator .bar:nth-child(4) { animation-delay: 0.1s; }
.voice-indicator .bar:nth-child(5) { animation-delay: 0s; }

@keyframes voice-bar {
    0%, 100% { transform: scaleY(0.3); }
    50% { transform: scaleY(1); }
}

/* Chat Section */
.chat-section {
    height: 200px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--glass-border);
    margin: 0 24px 24px;
    border-radius: var(--border-radius);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
}

.chat-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 2px;
}

.welcome-message {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 20px;
}

.chat-message {
    margin-bottom: 8px;
}

.chat-message .sender {
    font-weight: 600;
    color: var(--accent-primary);
    margin-right: 8px;
}

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

.chat-message .content {
    margin-top: 2px;
    word-wrap: break-word;
}

.chat-input-wrapper {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    border-top: 1px solid var(--glass-border);
}

.chat-input-wrapper input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-fast);
}

.chat-input-wrapper input:focus {
    border-color: var(--accent-primary);
}

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

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    border: none;
    background: var(--accent-primary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-send:hover {
    background: var(--accent-secondary);
    transform: scale(1.05);
}

.btn-send svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   Modals
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 100%;
    max-width: 420px;
    padding: 32px;
    transform: scale(0.9) translateY(20px);
    transition: all var(--transition-normal);
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.modal-icon svg {
    width: 40px;
    height: 40px;
    stroke: white;
}

.modal-content h1 {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-content .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

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

.form-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-actions button {
    flex: 1;
}

/* Buttons */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-secondary {
    padding: 14px 24px;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-close:hover {
    background: var(--danger);
    color: white;
}

.btn-close svg {
    width: 16px;
    height: 16px;
}

/* Error Message */
.error-message {
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 16px;
    min-height: 20px;
}

/* Badge */
.badge {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Volume Meter */
.volume-meter {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.meter-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.1s ease;
}

/* Settings Modal */
.settings-content {
    max-height: 400px;
    overflow-y: auto;
}

.settings-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--glass-border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

/* ============================================
   Utilities
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Warning Banner */
.warning-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.warning-banner svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.warning-banner span {
    flex: 1;
    font-size: 0.9rem;
}

.warning-banner.hidden {
    display: none;
}

/* Mobile Header */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-header span {
    font-weight: 600;
    font-size: 1rem;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-app {
        flex-direction: column;
    }
    
    .main-content {
        width: 100%;
        height: calc(100vh - 56px);
        display: flex;
        flex-direction: column;
    }
    
    .voice-controls {
        padding: 8px 12px;
        flex-wrap: nowrap;
        gap: 8px;
        order: 2;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 40;
        background: var(--glass-bg);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--glass-border);
        border-bottom: none;
    }
    
    .room-info {
        display: none;
    }
    
    .voice-buttons {
        flex: 1;
        justify-content: center;
        gap: 12px;
    }
    
    .voice-btn {
        width: 52px;
        height: 52px;
    }
    
    .connection-status {
        display: none;
    }
    
    .voice-area {
        flex: 1;
        padding: 16px;
        padding-bottom: 80px;
        overflow-y: auto;
    }
    
    .chat-section {
        position: fixed;
        bottom: 80px;
        left: 0;
        right: 0;
        max-height: 50vh;
        margin: 0;
        border-radius: 16px 16px 0 0;
        z-index: 30;
        transform: translateY(calc(100% - 50px));
        transition: transform var(--transition-normal);
    }
    
    .chat-section.expanded {
        transform: translateY(0);
    }
    
    .chat-header {
        cursor: pointer;
        padding: 16px;
    }
    
    .chat-messages {
        max-height: calc(50vh - 120px);
    }
    
    .chat-input-wrapper {
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    /* Settings modal on mobile */
    .modal-content {
        margin: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .settings-content {
        max-height: calc(100vh - 150px);
    }
    
    /* User panel in sidebar footer */
    .sidebar-footer {
        padding: 12px;
    }
    
    .user-panel {
        gap: 8px;
    }
    
    .user-controls {
        display: flex;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .voice-btn {
        width: 48px;
        height: 48px;
    }
    
    .voice-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .voice-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chat-input-wrapper input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    #username-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Safe area insets for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
    .voice-controls {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    .mobile-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
}

