/* RESET - Remove default browser spacing */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', monospace; /* The hacker font */
}

body,
.chat-container {
    height: 100dvh; /* Adapts to address bar showing/hiding */
    margin: 0;
    overflow: hidden; /* Prevents whole-page scrolling */
}

body {
    background-color: #050505; /* Deep Void Black */
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
}

/* NAVBAR */
.navbar {
    padding: 15px 30px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0a0a0a;
}

.logo {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.highlight {
    color: #00f3ff; /* Zyntriax Cyan */
}

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

.mini-btn {
    background: transparent;
    border: 1px solid #333;
    color: #666;
    padding: 5px 10px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: 0.3s;
}

.mini-btn:hover {
    border-color: #00f3ff;
    color: #00f3ff;
}

/* STATUS LIGHTS */
.status {
    font-size: 0.8rem;
    color: #666;
}
.online { color: #00ff41; text-shadow: 0 0 10px #00ff41; }
.offline { color: #ff0055; }

/* MAIN LAYOUT */
.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* VIDEO GRID */
.video-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    height: 60%; /* Takes up top 60% of screen */
}

.video-box {
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The actual video element */
video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.label {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    font-size: 0.7rem;
    border-left: 2px solid #00f3ff;
}

.video-controls {
    position: absolute;
    bottom: 10px;
    right: 10px; /* Bottom right corner of your video */
    display: flex;
    gap: 5px;
    z-index: 10;
}

.icon-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #333;
    color: #fff;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1rem;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #00f3ff;
    color: #000;
}

.icon-btn.off {
    background: #ff0055; /* Red when disabled */
    border-color: #ff0055;
    color: #fff;
}

/* Loading Animation for Stranger's box */
.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #00f3ff;
    animation: pulse 1.5s infinite;
}

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

/* CHAT AREA */
.chat-interface {
    flex: 1; /* Takes remaining space */
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.chat-logs {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    border-bottom: 1px solid #333;
}

.system-msg {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.timestamp {
    color: #555;
    font-size: 0.75rem;
    margin-right: 8px;
}

.user-msg { color: #fff; margin-bottom: 5px; }
.stranger-msg { color: #00f3ff; margin-bottom: 5px; }

.partner-info {
    padding: 8px 20px;
    border-bottom: 1px solid #333;
    background: #0d0d0d;
}

#typing-indicator {
    padding: 5px 20px;
    font-size: 0.8rem;
    color: #00f3ff;
    font-style: italic;
    background: #0d0d0d;
    animation: blink 1s infinite;
}

@keyframes blink { 50% { opacity: 0.5; } }

/* INPUTS */
.chat-input-area {
    padding: 15px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
    background: #0d0d0d;
    border-top: 1px solid #333;
}

input {
    flex: 1;
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 8px;
    outline: none;
}
input:focus { border-color: #00f3ff; }

button {
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 8px;
    background: #000;
    border: 1px solid #00f3ff;
    color: #00f3ff;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

button:hover {
    background: #00f3ff;
    color: #000;
    box-shadow: 0 0 15px #00f3ff;
}

#start-btn {
    background: #222;
    border-color: #fff;
    color: #fff;
}
#start-btn:hover {
    background: #fff;
    color: #000;
}

/* WELCOME SCREEN OVERLAY */
.welcome-overlay {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: #050505; /* Full solid black so you can't see the app behind it */
    z-index: 9999;       /* This puts it on the very top layer */
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    background: #0a0a0a;
    border: 1px solid #00f3ff;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
}

.login-box h2 { color: #fff; margin-bottom: 10px; }
.login-box p { color: #666; margin-bottom: 20px; font-size: 0.9rem; }

#username-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.1rem;
    border: 1px solid #333;
    background: #111;
    color: #fff;
}

#interests-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 0.9rem;
    border: 1px solid #333;
    background: #111;
    color: #fff;
    border-radius: 4px;
}

.mode-select {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.mode-btn {
    flex: 1;
    padding: 15px;
    font-size: 0.9rem;
}

/* TEXT MODE PLACEHOLDERS */
.no-cam-msg {
    position: absolute;
    color: #333;
    font-weight: bold;
    font-size: 1.5rem;
    letter-spacing: 5px;
}

.main-wrapper {
    display: flex;
    width: 100%;
    height: 100dvh;
}

.user-sidebar {
    width: 250px;
    border-right: 1px solid #ccc;
    background: #f0f0f0;
}

.chat-area {
    flex: 1; /* Takes remaining space */
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .user-sidebar {
        display: none; /* Hide sidebar on mobile */
    }
    
    .chat-area {
        width: 100%; /* Chat takes full screen */
    }

    .mini-btn {
        padding: 12px 16px;
        font-size: 0.85rem;
        min-height: 44px;
    }
}

.chat-logs div {
    animation: fadeIn 0.3s ease-in;
}

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

/* 1. DESKTOP DEFAULT: Side-by-Side */
.video-container {
    display: flex;
    flex-direction: row;    /* Aligns items left-to-right */
    justify-content: center;
    gap: 10px;              /* Space between videos */
    width: 100%;
}

.video-container video {
    width: 45%;             /* On desktop, they share the space */
    max-width: 600px;
    border-radius: 8px;
    background: #000;       /* Placeholder black background */
}

/* 2. MOBILE OVERRIDE: Stacked Vertically */
@media (max-width: 768px) {
    .video-container {
        flex-direction: column; /* Flips axis to Top-to-Bottom */
        align-items: center;    /* Centers them horizontally */
        height: auto;           /* Let it grow as needed */
    }

    .video-container video {
        width: 100%;        /* Make video take full phone width */
        height: auto;       /* Maintain aspect ratio */
        max-height: 40vh;   /* Prevent them from taking too much vertical space */
        margin-bottom: 10px;
    }
}

/* =========================================
   NEW CYBERPUNK LOGIN (The "Zyntriax" Look)
   ========================================= */

.auth-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95); /* Darker void background */
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px); /* Blurs the app behind it */
}

.auth-card {
    background: #050505;
    border: 1px solid #333;
    width: 400px;
    padding: 40px;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.1); /* Subtle Cyan Glow */
    border-left: 4px solid #00f3ff; /* The "Hacker" accent strip */
}

/* scanline decoration */
.auth-card::before {
    content: " // SECURE CONNECTION ESTABLISHED";
    position: absolute;
    top: -25px; left: 0;
    color: #00f3ff;
    font-size: 0.7rem;
    letter-spacing: 2px;
    opacity: 0.7;
}

.auth-card h2 {
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 1.5rem;
    margin-bottom: 30px;
    text-align: left; /* Terminal style usually aligns left */
    border-bottom: 1px solid #222;
    padding-bottom: 15px;
}

.input-group { margin-bottom: 20px; }

.auth-card input {
    width: 100%;
    padding: 15px;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #00f3ff; /* Typing in Cyan */
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: 0.3s;
}

.auth-card input:focus {
    border-color: #00f3ff;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
    outline: none;
}

.auth-card button {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    background: #00f3ff; /* Solid Cyan */
    color: #000;          /* Black Text */
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: none;
    cursor: pointer;
    transition: 0.3s;
    font-family: 'JetBrains Mono', monospace;
}

.auth-card button:hover {
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.6);
}

#auth-toggle-text {
    margin-top: 25px;
    color: #555;
    font-size: 0.8rem;
    text-align: center;
}

#toggle-auth {
    color: #00f3ff;
    text-decoration: none;
    cursor: pointer;
    font-weight: bold;
    border-bottom: 1px solid transparent;
}

#toggle-auth:hover {
    border-bottom: 1px solid #00f3ff;
}

.hidden { display: none !important; }

/* VIEW MANAGEMENT */
.view-container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    background: #050505;
}

/* SELECTION SCREEN */
.selection-box {
    text-align: center;
    z-index: 10;
}

.selection-box h1 {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: 3px;
}

.selection-box p { color: #666; margin-bottom: 30px; }

.card-container {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.mode-card {
    background: #0a0a0a;
    border: 1px solid #333;
    padding: 30px;
    width: 200px;
    cursor: pointer;
    transition: 0.3s;
    border-radius: 12px;
}

.mode-card:hover {
    border-color: #00f3ff;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
    transform: translateY(-5px);
}

.mode-card .icon { font-size: 3rem; margin-bottom: 15px; }
.mode-card h3 { color: #fff; font-size: 1.1rem; margin-bottom: 5px; }
.mode-card p { color: #666; font-size: 0.8rem; }

.chat-img {
    max-width: 200px;
    border-radius: 8px;
    margin-top: 5px;
    border: 1px solid #333;
    cursor: pointer;
    filter: blur(8px);
    transition: 0.3s;
}
.chat-img.revealed { filter: blur(0); }

#dice-btn:hover {
    background: #ffcc00;
    color: #000;
    box-shadow: 0 0 15px #ffcc00;
    border-color: #ffcc00;
}

/* =========================================
   SOCIAL OVERLAY FIXES
   FIX: Ensure overlays don't conflict with video grid
   ========================================= */

/* Social Overlay - Fixed positioning to cover entire screen */
#social-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000; /* Above video grid */
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

#social-overlay.hidden {
    display: none !important;
}

.social-panel {
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.2);
}

.social-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #333;
}

.social-header h3 {
    color: #00f3ff;
    margin: 0;
    letter-spacing: 2px;
}

.social-header button {
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-header button:hover {
    color: #ff0055;
}

.social-tabs {
    display: flex;
    border-bottom: 1px solid #333;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: transparent;
    color: #666;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: 0.3s;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(0, 243, 255, 0.05);
}

.tab-btn.active {
    color: #fff;
    border-bottom-color: #00f3ff;
}

.social-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    max-height: 400px;
}

/* =========================================
   PRIVATE CHAT WINDOW FIXES
   FIX: Ensure private chat doesn't overlap video grid
   ========================================= */

#private-chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 450px;
    background: #0a0a0a;
    border: 1px solid #333;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    z-index: 1001; /* Above social overlay */
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5);
}

#private-chat-window.hidden {
    display: none !important;
}

.pc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    background: #111;
    border-radius: 12px 12px 0 0;
}

.pc-header span {
    color: #00f3ff;
    font-weight: bold;
    letter-spacing: 1px;
}

.pc-header button {
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pc-header button:hover {
    color: #ff0055;
}

#pc-logs {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pc-input {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #333;
    background: #111;
    border-radius: 0 0 12px 12px;
}

.pc-input input {
    flex: 1;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.pc-input input:focus {
    border-color: #00f3ff;
    outline: none;
}

.pc-input button {
    background: #00f3ff;
    color: #000;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.pc-input button:hover {
    background: #fff;
    box-shadow: 0 0 10px #00f3ff;
}

/* Mobile Responsive for Private Chat */
@media (max-width: 768px) {
    #private-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 60vh;
        border-radius: 12px 12px 0 0;
    }
    
    .social-panel {
        width: 95%;
        max-height: 90vh;
    }
}

/* Friend Item Styling */
.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #111;
    margin-bottom: 8px;
    border: 1px solid #333;
    border-radius: 8px;
    transition: 0.3s;
}

.friend-item:hover {
    border-color: #00f3ff;
    background: #1a1a1a;
}

.friend-item b {
    color: #fff;
}

/* Online indicator pulse animation */
@keyframes onlinePulse {
    0%, 100% { box-shadow: 0 0 5px #00ff41; }
    50% { box-shadow: 0 0 15px #00ff41; }
}

.friend-item .online-indicator {
    animation: onlinePulse 2s infinite;
}
