/* --- CSS STYLES --- */
:root {
    --zoom-blue: #2D8CFF;
    --zoom-dark: #1a1a1a;
    --glass-border: rgba(255, 255, 255, 0.1);
    --safe-area-bottom: env(safe-area-inset-bottom);
    --neon-orange: #ff7b00; /* Added for Nav */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;
}

body {
    background-color: #000;
    color: #fff;
    height: 100vh;
    overflow: hidden;
    padding-bottom: 90px; /* Space for Stack Nav */
    user-select: none;
}

/* Main Interface */
.zoom-interface {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
    background: #000;
}

/* Top Bar */
.top-bar {
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    background-color: var(--zoom-dark);
    flex-shrink: 0;
}

.meeting-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
}

.view-btn {
    background: #242424;
    border: none;
    color: #fff;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Video Grid */
.video-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    padding: 8px;
    background-color: #000;
    min-height: 0;
}

.video-card {
    background-color: #222;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    overflow: hidden;
}

.video-card.active-speaker {
    border: 2px solid #72f302;
}

.avatar-placeholder {
    font-size: 1.5rem;
    font-weight: 500;
    color: #888;
}

.participant-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* Call Controls Bar (Zoom Bottom Bar) */
.call-controls-bar {
    height: 70px;
    background-color: var(--zoom-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    flex-shrink: 0;
    border-bottom: 1px solid #333; /* Separator from Nav */
}

.left-controls, .center-controls, .right-controls {
    display: flex;
    align-items: center;
}

.center-controls {
    gap: 15px;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #aaa;
    cursor: pointer;
    min-width: 50px;
    gap: 4px;
    background: none;
    border: none;
}

.control-btn:hover {
    background-color: #333;
    border-radius: 8px;
}

.control-btn span {
    font-size: 10px;
    margin-top: 2px;
}

.share-btn span {
    color: #0E7238;
    font-weight: 600;
}

.end-btn {
    background-color: #E02828;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

/* --- RESTRUCTURED 4-ZONE NAVIGATION --- */
.bottom-nav {
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    height: 90px;
    background: rgba(0,0,0,0.98); 
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--glass-border);
    display: grid; 
    /* GRID LAYOUT: [HOME] [CONTROLS] [CREATE] [CRM] */
    grid-template-columns: 1fr 200px 1fr 1fr;
    align-items: center; 
    justify-items: center;
    z-index: 9999; 
    padding-bottom: var(--safe-area-bottom);
}

.nav-group {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* --- CENTER CONTROL CLUSTER --- */
.nav-control-cluster {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    position: relative;
}

.center-btn-wrapper {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-page-icon {
    position: absolute;
    bottom: 70px; /* Positioned above the button */
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    color: var(--zoom-blue);
    text-shadow: 0 0 10px var(--zoom-blue);
    pointer-events: none;
    z-index: 10002;
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-5px); }
}

.center-master-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--zoom-blue);
    border: 3px solid #fff;
    color: #fff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(45, 140, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10001;
}

.center-master-btn i { font-size: 24px; }

.center-master-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(45, 140, 255, 0.6);
}

/* NAV TRIGGERS */
.nav-trigger {
    background: none; 
    border: none; 
    color: #666; 
    font-size: 22px;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 6px;
    transition: 0.3s; 
    cursor: pointer; 
    width: 100%; 
    height: 100%;
    justify-content: center;
}

.nav-label { 
    font-size: 10px; 
    font-weight: 800; 
    font-family: 'Chakra Petch', sans-serif; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

.nav-trigger:hover, 
.nav-group.active .nav-trigger { 
    color: var(--neon-orange); 
    text-shadow: 0 0 15px rgba(255, 123, 0, 0.4); 
}

/* ARROWS */
.nav-arrow {
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    transition: 0.3s;
    width: 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow:hover {
    color: var(--neon-orange);
    text-shadow: 0 0 10px rgba(255, 123, 0, 0.5);
    transform: scale(1.1);
}

/* STACK MENUS */
.nav-stack {
    position: absolute;
    bottom: 90px; 
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: max-content; /* SHRINK-WRAP TO CONTENT */
    min-width: 100px;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid var(--glass-border);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.8);
    overflow: hidden;
    z-index: 9990;
}

.nav-group.active .nav-stack {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
    border-color: var(--neon-orange);
}

.nav-stack a {
    text-decoration: none;
    color: #ccc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    padding: 12px 15px; /* Added horizontal padding */
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    white-space: nowrap;
}

.nav-stack a:last-child { border-bottom: none; }
.nav-stack a:hover {
    background: rgba(255, 123, 0, 0.1);
    color: #fff;
    padding-left: 15px; 
}

.nav-stack a.active-link {
    color: var(--neon-orange);
    font-weight: 800;
}

/* Login Overlay */
.hidden { display: none !important; }

.login-overlay {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); 
    z-index: 8000; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 20px;
    backdrop-filter: blur(5px);
}

.login-box {
    background: #fff; 
    color: #333; 
    padding: 30px; 
    border-radius: 12px;
    width: 100%; 
    max-width: 350px; 
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.login-box h2 { margin-bottom: 5px; color: var(--zoom-blue); }
.login-input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 4px; }
.login-submit-btn { width: 100%; padding: 10px; background: var(--zoom-blue); color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; }

@media (max-width: 600px) {
    .call-controls-bar { padding: 0 5px; gap: 5px; }
    .control-btn { min-width: 40px; }
    .control-btn span { font-size: 9px; }
}

/* --- MOBILE OPTIMIZATIONS --- */
@media (max-width: 768px) {
    /* --- MOBILE NAV ADJUSTMENTS --- */
    .bottom-nav { 
        /* Tighter grid on mobile: [Home] [Controls] [Create] [CRM] */
        grid-template-columns: 1fr 140px 1fr 1fr; 
    }

    .nav-arrow { 
        width: 30px; 
        font-size: 18px; 
        display: flex; 
    }
    
    .center-master-btn {
        width: 48px;
        height: 48px;
    }
    
    .center-master-btn i {
        font-size: 20px;
    }

    .nav-stack {
        padding: 5px 0;
        z-index: 10000;
        width: max-content; /* SHRINK-WRAP ON MOBILE */
        min-width: 80px;
        bottom: 95px; 
    }
    
    .nav-stack a {
        font-size: 13px;
        padding: 10px 12px; /* Tightened touch targets */
        letter-spacing: 0.5px;
        white-space: nowrap; /* Prevent wrapping */
        line-height: 1.3; 
        text-align: center !important;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    
    /* MOBILE STACK POSITIONING */
    #stack-home {
        left: 5px; /* Standardized offset */
        right: auto;
        transform: translateY(20px);
        border-radius: 12px 12px 12px 0;
    }
    .nav-group.active #stack-home { transform: translateY(0); }

    #stack-creation {
        left: auto;
        right: 5px; /* Standardized offset */
        transform: translateY(20px);
        border-radius: 12px 12px 0 12px;
    }
    .nav-group.active #stack-creation { transform: translateY(0); }

    #stack-crm {
        left: auto; 
        right: 0px; 
        transform: translateY(20px);
        border-radius: 12px 12px 0 12px;
    }
    .nav-group.active #stack-crm { transform: translateY(0); }
}