:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(23, 32, 54, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --success-hover: #059669;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Edu NSW ACT Cursive', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    height: 100dvh;
    width: 100%;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* HTTPS Warning Banner */
#warningBanner {
    display: none;
    background: #7f1d1d;
    color: #fecaca;
    padding: 10px 16px;
    font-size: 0.85rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 30;
}

/* Main Video Area */
main {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1200px;
    background: #000;
    border-radius: 0;
    overflow: hidden;
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

#localVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}
/* Local PIP Video Container */
.local-video-wrapper {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 20%;
    max-width: 160px;
    aspect-ratio: 9 / 16;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    background: #1e293b;
    transition: transform 0.2s ease, border-color 0.2s ease;
    z-index: 10;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

@media (orientation: landscape) {
    .local-video-wrapper {
        aspect-ratio: 16 / 9;
    }
}

.local-video-wrapper:hover {
    transform: scale(1.04);
}

.local-video-wrapper:active {
    transform: scale(0.96);
}

.video-placeholder {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
    color: var(--text-muted);
    font-size: 0.95rem;
    padding: 20px;
    text-align: center;
}

/* Controls Footer Bar */
footer {
    flex-shrink: 0;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(11, 15, 25, 0.95);
    backdrop-filter: blur(16px);
    z-index: 50;
    padding: 0 20px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Left Corner Info inside Bottom Bar */
.footer-left-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.waiting {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
    animation: pulse 1.5s infinite;
}

.status-dot.danger {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

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

.quality-badge {
    display: none;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.quality-badge:hover {
    transform: scale(1.08);
}

.quality-badge:active {
    transform: scale(0.92);
}

.quality-badge.fhd {
    background: rgba(59, 130, 246, 0.9);
}

.quality-badge.hd {
    background: rgba(16, 185, 129, 0.9);
}

.quality-badge.sd {
    background: rgba(245, 158, 11, 0.9);
}

.quality-badge.audio {
    background: rgba(107, 114, 128, 0.9);
}

/* Action Buttons inside Bottom Bar */
.footer-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-control {
    width: 50px;
    height: 50px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    touch-action: manipulation;
}

.btn-control:active {
    transform: scale(0.92);
}

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

.btn-control.end-call {
    color: var(--danger);
    width: 50px;
    height: 50px;
}

.btn-control.end-call:active {
    background: var(--danger-hover);
}

.btn-control svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    pointer-events: none;
}

/* Overlay Modals */
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 15, 25, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#guestWaitingModal, #hostAdmissionModal {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.modal-box {
    display:flex;
    align-self:end;
    background: #172036;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 0px 15px;
    width: 250px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

#permissionErrorModal .modal-box {
    flex-direction: column;
    padding: 15px;
}

.modal-box h3 {
    font-size: 25px;
    margin:auto;
}

.modal-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-action {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-accept {
    background: var(--success);
    color: white;
}

.btn-decline {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-retry {
    background: var(--primary);
    color: white;
    width: 100%;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
    .local-video-wrapper {
        width: 25%;
        max-width: 100px;
        bottom: 0;
        left: 0;
    }
    footer {
        height: 65px;
        padding: 0 12px;
    }
    .footer-left-info {
        gap: 6px;
    }
    .status-badge {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    .quality-badge {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
    .footer-controls {
        gap: 10px;
    }
    .btn-control {
        width: 44px;
        height: 44px;
    }
    .btn-control.end-call {
        width: 48px;
        height: 48px;
    }
}
