:root {
    --bg-dark: #202124;
    --bg-darker: #18191b;
    --bg-sidebar: #1a1a1d;
    --panel: #2a2b2e;
    --surface: #333438;
    --border: #3c3d40;
    --text: #e8eaed;
    --text-dim: #9aa0a6;
    --accent: #1a73e8;
    --accent-hover: #1765cc;
    --danger: #ea4335;
    --success: #34a853;
    --warning: #fbbc04;
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'Google Sans', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== Landing / Auth ===== */
.landing-header {
    padding: 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.landing-header img, .meet-logo { width: 36px; height: 36px; }
.landing-header span { font-size: 22px; font-weight: 500; }

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    padding: 60px 0;
    flex-wrap: wrap;
}
.hero-text h1 { font-size: 38px; margin-bottom: 20px; line-height: 1.3; }
.hero-text p { color: var(--text-dim); font-size: 18px; max-width: 480px; }
.hero-actions { margin-top: 28px; display: flex; gap: 16px; flex-wrap: wrap; }
.hero-visual { flex: 1; min-width: 320px; }
.hero-visual .video-mock {
    background: linear-gradient(135deg, #1a3a6e, #1a6e6e);
    border-radius: 16px;
    height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    color: var(--text);
    font-size: 70px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d33426; }
.btn-success { background: var(--success); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-lg { padding: 16px 32px; font-size: 18px; }

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card {
    background: var(--panel);
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}
.auth-card h2 { margin-bottom: 24px; font-size: 26px; }
.auth-card .field { margin-bottom: 18px; }
.auth-card label { display: block; margin-bottom: 6px; color: var(--text-dim); font-size: 14px; }
.auth-card input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
}
.auth-card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.auth-card .btn { width: 100%; justify-content: center; margin-top: 8px; }
.auth-card .switch-link { text-align: center; margin-top: 18px; color: var(--text-dim); }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error { background: rgba(234,67,53,0.15); color: #f28b82; border: 1px solid rgba(234,67,53,0.4); }
.alert-success { background: rgba(52,168,83,0.15); color: #81c995; border: 1px solid rgba(52,168,83,0.4); }
.hidden { display: none !important; }

/* ===== Dashboard ===== */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar .spacer { flex: 1; }
.topbar .meet-logo { width: 28px; height: 28px; }
.topbar .app-name { font-weight: 500; font-size: 18px; }
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 20px;
    background: var(--surface);
    cursor: pointer;
}
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 14px; }

.dashboard-content { padding: 32px 24px; }
.dashboard-actions {
    display: flex;
    gap: 16px;
    padding: 24px;
    background: var(--panel);
    border-radius: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    align-items: center;
}
.dashboard-actions .join-input {
    flex: 1;
    min-width: 240px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
}
.dashboard-actions .join-input:focus { outline: 2px solid var(--accent); }
.divider { width: 1px; height: 40px; background: var(--border); }

.section-title { font-size: 20px; margin-bottom: 16px; font-weight: 500; }
.meeting-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.meeting-card {
    background: var(--panel);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}
.meeting-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.meeting-card .card-title { font-size: 17px; font-weight: 500; margin-bottom: 8px; }
.meeting-card .card-meta { color: var(--text-dim); font-size: 13px; margin-bottom: 6px; }
.meeting-card .card-code {
    display: inline-block;
    background: var(--surface);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--warning);
    margin: 6px 0;
}
.meeting-card .card-actions { margin-top: 14px; display: flex; gap: 10px; }
.meeting-card .card-actions .btn { padding: 8px 14px; font-size: 14px; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: var(--panel);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    padding: 28px;
    box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 20px; }
.modal .field { margin-bottom: 16px; }
.modal label { display: block; margin-bottom: 6px; color: var(--text-dim); font-size: 14px; }
.modal input, .modal textarea, .modal select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
}
.modal textarea { min-height: 80px; resize: vertical; }
.modal .modal-actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }

/* ===== Meeting Room ===== */
.meeting-room {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-darker);
}
.meeting-body { display: flex; flex: 1; overflow: hidden; }
.meeting-stage { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.video-grid {
    flex: 1;
    display: grid;
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    align-content: center;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.video-tile {
    position: relative;
    background: var(--surface);
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}
.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--bg-darker);
}
.video-tile .fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.video-tile .avatar-lg {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 34px;
    font-weight: 600;
}
.video-tile .tile-name {
    position: absolute;
    bottom: 10px;
    left: 12px;
    background: rgba(0,0,0,0.6);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
}
.video-tile .tile-status {
    position: absolute;
    top: 10px;
    right: 12px;
    display: flex;
    gap: 8px;
}
.video-tile .tile-status .badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.video-tile .badge.self-badge { border: 2px solid var(--accent); }

.meeting-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-darker);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.tool-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--surface);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    position: relative;
}
.tool-btn:hover { background: var(--border); }
.tool-btn.active { background: var(--accent); color: #fff; }
.tool-btn.on { background: var(--accent); color: #fff; }
.tool-btn.off { background: var(--danger); color: #fff; }
.tool-btn.leave { background: var(--danger); width: 60px; border-radius: 12px; }
.tool-btn.leave:hover { background: #d33426; }
.tool-btn .btn-label {
    position: absolute;
    bottom: -26px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-darker);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}
.tool-btn:hover .btn-label { opacity: 1; }
.toolbar-spacer { width: 12px; }

.video-tile.self-view.large-tile .fallback .avatar-lg { width: 120px; height: 120px; font-size: 44px; }

/* Side panel (chat + participants) */
.side-panel {
    width: 340px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.2s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.panel-tabs { display: flex; border-bottom: 1px solid var(--border); }
.panel-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}
.panel-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel-content { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel-content.hidden { display: none; }

.chat-msg { display: flex; gap: 10px; }
.chat-msg .avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.chat-msg .msg-body { background: var(--surface); border-radius: 10px; padding: 8px 12px; flex: 1; }
.chat-msg .msg-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.chat-msg .msg-name { font-weight: 500; font-size: 13px; }
.chat-msg .msg-time { color: var(--text-dim); font-size: 11px; }
.chat-msg .msg-text { font-size: 14px; word-wrap: break-word; }

.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.chat-input button { padding: 10px 14px; }

.participant-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; }
.participant-item:hover { background: var(--surface); }
.participant-item .avatar { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.participant-item .p-name { flex: 1; }
.participant-item .p-status { color: var(--text-dim); font-size: 12px; }
.participant-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

/* Whiteboard */
.whiteboard-wrap { flex: 1; display: none; position: relative; min-width: 0; }
.whiteboard-wrap.active { display: block; }
.whiteboard-toolbar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    gap: 6px;
    padding: 8px;
    z-index: 10;
    box-shadow: var(--shadow);
}
.wb-tool {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: none;
    background: none;
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wb-tool:hover { background: var(--surface); }
.wb-tool.active { background: var(--accent); color: #fff; }
.wb-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; margin: auto 2px; }
.wb-color.active { border-color: #fff; }
#whiteboard { background: var(--bg-darker); width: 100%; height: 100%; cursor: crosshair; display: block; }

/* Toast */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 2000;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.toast.show { opacity: 1; }

/* Meeting join screen */
.join-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-darker);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.join-screen .preview-card {
    background: var(--panel);
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
}
.preview-video {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.preview-video video { width: 100%; height: 100%; object-fit: cover; }
.preview-video .avatar-lg { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 30px; font-weight: 600; }
.preview-controls { display: flex; gap: 12px; justify-content: center; margin: 20px 0; }
.preview-actions { display: flex; gap: 12px; justify-content: center; }
.preview-actions .btn { padding: 12px 24px; }

#ringIndicator { transition: all 0.3s; }

.loading { text-align: center; color: var(--text-dim); padding: 40px; }
