/* --- LAYOUT UTILITIES --- */
.hidden { display: none !important; }

/* CONTAINER */
.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
    padding-top: calc(var(--nav-height) + 20px);
}

/* NAVBAR - Fixed */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--main-accent);
    padding: 0 20px;
    border-bottom: var(--border-width) solid black;
    z-index: 1000;
}

.brand {
    font-weight: 900;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: -1px;
    cursor: pointer;
    background: black;
    color: white;
    padding: 5px 10px;
    transform: rotate(-2deg);
    border: 2px solid white;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* APP GRID (Home Page) */
.app-grid {
    display: grid;
    grid-template-columns: 280px 1fr 280px; /* Fixed sidebars, fluid center */
    gap: 15px;
    width: 100%;
    max-width: 1600px;
    height: calc(100vh - var(--nav-height) - 40px); /* Full height minus nav and padding */
    
    /* CHANGE: Update margin to push grid below fixed navbar */
    margin: calc(var(--nav-height) + 20px) auto 0; 
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 1024px) {
    .app-grid {
        grid-template-columns: 250px 1fr;
    }
    .app-grid > aside:last-child {
        display: none; /* Hide Right Sidebar on Tablet */
    }
}

/* --- MOBILE LAYOUT (App-Like Feel) --- */
@media (max-width: 768px) {
    /* 1. Reset Container to Full Viewport */
    .main-container {
        padding: 0;
        padding-top: var(--nav-height); /* Keep space for top navbar */
        height: 100vh;
        width: 100vw;
        overflow: hidden; /* Prevent page scrolling, only internal scrolling */
    }

    /* 2. Grid becomes a "Stack" of full-screen views */
    .app-grid {
        display: block;
        width: 100%;
        height: 100%;
        margin: 0;
        position: relative;
    }

    /* 3. Make all panels full screen absolute layers */
    .app-grid > aside, 
    .app-grid > main {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        border: none; /* Remove border for cleaner mobile look */
        border-top: 3px solid black; /* Keep top separation */
        background: var(--bg-color);
    }

    /* 4. DEFAULT STATE: Show Room List (Left), Hide Chat (Main), Hide Activity (Right) */
    #left-sidebar {
        display: flex;
        z-index: 10;
    }
    #chat-main {
        display: none;
    }
    #right-sidebar {
        display: none; /* Hide 'Data Stream' on mobile to save space */
    }

    /* 5. ACTIVE CHAT STATE: Show Chat, Hide Room List */
    body.mobile-chat-open #left-sidebar {
        display: none;
    }
    body.mobile-chat-open #chat-main {
        display: flex;
        z-index: 20;
    }
    
    /* 6. Show Back Button only on Mobile */
    #mobile-back-btn {
        display: block !important;
    }

    /* 7. Navbar Adjustments */
    .navbar {
        padding: 0 10px;
        justify-content: space-between;
    }
    .brand svg {
        height: 40px; /* Smaller Logo */
        width: auto;
    }
    
    /* 8. Fix input zooming on iPhone */
    input, select, textarea {
        font-size: 16px !important; 
    }
}

/* AUTH FORMS */

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out; /* Optional: Adds a smooth transition */
}

/* Optional: Simple fade-in animation keyframes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.auth-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.input-group label {
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 5px;
}