:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --primary: #FFD700; /* Yellow */
    --primary-variant: #DAB500;
    --secondary: #03dac6;
    --danger: #cf6679;
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --border-color: #333333;
    --chat-me: #FFD700;
    --chat-them: #2c2c2c;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    /* Use dynamic viewport height to prevent keyboard hiding input on mobile */
    height: 100vh; 
    height: 100dvh; 
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.5rem;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    z-index: 10;
}

.animated-header {
    background: linear-gradient(90deg, #1e1e1e, #2a2a2a, #1e1e1e);
    background-size: 200% 100%;
    animation: gradientMove 10s ease infinite;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
}

.logo-icon-wrapper {
    background: var(--primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    animation: pulseIcon 2s infinite alternate;
}

@keyframes pulseIcon {
    0% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 215, 0, 0.4); }
    100% { transform: scale(1.05); box-shadow: 0 0 15px rgba(255, 215, 0, 0.7); }
}

.logo-icon {
    color: #000;
    font-size: 1.6rem;
}

.logo-text {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin: 0;
}

.stats-container {
    display: flex;
    gap: 25px; /* Slightly more gap for clarity since background is gone */
    align-items: center;
    margin-left: auto; /* Push it to the right */
    margin-right: 25px; /* Give space before controls */
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-item i {
    color: var(--secondary);
    font-size: 1.2rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

.stat-item.online .stat-value {
    color: var(--primary);
}

/* Pulsing dot for online status */
.pulse-dot {
    width: 10px;
    height: 10px;
    background-color: var(--primary);
    border-radius: 50%;
    position: relative;
}

.pulse-dot::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    animation: pulse 1.5s linear infinite;
    opacity: 0;
}

@keyframes pulse {
    0% {
        transform: scale(0.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

#google_translate_element select {
    background-color: var(--bg-dark);
    color: white;
    border: none;
    padding: 2px;
    border-radius: 4px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}

/* Hide Google Translate "Powered by" and borders */
.goog-te-gadget .goog-te-combo {
    margin: 0 !important;
}
.goog-te-gadget {
    font-size: 0px !important; 
    color: transparent !important;
}
.goog-logo-link, .goog-logo-link:link, .goog-logo-link:visited, .goog-logo-link:hover, .goog-logo-link:active {
    display: none !important;
}
.goog-te-banner-frame.skiptranslate {
    display: none !important;
}
body {
    top: 0px !important; 
}

.controls {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    font-family: 'Poppins', sans-serif;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.primary { background-color: var(--primary); color: #000; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }

.btn.danger { background-color: var(--danger); color: #000; }
.btn.danger:hover:not(:disabled) { filter: brightness(1.2); }

.btn.secondary { background-color: #333; color: white; }
.btn.secondary:hover:not(:disabled) { background-color: #444; }

/* Main Content Area */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Ad Sidebar (Made slightly smaller) */
.ad-sidebar {
    width: 120px; /* Reduced from 160px */
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
}
.ad-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

/* Video Section */
.video-container {
    flex: 2;
    position: relative;
    background-color: #000;
    overflow: hidden; /* Crucial: Prevents video from stretching container */
}

.video-wrapper {
    position: relative;
}

.remote-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

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

.local-wrapper {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 160px; /* Reduced from 180px for better fit */
    aspect-ratio: 4/3;
    border: 3px solid var(--border-color);
    border-radius: 0 8px 8px 0; /* Only right corners rounded */
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    background-color: #222;
    z-index: 50;
    cursor: grab;
    transition: transform 0.3s ease, width 0.3s ease, border-color 0.3s;
}

.local-wrapper:active {
    cursor: grabbing;
    transition: none; /* remove transition during drag for smoothness */
}

.local-wrapper:hover {
    width: 280px; /* Reduced hover scale slightly */
    border-color: var(--primary);
    transform: scale(1.02);
}

#localVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror self */
}

.video-status {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.6);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    pointer-events: none;
    color: white;
}

.remote-wrapper > .video-status {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    background: none;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    bottom: auto;
}

.partner-info {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 600;
    z-index: 5;
    border: 1px solid var(--border-color);
}

.floating-social {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.floating-social a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    transition: transform 0.2s, filter 0.2s;
}

.floating-social a:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.floating-social a i {
    font-size: 1.2rem;
}

/* My icons (Red Theme) */
.local-social a {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); /* Instagram red/orange base */
}
.local-social a[title="WhatsApp"] {
    background: #ff4757; /* Custom red for whatsapp for "my" theme to match request */
}

/* Partner icons (Blue Theme) */
.remote-social a {
    background: linear-gradient(45deg, #1e3c72 0%, #2a5298 100%); /* Blue gradient */
}
.remote-social a[title="WhatsApp"] {
    background: #0088cc; /* Blue for whatsapp */
}

/* Overwrite general a hover colors from earlier if they interfere */
.remote-social a:hover, .local-social a:hover {
    color: white;
}

/* Chat Section */
.chat-container {
    width: 320px; /* Fixed width */
    min-width: 320px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    flex-shrink: 0; /* Prevent shrinking */
}

.chat-header {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.chat-header h2 {
    font-size: 1.2rem;
}

.chat-messages {
    flex: 1; /* Take remaining space */
    position: relative; /* Setup absolute inner wrapper */
}

.chat-messages-inner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.8rem;
    overflow-y: auto; /* Scroll internally */
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Ensure it behaves well and allows smooth scrolling */
    -webkit-overflow-scrolling: touch;
}

.chat-messages-inner::after {
    content: '';
    display: block;
    min-height: 280px; /* ~12 lines of fixed space to prevent shrinking when empty */
    flex-shrink: 0;
}
.chat-messages-inner::-webkit-scrollbar {
    width: 6px;
}
.chat-messages-inner::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages-inner::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 10px;
}
.chat-messages-inner::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.message {
    max-width: 85%;
    padding: 0.5rem 0.8rem;
    border-radius: 14px;
    word-wrap: break-word;
    font-size: 0.9rem;
    line-height: 1.4;
}

.message.me {
    align-self: flex-end;
    background-color: var(--chat-me);
    color: #000;
    border-bottom-right-radius: 4px;
}

.message.them {
    align-self: flex-start;
    background-color: var(--chat-them);
    border-bottom-left-radius: 4px;
}

.system-message {
    align-self: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 8px 0;
    text-align: center;
}

.chat-input-area {
    padding: 0.6rem;
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-panel);
}

#messageInput {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-dark);
    color: white;
    outline: none;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
}

#messageInput:focus {
    border-color: var(--primary);
}

#sendBtn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-panel);
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--text-muted);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover {
    color: white;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.form-group {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group input, .form-group select {
    padding: 0.8rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-dark);
    color: white;
    font-size: 1rem;
    outline: none;
    font-family: 'Poppins', sans-serif;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
}
.form-group input[readonly], .form-group select[disabled] {
    background-color: #222;
    color: #888;
    cursor: not-allowed;
}

/* Responsive for Mobile */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        padding: 0.5rem;
        gap: 8px;
    }
    .logo h1 {
        font-size: 1.2rem;
    }
    .stats-container {
        width: 100%;
        order: 3;
        justify-content: space-between;
        padding: 8px 12px;
        margin-top: 8px;
    }
    .main-content {
        flex-direction: column;
    }
    
    /* Hide side ad on mobile, too little space. Keep bottom ad. */
    .ad-sidebar {
        display: none;
    }

    .video-container {
        /* Give a bit less flex to video on mobile so chat gets more space */
        flex: 1; 
        min-height: 0; /* Allow shrinking below content size */
    }
    
    .chat-container {
        flex: 1.3; /* Give chat priority so keyboard doesn't hide it entirely */
        width: 100%;
        max-width: 100%;
        min-height: 250px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    .local-wrapper {
        width: 100px;
        bottom: 10px;
        left: 0;
        border-radius: 0 4px 4px 0;
    }
    
    .local-wrapper:hover {
        width: 150px;
    }
    
    /* Prevent iOS zoom on focus */
    #messageInput {
        font-size: 16px;
    }
}