/* --- GLOBAL VARIABLES & RESET --- */
:root {
    --bg: #0b141a;
    --gold: #f1c40f;
    --accent: #6366f1;
    --wa-dark: #0b141a;
    --wa-green: #005c4b;
    --wa-bubble-alt: #202c33;
    --wa-header: #202c33;
    --wa-input: #2a3942;
    --wa-send: #00a884;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
    overflow: hidden;
    /* Use dvh (Dynamic Viewport Height) for mobile browser support */
    height: 100vh;
    height: 100dvh; 
}

/* --- ANIMATED BACKGROUND --- */
.mesh-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(45deg, #0b141a, #1a1a2e, #0b141a);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

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

/* --- SCREEN ARCHITECTURE --- */
.screen {
    display: none;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.screen.active {
    display: flex;
}

/* --- CARDS --- */
.premium-card {
    background: rgba(18, 18, 24, 0.9);
    backdrop-filter: blur(15px);
    padding: 30px;
    border-radius: 28px;
    width: 90%;
    max-width: 340px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* --- INPUTS --- */
.input-group {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    z-index: 5;
}

.p-input {
    width: 100%;
    height: 52px;
    background-color: #000000 !important; 
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: #ffffff !important;
    padding-left: 45px;
    outline: none;
    font-size: 15px;
}

/* --- VIDEO UI --- */
.video-container { 
    position: absolute; 
    inset: 0; 
    z-index: 1; 
    background: #000; 
}

#remoteVideo { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

#localVideo { 
    position: absolute; 
    top: 20px; 
    left: 20px; 
    width: 100px; 
    height: 140px; 
    border: 2px solid white; 
    z-index: 100; 
    border-radius: 12px; 
    object-fit: cover; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.partner-top-info { 
    position: absolute; 
    top: 20px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 600; 
}

.glass-badge { 
    background: rgba(0, 0, 0, 0.6); 
    backdrop-filter: blur(12px); 
    padding: 8px 16px; 
    border-radius: 50px; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    border: 1px solid rgba(255, 255, 255, 0.2); 
    white-space: nowrap;
}

.mini-flag { width: 22px; height: 14px; object-fit: cover; }

.linear-control-bar { 
    position: absolute; 
    bottom: 30px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 500; 
    display: flex; 
    gap: 12px; 
    background: rgba(0,0,0,0.5); 
    padding: 10px 15px; 
    border-radius: 50px; 
    backdrop-filter: blur(10px); 
    border: 1px solid rgba(255,255,255,0.1);
}

.round-btn { 
    width: 48px; 
    height: 48px; 
    border-radius: 50%; 
    border: none; 
    background: rgba(255,255,255,0.15); 
    color: white; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.round-btn.off { background: #ef4444 !important; }

/* --- RESPONSIVE CHAT UI (DESKTOP) --- */
.wa-chat-container { 
    position: absolute; 
    right: -350px; 
    top: 0; 
    width: 320px; 
    height: 100%; 
    background: var(--wa-dark); 
    z-index: 1000; 
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    display: flex; 
    flex-direction: column; 
    border-left: 1px solid rgba(255,255,255,0.1);
}

.wa-chat-container.open { right: 0; }

/* --- MOBILE SPECIFIC OVERRIDES --- */
@media (max-width: 768px) {
    /* Make chat a bottom sheet on mobile */
    .wa-chat-container {
        right: 0;
        bottom: -100%;
        top: auto;
        width: 100%;
        height: 70%; /* Covers 70% of screen height */
        border-radius: 20px 20px 0 0;
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.1);
        transition: bottom 0.4s ease;
    }

    .wa-chat-container.open {
        bottom: 0;
    }

    #localVideo {
        width: 85px;
        height: 120px;
        top: 10px;
        left: 10px;
    }

    .linear-control-bar {
        bottom: 20px;
        padding: 8px 10px;
    }
    
    .round-btn {
        width: 44px;
        height: 44px;
    }
}

.wa-header { 
    background: var(--wa-header); 
    padding: 12px 15px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.wa-message-area { 
    flex: 1; 
    padding: 15px; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 8px;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-blend-mode: overlay; 
    background-size: 300px; 
    background-color: #0b141a;
}

.msg-wrapper { display: flex; flex-direction: column; max-width: 85%; }
.msg-wrapper.me { align-self: flex-end; }
.msg-wrapper.partner { align-self: flex-start; }

.bubble { 
    padding: 8px 12px; 
    border-radius: 12px; 
    font-size: 14px; 
    position: relative; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.3); 
}

.me .bubble { background: var(--wa-green); color: #fff; border-top-right-radius: 2px; }
.partner .bubble { background: var(--wa-bubble-alt); color: #fff; border-top-left-radius: 2px; }

.wa-input-area { 
    background: var(--wa-header); 
    padding: 10px; 
    display: flex; 
    gap: 8px; 
    align-items: center;
    /* Added padding for mobile home indicators */
    padding-bottom: env(safe-area-inset-bottom, 10px); 
}

#chatInput { 
    flex: 1; 
    background: var(--wa-input); 
    border: none; 
    border-radius: 20px; 
    color: white; 
    padding: 10px 15px; 
    outline: none; 
}

.send-btn { 
    background: var(--wa-send); 
    border: none; 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    color: white; 
    cursor: pointer; 
}

.close-chat { 
    background: none; 
    border: none; 
    color: #8696a0; 
    font-size: 20px; 
    cursor: pointer; 
}