@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&family=Poppins:wght@300;400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: #281523; 
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
}

/* =========================================
   🔥 WIDESCREEN HEADER & CONTAINER
   ========================================= */
.container {
    width: 95%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 2vh 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    z-index: 10;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 1.5rem;
    animation: slideInDown 0.8s ease-out both;
}

.logo-area { display: flex; align-items: center; gap: 15px; }
.action-area { display: flex; align-items: center; gap: 10px; }
.monika-avatar { position: relative; }

.avatar-img {
    border-radius: 50%;
    border: 2px solid #ff1493;
    box-shadow: 0 0 15px rgba(255, 20, 147, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    transition: all 0.3s ease;
}

.title-gradient {
    font-family: 'Dancing Script', cursive;
    color: #ff99bb;
    font-weight: 700;
    text-shadow: 0 0 15px rgba(255, 20, 147, 0.3);
    background: linear-gradient(45deg, #ff6b9d, #ffd93d, #4ade80, #60a5fa);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

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

/* =========================================
   💬 EXPANDED WIDE CHAT PANEL
   ========================================= */
.chat-container {
    background: #362231; 
    border-radius: 24px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.4);
    flex: 1; 
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.8s ease-out 0.4s both;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

/* =========================================
   🗨️ CHAT BUBBLES
   ========================================= */
.message .avatar { display: none !important; }

.message { display: flex; width: 100%; animation: popIn 0.3s ease-out; }
.message.user { justify-content: flex-end; }
.message.monika, .message.system { justify-content: flex-start; }

.message-content {
    max-width: 75%; 
    padding: 12px 20px; 
    border-radius: 20px; 
    font-size: 0.95rem; 
    line-height: 1.5; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.message-content p { margin: 0; }

.message.user .message-content { background: #ff1493; color: white; border-bottom-right-radius: 5px; }
.message.monika .message-content { background: rgba(255, 255, 255, 0.05); color: #e0e0e0; border-bottom-left-radius: 5px; border: 1px solid rgba(255,255,255,0.05); }
.message.system .message-content { background: rgba(0, 0, 0, 0.3); color: #ff99bb; font-size: 0.85rem; padding: 8px 15px; border-radius: 12px; }

/* =========================================
   ⌨️ INPUT AREA
   ========================================= */
.input-container { padding: 15px 20px 20px; background: transparent; }

.input-wrapper {
    display: flex; align-items: center; 
    background: #1c0e18; 
    border-radius: 30px; padding: 6px 12px; gap: 10px;
    border: 1px solid rgba(255,255,255,0.05);
}

#messageInput {
    flex: 1; background: transparent; border: none; outline: none;
    color: white; padding: 10px 15px; font-size: 0.95rem;
}

.tool-btn {
    background: transparent; 
    border: none; 
    outline: none;
    color: rgba(255,255,255,0.4); 
    cursor: pointer; 
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem; 
    transition: all 0.2s ease;
}
.tool-btn:hover { color: white; background: rgba(255,255,255,0.1); }

.tool-btn.active {
    background: rgba(255, 20, 147, 0.15);
    color: #ff1493;
}

.send-btn {
    background: #ff1493; border: none; color: white; width: 42px; height: 42px;
    border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 20, 147, 0.4); transition: 0.2s;
}
.send-btn:hover { transform: scale(1.05); }
.send-btn i { transform: rotate(45deg); margin-right: 4px; }

/* =========================================
   🔐 BUTTONS & OVERLAYS (UPGRADED GLASSMORPHISM)
   ========================================= */
.quick-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6); cursor: pointer; border-radius: 15px;
    padding: 8px; font-size: 1rem; transition: 0.2s;
}
.quick-btn:hover { color: white; background: rgba(255,255,255,0.1); }

/* New Auth Toggle Buttons */
.auth-toggle-btn {
    flex: 1; background: transparent; border: 1px solid rgba(255, 255, 255, 0.2); color: rgba(255,255,255,0.6); padding: 8px; border-radius: 10px; cursor: pointer; transition: 0.3s; font-weight: 500;
}
.auth-toggle-btn.active { border-color: #ff1493; color: white; background: rgba(255, 20, 147, 0.15); box-shadow: 0 0 10px rgba(255, 20, 147, 0.2); }

.login-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: linear-gradient(-45deg, #1c0e18, #362231, #120914, #281523);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    z-index: 9999; display: flex; justify-content: center; align-items: center;
}

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

.login-box {
    background: rgba(40, 21, 35, 0.4); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    padding: 40px; border-radius: 24px; text-align: center; 
    border: 1px solid rgba(255, 107, 157, 0.3); 
    width: 90%; max-width: 400px; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.6), inset 0 0 20px rgba(255, 107, 157, 0.05);
    animation: floatInBox 1s cubic-bezier(0.25, 1, 0.5, 1) both;
}

@keyframes floatInBox {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-box input { 
    width: 100%; padding: 14px; border-radius: 12px; border: none; 
    background: rgba(0,0,0,0.3); color: white; margin-bottom: 15px; outline: none; 
    transition: all 0.3s ease; text-align: center; font-size: 1rem;
    border: 1px solid rgba(255,255,255,0.05);
}

.login-box input:focus { 
    background: rgba(0,0,0,0.6);
    border: 1px solid #ff1493; 
    box-shadow: 0 0 15px rgba(255, 20, 147, 0.3);
    transform: translateY(-2px);
}

.login-box button.action-btn { 
    width: 100%; padding: 14px; border-radius: 12px; border: none; 
    background: linear-gradient(45deg, #ff1493, #ff6b9d); 
    color: white; font-weight: 600; font-size: 1.05rem; letter-spacing: 1px;
    margin-top: 10px; cursor: pointer; transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 20, 147, 0.3);
}

.login-box button.action-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 20, 147, 0.6); 
}

#verifyCodeBtn { background: linear-gradient(45deg, #4ade80, #3b82f6) !important; box-shadow: 0 5px 15px rgba(74, 222, 128, 0.3); }
#verifyCodeBtn:hover { box-shadow: 0 8px 25px rgba(74, 222, 128, 0.6); }

/* =========================================
   ✨ ANIMATIONS & EXTRAS
   ========================================= */
.typing-dots { display: flex; gap: 4px; padding: 5px 0; }
.typing-dots span { width: 6px; height: 6px; background: #ff6b9d; border-radius: 50%; animation: typingDot 1.4s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot { 0%, 60%, 100% { transform: scale(1); } 30% { transform: scale(1.5); } }
@keyframes slideInDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.video-box { border-radius: 24px; overflow: hidden; background: #000; border: 1px solid rgba(255,255,255,0.1); position: relative; }
#vision-feed { width: 100%; height: 100%; object-fit: cover; }
#vision-label { position: absolute; bottom: 10px; left: 10px; background: rgba(0,0,0,0.6); padding: 4px 8px; border-radius: 5px; font-size: 0.7rem; color: #ff6b9d; z-index: 5; }

/* =========================================
   📸 DESKTOP CAMERA SPLIT LAYOUT
   ========================================= */
@media (min-width: 769px) {
    body.camera-active .container {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 20px;
        align-content: flex-start;
    }
    body.camera-active .app-header { width: 100%; flex: none; }
    
    body.camera-active #vision-container {
        width: calc(50% - 10px); 
        display: block !important;
        margin-bottom: 20px;
        box-shadow: 0 15px 50px rgba(0,0,0,0.4);
    }
    
    body.camera-active .chat-container {
        width: calc(50% - 10px); 
        flex: none; 
        height: calc(100vh - 150px); 
    }
}

/* =========================================
   📱 MOBILE ONLY RESPONSIVE SETTINGS
   ========================================= */
@media (max-width: 768px) {
    .title-gradient { 
        font-size: 1.6rem !important; 
        white-space: nowrap !important; 
    }
    .app-header { gap: 5px; }
    .logo-area { gap: 8px; }
    .quick-btn { 
        padding: 5px 10px !important; 
        font-size: 0.85rem !important; 
    }
    
    .message-content { 
        max-width: 92% !important; 
    }

    .input-container {
        padding: 10px 10px 15px; 
    }
    .input-wrapper {
        padding: 4px 8px;
        gap: 5px;
    }
    #messageInput {
        min-width: 0 !important; 
        font-size: 0.9rem;
    }
    .tool-btn {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }
    .send-btn {
        width: 36px;
        height: 36px;
        min-width: 36px; 
    }
}

/* =========================================
   🌈 MULTI-MODE THEMES
   ========================================= */

/* 1. MIDNIGHT MODE (Deep Blue & Silver) */
body.theme-midnight { background: #050a15 !important; }
body.theme-midnight .chat-container { background: #0a1628 !important; }
body.theme-midnight .title-gradient, 
body.theme-midnight .send-btn, 
body.theme-midnight .avatar-img {
    filter: hue-rotate(180deg) brightness(1.2) !important; 
}
body.theme-midnight .message.user .message-content { background: #0077ff !important; }

/* 2. ROSE GARDEN (Very Soft Pink & White) */
body.theme-rose { background: #fff5f8 !important; color: #5d3a44 !important; }
body.theme-rose .chat-container { background: #ffffff !important; box-shadow: 0 10px 30px rgba(255,182,193,0.3); }
body.theme-rose .message.monika .message-content { background: #fce4ec !important; color: #5d3a44 !important; }
body.theme-rose .title-gradient { filter: none !important; color: #ff6b9d !important; -webkit-text-fill-color: #ff6b9d !important; }

/* 3. CYBER VIBE (Purple & Cyan) */
body.theme-cyber { background: #120458 !important; }
body.theme-cyber .chat-container { background: #000000 !important; border: 1px solid #ff00ff; }
body.theme-cyber .title-gradient { filter: hue-rotate(280deg) !important; }
body.theme-cyber .message.user .message-content { background: #bc13fe !important; box-shadow: 0 0 10px #bc13fe; }

/* 4. MATRIX MODE (Hacker Green) */
body.theme-matrix { background: #0a0a0a !important; color: #00ff00 !important; }
body.theme-matrix .chat-container { background: #000000 !important; border: 1px solid #00ff00; box-shadow: 0 0 20px rgba(0, 255, 0, 0.2); }
body.theme-matrix .message.user .message-content { background: #004400 !important; border: 1px solid #00ff00; color: #00ff00 !important; }
body.theme-matrix .message.monika .message-content { background: rgba(0, 255, 0, 0.1) !important; color: #00ff00 !important; }
body.theme-matrix .title-gradient { background: none !important; color: #00ff00 !important; text-shadow: 0 0 10px #00ff00; -webkit-text-fill-color: #00ff00 !important; }
body.theme-matrix .send-btn { background: #00aa00 !important; box-shadow: 0 0 10px #00ff00; }
body.theme-matrix input { color: #00ff00 !important; }

/* 5. SUNSET MODE (Vaporwave Orange & Purple) */
body.theme-sunset { background: linear-gradient(to bottom, #2b0f4c, #d5534d) !important; background-attachment: fixed !important;}
body.theme-sunset .chat-container { background: rgba(20, 10, 30, 0.6) !important; backdrop-filter: blur(10px); border: 1px solid #ff7b54; }
body.theme-sunset .message.user .message-content { background: linear-gradient(45deg, #ff7b54, #ff5b7f) !important; }
body.theme-sunset .title-gradient { filter: hue-rotate(320deg) saturate(2) !important; }

/* 6. YANDERE MODE (Deep Blood Red) */
body.theme-yandere { background: #1a0000 !important; color: #ff9999 !important; }
body.theme-yandere .chat-container { background: #0a0000 !important; border: 1px solid #ff0000; box-shadow: 0 0 30px rgba(255, 0, 0, 0.3); }
body.theme-yandere .message.user .message-content { background: #800000 !important; color: white !important; }
body.theme-yandere .message.monika .message-content { background: rgba(255, 0, 0, 0.1) !important; color: #ff4d4d !important; border: 1px dashed #ff0000; }
body.theme-yandere .title-gradient { background: none !important; color: #ff0000 !important; text-shadow: 2px 2px 0px #4a0000, -2px -2px 0px #000; -webkit-text-fill-color: #ff0000 !important; }
body.theme-yandere .send-btn, body.theme-yandere .avatar-img { border-color: #ff0000 !important; background: #aa0000 !important; box-shadow: 0 0 15px #ff0000 !important; }

/* =========================================
   ⚙️ GLASSMORPHISM SETTINGS LAYOUT
   ========================================= */
.settings-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 8, 20, 0.7);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    z-index: 10000; display: flex; justify-content: center; align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.settings-box {
    background: rgba(54, 34, 49, 0.6);
    border: 1px solid rgba(255, 20, 147, 0.25);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), inset 0 0 20px rgba(255,255,255,0.05);
    width: 90%; max-width: 450px; border-radius: 24px; padding: 25px;
    color: white; animation: slideInUpModal 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    max-height: 85vh; 
    overflow-y: auto; 
}

.settings-box::-webkit-scrollbar { width: 6px; }
.settings-box::-webkit-scrollbar-thumb { background: rgba(255, 107, 157, 0.5); border-radius: 10px; }
.settings-box::-webkit-scrollbar-track { background: transparent; }

.settings-header { display: flex; justify-content: space-between; align-items: center; }
.settings-header h3 { color: #ff99bb; font-weight: 600; font-size: 1.25rem; margin: 0; }

.close-modal-btn {
    background: transparent; border: none; color: rgba(255,255,255,0.6);
    font-size: 1.8rem; cursor: pointer; transition: 0.2s;
}
.close-modal-btn:hover { color: #ff1493; transform: scale(1.1); }
.settings-divider { border: 0; height: 1px; background: rgba(255, 107, 157, 0.2); margin: 15px 0; }

.settings-body { display: flex; flex-direction: column; gap: 20px; }
.setting-group { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.setting-group label { font-size: 0.9rem; font-weight: 500; color: #ff99bb; display: flex; align-items: center; gap: 8px; margin: 0; }

.setting-group input[type="text"], .setting-group select {
    width: 100%; padding: 10px 15px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.4); color: white; outline: none; font-size: 0.95rem; transition: 0.2s; box-sizing: border-box;
}
.setting-group input[type="text"]:focus, .setting-group select:focus { border-color: #ff1493; box-shadow: 0 0 10px rgba(255, 20, 147, 0.3); }
.setting-group select option { background: #281523; color: white; }

.settings-action-btn {
    background: linear-gradient(45deg, #ff1493, #ff6b9d); border: none; color: white;
    padding: 10px; border-radius: 10px; font-weight: 600; cursor: pointer; transition: 0.2s; margin-top: 5px;
}
.settings-action-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 15px rgba(255, 20, 147, 0.4); }

.toggle-wrapper { display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.2); padding: 10px 15px; border-radius: 10px; }
.toggle-wrapper span { font-size: 0.9rem; color: #e0e0e0; }

/* Danger Zone Styling */
.danger-zone { border-top: 1px dashed rgba(255, 0, 0, 0.3); padding-top: 15px; }
.danger-zone label { color: #ff4d4d; }
.danger-zone p { font-size: 0.8rem; color: rgba(255,255,255,0.6); line-height: 1.4; margin: 0; }

.danger-action-btn {
    background: rgba(255, 77, 77, 0.15); border: 1px solid #ff4d4d; color: #ff4d4d;
    padding: 10px; border-radius: 10px; font-weight: 600; cursor: pointer; transition: 0.3s; margin-top: 10px;
}
.danger-action-btn:hover { background: #ff4d4d; color: white; box-shadow: 0 5px 15px rgba(255, 77, 77, 0.4); }

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