/* Reset and Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Тёмно-синие фирменные цвета */
    --primary-color: #1e3a8a; /* насыщенный тёмно-синий */
    --secondary-color: #1e40af; /* глубокий синий */
    --success-color: #48bb78;
    --danger-color: #f56565;
    --dark-bg: #0f0f0f;
    --card-bg: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #2a2a2a;
    --gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Container */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo i {
    color: var(--primary-color);
    font-size: 2rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.user-info i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Hero Section */
.hero {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 3rem;
    gap: 4rem;
    max-width: 1400px;
    margin: 0 auto;
}

.hero-content {
    animation: fadeInLeft 1s ease-out;
}

.hero-title {
    font-size: clamp(3rem, 5vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

/* Buttons */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

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

.btn-block {
    width: 100%;
    justify-content: center;
}

/* CTA Buttons */
.cta-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

/* Features */
.features {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.feature i {
    color: var(--primary-color);
}

/* Hero Visual */
.hero-visual {
    position: relative;
    animation: fadeInRight 1s ease-out;
}

.floating-card {
    position: absolute;
    width: 180px;
    height: 120px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: float 6s ease-in-out infinite;
}

.card-1 {
    top: 0;
    left: 50%;
    animation-delay: 0s;
}

.card-2 {
    top: 150px;
    left: 0;
    animation-delay: 1s;
}

.card-3 {
    top: 150px;
    right: 0;
    animation-delay: 2s;
}

.card-4 {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 3s;
}

.avatar {
    width: 60px;
    height: 60px;
    background: var(--gradient);
    border-radius: 50%;
    position: relative;
}

.wave-animation {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: wave 2s ease-in-out infinite;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

.modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.modal.show .modal-content {
    transform: scale(1);
}

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

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-body label {
    font-weight: 600;
    margin-bottom: -0.5rem;
}

.modal-body input {
    padding: 0.875rem;
    background: var(--dark-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.room-code-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--dark-bg);
    padding: 1rem;
    border-radius: 12px;
    margin: 0.5rem 0;
}

.room-code-display span {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 2px;
}

.copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.room-link {
    color: var(--text-secondary);
    margin-top: 1rem;
}

.room-link code {
    display: block;
    background: var(--dark-bg);
    padding: 0.5rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    word-break: break-all;
}

.link-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--dark-bg);
    padding: 0.5rem;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.link-display code {
    flex: 1;
    background: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
    font-size: 0.875rem;
    word-break: break-all;
}

/* Room Page Styles */
.room-container {
    min-height: 100vh;
    background: var(--dark-bg);
}

/* Join Form */
.join-form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.join-form {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.5s ease-out;
}

.join-header {
    text-align: center;
    margin-bottom: 2rem;
}

.join-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
}

.join-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.join-header p {
    color: var(--text-secondary);
}

.join-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.join-body label {
    font-weight: 600;
}

.join-body input {
    padding: 1rem;
    background: var(--dark-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.join-body input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Device Preview */
.device-preview {
    position: relative;
    width: 100%;
    height: 200px;
    background: var(--dark-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

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

.preview-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
}

.preview-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-btn.active {
    background: var(--primary-color);
}

.preview-btn:hover {
    transform: scale(1.1);
}

/* Video Conference */
.video-conference {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--dark-bg);
}

/* Conference Header */
.conf-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conf-info {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.company-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.company-logo i {
    font-size: 1.5rem;
}

.room-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.room-info h3 {
    font-size: 1.25rem;
    margin: 0;
}

.participant-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.conf-actions {
    display: flex;
    gap: 1rem;
}

.action-btn {
    padding: 0.625rem 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.action-btn-danger {
    background: rgba(245, 101, 101, 0.2);
    color: var(--danger-color);
}

.action-btn-danger:hover {
    background: rgba(245, 101, 101, 0.3);
}

/* Video Grid */
.video-grid {
    flex: 1;
    display: grid;
    gap: 1rem;
    padding: 1rem;
    padding-bottom: 120px; /* Space for control panel */
    background: var(--dark-bg);
    position: relative;
}

/* Dynamic grid layouts */
.video-grid.grid-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    place-items: center;
}

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

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

.video-grid.grid-3 .video-container:nth-child(3) {
    grid-column: 1 / -1;
    max-width: 50%;
    justify-self: center;
}

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

/* Desktop-specific square video constraints */
@media (min-width: 769px) {
    .video-grid.grid-2 .video-container {
        aspect-ratio: 1;
        max-width: 650px;
        max-height: 650px;
        justify-self: center;
        align-self: center;
    }
    
    /* При двух участниках: один в центре (собеседник), другой в мини (self-mini) */
    .video-grid.grid-2 .video-container:not(.self-mini) {
        max-width: 800px;
        max-height: 800px;
        grid-column: 1 / -1; /* занимает всю ширину сетки */
        justify-self: center;
        align-self: center;
    }
    
    .video-grid.grid-3 .video-container {
        aspect-ratio: 1;
        max-width: 400px;
        max-height: 400px;
        justify-self: center;
        align-self: center;
    }
    
    .video-grid.grid-4 .video-container {
        aspect-ratio: 1;
        max-width: 350px;
        max-height: 350px;
        justify-self: center;
        align-self: center;
    }
    
    .video-grid.grid-1 .video-container {
        aspect-ratio: 1;
        max-width: 600px;
        max-height: 600px;
        justify-self: center;
        align-self: center;
    }
}

/* Focus Mode */
.video-grid.focus-mode {
    display: flex;
    position: relative;
}

.video-grid.focus-mode .video-container {
    position: absolute;
    width: 200px;
    height: 150px;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    cursor: pointer;
}

.video-grid.focus-mode .video-container.focused {
    position: static;
    width: 100%;
    height: 100%;
}

.video-grid.focus-mode .video-container:not(.focused):nth-child(2) {
    top: calc(1rem + 160px);
}

.video-grid.focus-mode .video-container:not(.focused):nth-child(3) {
    top: calc(1rem + 320px);
}

.video-grid.focus-mode .video-container:not(.focused):nth-child(4) {
    top: calc(1rem + 480px);
}

/* Desktop spotlight layout: один основной по центру, миниатюры снизу-справа */
@media (min-width: 769px) {
    .video-grid.spotlight-desktop {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        align-items: center;
        justify-items: center;
    }
    .video-grid.spotlight-desktop .video-container.main-stage {
        grid-row: 1 / 2;
        width: min(100%, 1100px);
        height: calc(100vh - 220px);
        border-width: 0;
        border-radius: 16px;
    }
    .video-grid.spotlight-desktop .video-container:not(.main-stage) {
        grid-row: 2 / 3;
        width: 200px;
        height: 120px;
        margin: 0.25rem;
        justify-self: end;
    }
    .video-grid.spotlight-desktop {
        grid-auto-flow: dense;
        grid-auto-rows: auto;
    }
}

.video-container {
    position: relative;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.video-container:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(30, 58, 138, 0.4);
}

/* Speaking highlight */
.video-container.speaking {
    border-color: rgba(99, 102, 241, 0.9);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.6),
                0 0 25px rgba(99, 102, 241, 0.35),
                0 0 50px rgba(99, 102, 241, 0.25);
}

.video-container.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 58, 138, 0.1);
    border: 2px dashed var(--border-color);
}

.video-container.empty::after {
    content: '\f007';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 3rem;
    color: var(--border-color);
    opacity: 0.5;
}

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

/* Quality indicator for each tile */
.quality-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 3px;
    z-index: 5;
    padding: 4px 6px;
    background: rgba(0,0,0,0.4);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
}

.quality-indicator .bar {
    width: 6px;
    height: 12px;
    border-radius: 2px;
    background: rgba(255,255,255,0.25);
}

.quality-indicator.q-good .bar:nth-child(-n+3) { background: #22c55e; }
.quality-indicator.q-medium .bar:nth-child(-n+2) { background: #f59e0b; }
.quality-indicator.q-bad .bar:nth-child(1) { background: #ef4444; }

/* Desktop stage layout when someone shares screen */
@media (min-width: 769px) {
    .video-grid.stage-desktop {
        display: grid;
        grid-template-columns: 1fr 320px;
        grid-template-rows: 1fr;
        gap: 0.75rem;
    }
    .video-grid.stage-desktop .video-container.main-stage {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        width: 100%;
        height: calc(100vh - 150px);
        border-width: 0;
        border-radius: 16px;
    }
    .video-grid.stage-desktop .video-container:not(.main-stage) {
        grid-column: 2 / 3;
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 10;
        max-height: 260px;
    }
    .video-grid.stage-desktop {
        align-items: start;
    }

    /* Desktop self mini view */
    #localVideoContainer.self-mini {
        position: fixed;
        width: 220px;
        height: 124px;
        bottom: 140px;
        right: 1rem;
        z-index: 120;
        border: 2px solid rgba(255,255,255,0.15);
        box-shadow: 0 8px 24px rgba(0,0,0,0.45);
        cursor: pointer;
    }
    #localVideoContainer.self-mini .video-label {
        bottom: 0.5rem;
        left: 0.5rem;
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
        border-radius: 6px;
    }
}

/* Mobile active-speaker layout */
@media (max-width: 768px) {
    .video-grid.mobile-active {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
    .video-grid.mobile-active .video-container.main-stage {
        width: 100%;
        height: calc(100vh - 220px);
        border-width: 0;
    }
    .video-grid.mobile-active.split-2 .video-container.main-stage.main-left,
    .video-grid.mobile-active.split-2 .video-container.main-stage.main-right {
        height: calc((100vh - 220px) / 2 - 4px);
    }
    .video-grid.mobile-active .video-container.self-view {
        position: fixed;
        bottom: 140px; /* above control panel */
        left: 0.75rem;
        width: 120px;
        height: 90px;
        z-index: 20;
        border: 2px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    }
    .video-grid.mobile-active .video-container.hidden-collapsed {
        display: none;
    }
}

/* Mirror only local self-view elements */
.video-container video.mirrored,
#localPreview.mirrored {
    transform: scaleX(-1);
}

/* Desktop video object-fit adjustments for square containers */
@media (min-width: 769px) {
    .video-container video {
        object-fit: cover;
        object-position: center;
    }
}

.video-label {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.8);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.video-label i {
    font-size: 0.875rem;
}

.video-label i.muted {
    color: var(--danger-color);
}

.video-controls {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-container:hover .video-controls {
    opacity: 1;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.control-btn:hover {
    transform: scale(1.1);
}

/* Control Panel */
.control-panel {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.control-panel.hidden {
    display: none;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.control-btn-large {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    position: relative;
    overflow: visible; /* allow unread badge to show fully */
}

/* Unread messages badge */
.unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: badgePopIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1;
}

@keyframes badgePopIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Remove all text from control buttons */
.control-btn-large .btn-text {
    display: none !important;
}

.control-btn-large::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0);
    transition: transform 0.3s ease;
    border-radius: 50%;
}

.control-btn-large:hover::before {
    transform: scale(1);
}

.control-btn-large:hover {
    transform: translateY(-2px);
}

.control-btn-large.active {
    background: var(--primary-color);
    color: white;
}

.control-btn-large.danger {
    background: rgba(245, 101, 101, 0.2);
    color: var(--danger-color);
}

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

/* Recording Button States */
.control-btn-large.recording {
    background: var(--danger-color);
    color: white;
    animation: recordingPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(245, 101, 101, 0.7);
}

.control-btn-large.recording::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(245, 101, 101, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    animation: recordingRipple 2s ease-in-out infinite;
    z-index: -1;
}

.control-btn-large.recording i {
    animation: recordingIcon 1s ease-in-out infinite alternate;
}

.control-btn-large.stopping {
    background: #f59e0b;
    color: white;
    animation: stoppingBlink 0.5s ease-in-out 3;
    transform: scale(1.1);
}

@keyframes recordingPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 101, 101, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(245, 101, 101, 0);
    }
}

@keyframes recordingRipple {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

@keyframes recordingIcon {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.2);
    }
}

@keyframes stoppingBlink {
    0%, 100% {
        opacity: 1;
        transform: scale(1.1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Recording Button Mobile Optimizations */
@media (max-width: 768px) {
    .control-btn-large.recording {
        animation: recordingPulseMobile 1.2s ease-in-out infinite;
    }
    
    .control-btn-large.recording::before {
        animation: recordingRippleMobile 1.8s ease-in-out infinite;
    }
    
    @keyframes recordingPulseMobile {
        0%, 100% {
            box-shadow: 0 0 0 0 rgba(245, 101, 101, 0.8);
        }
        50% {
            box-shadow: 0 0 0 8px rgba(245, 101, 101, 0);
        }
    }
    
    @keyframes recordingRippleMobile {
        0% {
            transform: translate(-50%, -50%) scale(1);
            opacity: 0.8;
        }
        100% {
            transform: translate(-50%, -50%) scale(1.8);
            opacity: 0;
        }
    }
}

/* Recording Indicator */
.recording-indicator {
    position: fixed;
    top: 6rem;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(245, 101, 101, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
    font-size: 0.95rem;
    z-index: 1000;
}

.recording-indicator.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.recording-indicator i {
    animation: recordingIndicatorPulse 1.5s ease-in-out infinite;
    font-size: 1.1rem;
}

.recording-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 1rem;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    transform: translateY(-50%);
    animation: recordingDot 2s ease-in-out infinite;
}

.recording-indicator span {
    margin-left: 0.5rem;
    position: relative;
    z-index: 1;
}

@keyframes recordingIndicatorPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@keyframes recordingDot {
    0%, 100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 0.3;
        transform: translateY(-50%) scale(0.8);
    }
}

/* Mobile Recording Indicator */
@media (max-width: 768px) {
    .recording-indicator {
        top: 4rem;
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
        gap: 0.75rem;
        left: 1rem;
        right: 1rem;
        transform: translateX(0) translateY(-100px);
        max-width: calc(100% - 2rem);
    }
    
    .recording-indicator.active {
        transform: translateX(0) translateY(0);
    }
    
    .recording-indicator::before {
        left: 0.75rem;
        width: 10px;
        height: 10px;
    }
    
    .recording-indicator span {
        margin-left: 0.25rem;
    }
}

/* Error Page */
.error-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-content {
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.error-content i {
    font-size: 5rem;
    color: var(--danger-color);
    margin-bottom: 1rem;
    display: block;
}

.error-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-content p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Animations */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

@keyframes wave {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

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

/* Chat Panel */
.chat-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    transition: right 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.chat-panel.active {
    right: 0;
}

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

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--dark-bg);
    border-radius: 8px;
}

.chat-message .sender {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

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

.chat-message .time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    padding: 0.75rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
}

.chat-send-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.file-upload-area {
    margin-top: 0.5rem;
}

.file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(30, 58, 138, 0.2);
    border: 1px dashed var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    color: var(--primary-color);
}

/* Screen Share Button */
.screen-share-btn {
    background: rgba(30, 58, 138, 0.2);
    color: var(--primary-color);
}

.screen-share-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Device Selection */
.control-btn-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.device-selector-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    margin-left: -8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.device-selector-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.device-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    min-width: 250px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.device-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.device-menu-header {
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.device-list {
    max-height: 200px;
    overflow-y: auto;
}

.device-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.device-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.device-item.active {
    background: rgba(30, 58, 138, 0.2);
    color: var(--primary-color);
}

.device-item i {
    width: 16px;
    opacity: 0;
}

.device-item.active i {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 1rem;
    }
    
    .hero-visual {
        display: none;
    }
    
    .cta-buttons {
        justify-content: center;
        flex-direction: column;
    }
    
    .features {
        justify-content: center;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .feature {
        justify-content: center;
        padding: 0.5rem;
        text-align: center;
    }
    
    .conf-header {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.5rem;
    }
    
    .conf-actions {
        width: 100%;
        justify-content: space-around;
        flex-wrap: wrap;
    }
    
    .action-btn {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .action-btn span {
        display: none;
    }
    
    /* Mobile video grid */
    .video-grid {
        padding: 0.5rem;
        gap: 0.5rem;
        padding-bottom: 140px; /* Space for control panel */
    }
    
    .video-grid.grid-1 {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
    
    .video-grid.grid-2 {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(2, 1fr);
    }
    
    .video-grid.grid-3 {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(3, 1fr);
    }
    
    .video-grid.grid-3 .video-container:nth-child(3) {
        grid-column: auto;
        max-width: 100%;
        justify-self: auto;
    }
    
    .video-grid.grid-4 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
    }
    
    .video-grid.focus-mode .video-container:not(.focused) {
        width: 100px;
        height: 75px;
    }
    
    .video-grid.focus-mode .video-container:not(.focused):nth-child(2) {
        top: calc(0.5rem + 85px);
    }
    
    .video-grid.focus-mode .video-container:not(.focused):nth-child(3) {
        top: calc(0.5rem + 170px);
    }
    
    .video-grid.focus-mode .video-container:not(.focused):nth-child(4) {
        top: calc(0.5rem + 255px);
    }
    
    /* Mobile chat panel */
    .chat-panel {
        width: 100%;
        right: -100%;
    }
    
    .chat-panel.active {
        right: 0;
    }
    
    /* Mobile control panel */
    .control-panel {
        bottom: 1rem;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: calc(100% - 2rem);
        max-width: 400px;
        padding: 1rem;
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Hide room title and participants count on mobile */
    .room-info h3 { display: none; }
    .participant-count { display: none; }

    /* Hide screen share, record and share buttons on mobile */
    #screenShareBtn,
    #recordBtn,
    #shareBtn { 
        display: none; 
    }
    
    .control-group {
        gap: 0.75rem;
    }
    
    .control-btn-large {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
        flex-shrink: 0;
        position: relative;
    }
    
    /* Enhanced mobile button feedback */
    .control-btn-large:active {
        transform: scale(0.95);
    }
    
    .control-btn-large.recording:active {
        transform: scale(0.95);
    }
    
    .control-btn-large.stopping:active {
        transform: scale(1.05);
    }
    
    /* Extra small screens */
    @media (max-width: 480px) {
        .control-panel {
            width: calc(100% - 1rem);
            padding: 0.75rem;
            gap: 0.75rem;
        }
        
        .control-group {
            gap: 0.5rem;
        }
        
        .control-btn-large {
            width: 44px;
            height: 44px;
            font-size: 1rem;
        }
    }
    
    .conf-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .company-logo {
        font-size: 0.9rem;
    }
    
    .room-info h3 {
        font-size: 1rem;
    }
    
    /* Mobile modals */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    .join-form {
        width: 95%;
        padding: 1.5rem;
    }
}

/* Controls Toggle floating button */
.controls-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(26, 26, 26, 0.85);
    color: var(--text-primary);
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.controls-toggle:hover {
    background: rgba(26, 26, 26, 0.95);
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .video-conference {
        height: -webkit-fill-available;
    }
    
    .video-grid {
        height: calc(100vh - 120px);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.toast {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    max-width: 400px;
    pointer-events: all;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-hide {
    transform: translateX(100%);
    opacity: 0;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.toast-content i {
    font-size: 1.25rem;
}

.toast-message {
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-success .toast-content i {
    color: var(--success-color);
}

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

.toast-error .toast-content i {
    color: var(--danger-color);
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-warning .toast-content i {
    color: #f59e0b;
}

.toast-info {
    border-left: 4px solid var(--primary-color);
}

.toast-info .toast-content i {
    color: var(--primary-color);
}

/* Advanced Modern Effects */
.hero {
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, rgba(30, 58, 138, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* Glassmorphism effects */
.navbar, .join-form, .modal-content {
    background: rgba(26, 26, 26, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Advanced button effects */
.btn, .control-btn-large {
    position: relative;
    overflow: hidden;
}

.btn::after, .control-btn-large::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::after, .control-btn-large:active::after {
    width: 300px;
    height: 300px;
}

/* Floating animation enhancement */
.floating-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Enhanced gradient text */
.gradient-text {
    background: linear-gradient(135deg, 
        var(--primary-color) 0%, 
        #667eea 25%, 
        #764ba2 50%, 
        #f093fb 75%, 
        var(--secondary-color) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Video container enhancements */
.video-container {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(26, 26, 26, 0.8) 100%);
    backdrop-filter: blur(10px);
}

.video-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.video-container:hover::before {
    transform: translateX(100%);
}

/* Enhanced control panel */
.control-panel {
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Particle effect for hero background */
.hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.3;
    animation: float-particle 6s ease-in-out infinite;
}

@keyframes float-particle {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .video-container {
        -webkit-tap-highlight-color: transparent;
    }
    
    .btn, .action-btn {
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
        min-width: 44px;
    }
    
    .control-btn {
        width: 44px;
        height: 44px;
    }
    
    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
}

@media (min-width: 769px) {
	.video-grid.stage-desktop .video-container {
		border-color: rgba(255,255,255,0.08);
		box-shadow: 0 8px 30px rgba(0,0,0,0.35);
	}
	.video-grid.stage-desktop .video-container:not(.main-stage) .video-label {
		bottom: 0.5rem;
		left: 0.5rem;
		padding: 0.35rem 0.6rem;
		font-size: 0.8rem;
		border-radius: 6px;
	}
	.video-grid.stage-desktop .video-container.main-stage .video-label {
		bottom: 1rem;
		left: 1rem;
	}
}
