/* ODE Meet - Video Conferencing UI */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f0f23;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --accent-warning: #f59e0b;
    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.5);
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #9ca3af;
        --text-secondary: #f3f4f6;
        --text-muted: #e5e7eb;
        --focus-ring: 0 0 0 3px #ffffff, 0 0 0 5px #000000;
    }

    .control-btn,
    .btn,
    .reaction,
    .layout-option,
    .menu-item {
        border: 2px solid var(--border-color);
    }

    .control-btn.active,
    .control-btn.muted {
        border-color: #ffffff;
    }

    .video-tile.speaking {
        box-shadow: 0 0 0 4px #ffffff, 0 0 0 6px #10b981;
    }

    kbd {
        border: 2px solid var(--border-color);
    }
}

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

/* Screen reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible styles for keyboard navigation */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

#app {
    width: 100vw;
    height: 100vh;
}

.page {
    display: none;
    width: 100%;
    height: 100%;
}

.page.active {
    display: flex;
    flex-direction: column;
}

/* ============================================
   Landing Page
   ============================================ */

#landing {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.landing-header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 3rem;
}

.logo-text {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.meeting-actions {
    display: flex;
    align-items: stretch;
    gap: 2rem;
    max-width: 900px;
}

.action-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
}

.action-card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.action-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-card input {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.action-card input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

.action-card input:focus-visible {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

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

/* Form field wrapper */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.field-error {
    font-size: 0.75rem;
    color: var(--accent-danger);
    min-height: 1em;
}

.field-error:not(:empty) {
    margin-top: 0.25rem;
}

/* Input validation states */
.action-card input:invalid:not(:placeholder-shown) {
    border-color: var(--accent-danger);
}

.action-card input:valid:not(:placeholder-shown) {
    border-color: var(--accent-success);
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.divider {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:focus-visible {
    box-shadow: var(--focus-ring), 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading state for buttons */
.btn .btn-loading {
    display: none;
}

.btn.loading .btn-text {
    display: none;
}

.btn.loading .btn-loading {
    display: inline;
}

.btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

/* Link-style button */
.btn-link {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.875rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.btn-link:hover {
    color: var(--text-primary);
}

.btn-link:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.hidden {
    display: none !important;
}

.landing-footer {
    position: absolute;
    bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* Meeting title in header — editable */
.meeting-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}
.meeting-title:hover {
    background: rgba(255, 255, 255, 0.1);
}
.meeting-title[contenteditable="true"] {
    background: var(--bg-secondary);
    outline: 2px solid var(--accent-primary);
    cursor: text;
}

/* ============================================
   Meeting Room
   ============================================ */

#meeting-room {
    background: var(--bg-tertiary);
}

.meeting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.meeting-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#meeting-title-display {
    font-weight: 600;
}

.meeting-id {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.meeting-timer {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding-right: 1rem;
    border-right: 1px solid var(--border-color);
    margin-right: 1rem;
}

.meeting-status {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-secondary);
}

#recording-indicator {
    color: var(--accent-danger);
    animation: pulse 2s infinite;
}

#anticipate-indicator {
    color: var(--accent-warning, #f59e0b);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    animation: anticipate-glow 3s ease-in-out infinite;
}

@keyframes anticipate-glow {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(245, 158, 11, 0.3); }
    50% { opacity: 0.85; box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }
}

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

.meeting-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Video Grid Layouts */
.video-grid {
    flex: 1;
    display: grid;
    gap: 0.5rem;
    padding: 0.5rem;
    overflow: hidden;
}

.layout-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-auto-rows: minmax(200px, 1fr);
}

.layout-speaker {
    grid-template-columns: 1fr 200px;
    grid-template-rows: 1fr;
}

.layout-speaker .video-tile:first-child {
    grid-row: 1 / -1;
}

.layout-spotlight {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 100px;
}

.layout-spotlight .video-tile:first-child {
    grid-row: 1;
}

.layout-spotlight .video-thumbnails {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

/* Video Tile */
.video-tile {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-height: 150px;
}

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

.video-tile .participant-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-tile .participant-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.video-tile .participant-status {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.video-tile.speaking {
    box-shadow: 0 0 0 3px var(--accent-success);
}

.video-tile.screen-share {
    grid-column: span 2;
    grid-row: span 2;
}

.video-tile .no-video {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.video-tile .avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
}

/* Participants List */
.participant-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

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

.participant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.participant-details {
    flex: 1;
}

.participant-details .name {
    font-weight: 500;
}

.participant-details .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Chat */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

.chat-message .sender {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

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

.chat-message .content {
    color: var(--text-secondary);
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.chat-input input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.chat-input button {
    padding: 0.625rem 1rem;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
}

/* Controls */
.meeting-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 90; /* ponytail: below panels (140+) so expanded panels aren't obscured */
}

.controls-left,
.controls-center,
.controls-right {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:hover {
    background: var(--border-color);
}

.control-btn:focus-visible {
    box-shadow: var(--focus-ring);
}

.control-btn .icon {
    font-size: 1.25rem;
}

.control-btn .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.control-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.control-btn.muted {
    background: var(--accent-danger);
    border-color: var(--accent-danger);
}

.control-btn-danger {
    background: var(--accent-danger);
    border-color: var(--accent-danger);
}

.control-btn-danger:hover {
    background: #dc2626;
}

/* Popups */
.popup {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    z-index: 1000;
}

#reaction-picker {
    display: flex;
    gap: 0.25rem;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
}

.reaction {
    padding: 0.5rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: transform 0.1s;
}

.reaction:hover {
    transform: scale(1.2);
    background: var(--bg-tertiary);
}

#layout-picker,
#more-menu {
    bottom: 80px;
    right: 20px;
    min-width: 200px;
}

.layout-option,
.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    border-radius: var(--radius-sm);
}

.layout-option:hover,
.menu-item:hover {
    background: var(--bg-tertiary);
}

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

/* Floating Reactions */
.floating-reactions {
    position: fixed;
    bottom: 100px;
    left: 0;
    right: 0;
    pointer-events: none;
    overflow: hidden;
    height: 300px;
}

.floating-reaction {
    position: absolute;
    font-size: 2rem;
    animation: float-up 3s ease-out forwards;
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) scale(1.5);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: toast-in 0.3s ease;
}

.toast.toast-exit {
    animation: toast-out 0.3s ease forwards;
}

.toast-success {
    border-left: 3px solid var(--accent-success);
}

.toast-error {
    border-left: 3px solid var(--accent-danger);
}

.toast-warning {
    border-left: 3px solid var(--accent-warning);
}

.toast-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.toast-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Modal / Dialog */
.modal {
    background: transparent;
    border: none;
    padding: 0;
    max-width: 480px;
    width: 90%;
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
    font-size: 1.125rem;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    line-height: 1;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-close:focus-visible {
    box-shadow: var(--focus-ring);
}

.modal-body {
    padding: 1.5rem;
}

/* Keyboard Shortcuts List */
.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.shortcut-item dt {
    flex-shrink: 0;
}

.shortcut-item dd {
    color: var(--text-secondary);
}

kbd {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
    min-width: 2rem;
    text-align: center;
}

/* Connection Status Indicator */
.connection-status {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.connection-status.connecting .connection-icon::before {
    content: "...";
    animation: connecting-dots 1.5s infinite;
}

.connection-status.reconnecting {
    border-color: var(--accent-warning);
}

.connection-status.disconnected {
    border-color: var(--accent-danger);
}

@keyframes connecting-dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Badge for unread counts */
.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.control-btn {
    position: relative;
}

/* Sidebar header with h2 */
.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-primary);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 9999;
    text-decoration: none;
    border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
    top: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .meeting-actions {
        flex-direction: column;
        padding: 0 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .action-card {
        min-width: 0;
        width: 100%;
    }

    .divider {
        padding: 1rem 0;
        justify-content: center;
    }

    #landing {
        padding: 16px;
        justify-content: flex-start;
        padding-top: 60px;
        overflow-y: auto;
    }

    .landing-header {
        margin-bottom: 1.5rem;
    }

    .landing-footer {
        position: relative;
        bottom: auto;
        margin-top: 2rem;
        padding-bottom: 1rem;
    }

    .sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
    }

    .control-btn .label {
        display: none;
    }

    .control-btn {
        padding: 0.75rem;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

/* Print styles */
@media print {
    .meeting-controls,
    .sidebar,
    .popup,
    .toast-container,
    .connection-status {
        display: none !important;
    }
}

/* Participants list styling */
.participants-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Video tile focus styles for keyboard navigation */
.video-tile:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

.video-tile:focus-visible {
    box-shadow: var(--focus-ring);
}

/* Hand raise indicator */
.control-btn.active .icon {
    animation: hand-wave 0.5s ease-in-out;
}

@keyframes hand-wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Ensure visible focus for all interactive elements */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Color-blind friendly active speaker indicator */
.video-tile.speaking::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: var(--accent-success);
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-speaking 1.5s ease-in-out infinite;
}

@keyframes pulse-speaking {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Hand raised indicator on video tile */
.video-tile.hand-raised::before {
    content: '✋';
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 1.5rem;
    z-index: 10;
    animation: hand-pulse 2s ease-in-out infinite;
}

@keyframes hand-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Fix: Move connection status to top-right corner and auto-fade */
.connection-status {
    position: fixed;
    top: 1rem !important;
    right: 1rem !important;
    left: auto !important;
    transform: none !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}
.connection-status.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Fix: Chat messages should wrap and scroll */
.chat-message {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}
.chat-messages {
    overflow-y: auto !important;
    max-height: calc(100vh - 200px);
}

/* Connection status sits in the header's status group (see index.html), so it takes its
   own space in the row and can never cover the timer or the participant count. Only
   in-progress states (connecting / reconnecting) are shown. */
.connection-status {
    position: static !important;
    transform: none !important;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem !important;
    font-size: 0.75rem !important;
    white-space: nowrap;
    opacity: 1;
    box-shadow: none;
    background: rgba(22, 33, 62, 0.95) !important;
    border-radius: 6px;
}
.connection-status.connected,
.connection-status.disconnected,
.connection-status.hidden {
    display: none !important;
}

/* Live captions: centred over the meeting area just above the toolbar. Never takes clicks. */
#live-captions {
    position: fixed;
    left: 50%;
    bottom: 6.5rem;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(80vw, 56rem);
    padding: 0.6rem 1.25rem;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1.4;
    text-align: center;
    border-radius: 8px;
    z-index: 130; /* above the stage and toolbar (90), below panels (140+) */
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s 0.2s;
}
#live-captions.visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.15s ease;
}
#live-captions.is-status {
    font-size: 0.95rem;
    color: #cbd5e1;
}
/* Translated subtitles already include the original line - don't show it twice */
body:has(.translation-subtitles.active) #live-captions {
    display: none;
}
/* ASL mode puts its signing panel at the bottom; captions move to the top of the stage */
body.asl-mode-active #live-captions {
    top: 8.5rem;
    bottom: auto;
}
/* Sidebar open (320px, right edge): centre the bottom overlays over what is left of the
   meeting area so they don't sit on the chat box */
@media (min-width: 769px) {
    body:has(#sidebar:not(.hidden)) :is(#live-captions, .asl-gesture-area, .asl-subtitles, .translation-subtitles) {
        left: calc((100vw - 320px) / 2);
    }
    body:has(#sidebar:not(.hidden)) #live-captions {
        max-width: min(calc(100vw - 320px - 3rem), 56rem);
    }
    body:has(#sidebar:not(.hidden)) .asl-gesture-area {
        width: min(calc(100vw - 320px - 3rem), 800px);
    }
    body:has(#sidebar:not(.hidden)) .asl-subtitles {
        width: min(calc(100vw - 320px - 3rem), 900px);
    }
    body:has(#sidebar:not(.hidden)) .translation-subtitles {
        width: min(calc(100vw - 320px - 3rem), 1000px);
    }
}
@media (max-width: 768px) {
    #live-captions {
        font-size: 1rem;
        max-width: 92vw;
    }
}

/* Toolbar: has to fit the viewport however many buttons the feature modules add (ASL,
   Translate, ...). The centre group shrinks and, as a last resort, wraps onto a second
   row, so buttons are never pushed off-screen or laid on top of one another. */
.meeting-controls {
    gap: 0.5rem;
}
.meeting-controls .controls-left,
.meeting-controls .controls-right {
    flex: 0 0 auto;
}
.meeting-controls .controls-center {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: center;
}
@media (max-width: 1760px) {
    .meeting-controls {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .meeting-controls .controls-left,
    .meeting-controls .controls-center,
    .meeting-controls .controls-right {
        gap: 0.35rem;
    }
    .meeting-controls .control-btn {
        padding: 0.5rem;
        min-width: 3.25rem;
    }
}
@media (max-width: 1360px) {
    .meeting-controls .control-btn {
        padding: 0.45rem 0.3rem;
        min-width: 2.75rem;
    }
    .meeting-controls .control-btn .label {
        font-size: 0.65rem;
    }
}

/* ponytail: Staged response typing indicator */
.agent-typing .typing-dots {
    display: inline-flex;
    gap: 2px;
}
.agent-typing .typing-dots span {
    animation: typingDot 1.4s infinite;
    opacity: 0.3;
}
.agent-typing .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.agent-typing .typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}
.agent-response.streaming .streaming {
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
/* Mobile sidebar fixes - added 2026-12-04 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 320px;
    }
    
    .sidebar.hidden {
        display: none;
    }
    
    /* Ensure sidebar close button is not covered by VoiceQ */
    .sidebar-header .btn-close {
        position: relative;
        z-index: 110;
    }
    
    /* Move VoiceQ panel to avoid covering sidebar */
    #voiceq-panel {
        top: auto;
        bottom: 80px;
        right: 16px;
    }
    
    /* Control bar improvements for mobile */
    .meeting-controls {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.25rem;
        padding: 0.5rem;
    }
    
    .control-btn {
        min-width: 44px;
        min-height: 44px;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .sidebar {
        max-width: 100%;
        width: 100%;
        left: 0;
        right: 0;
    }
    
    /* Stack controls in a scrollable row */
    .meeting-controls {
        justify-content: flex-start;
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
}
