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

html { scroll-behavior: smooth; }

* {
    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;
}


body.auth-pending {
    overflow: hidden;
}

.boot-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 35%, rgba(255, 20, 147, 0.14), transparent 34%),
        linear-gradient(-45deg, #1c0e18, #362231, #120914, #281523);
    background-size: 100% 100%, 400% 400%;
    animation: gradientBG 15s ease infinite;
}

.boot-card {
    width: min(88vw, 360px);
    padding: 30px 28px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.045);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.boot-mark {
    font-size: 2.1rem;
    margin-bottom: 4px;
    filter: drop-shadow(0 0 15px rgba(255, 107, 157, 0.65));
    animation: bootPulse 1.6s ease-in-out infinite;
}

.boot-title {
    font-size: 2.65rem !important;
    line-height: 1.1;
}

.boot-status {
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.64);
    font-size: 0.82rem;
}

.boot-progress {
    height: 3px;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.boot-progress span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff6b9d, #ff1493, #ffd3e2);
    animation: bootProgress 1.15s ease-in-out infinite;
}

@keyframes bootPulse {
    0%, 100% { transform: scale(0.96); opacity: 0.75; }
    50% { transform: scale(1.06); opacity: 1; }
}

@keyframes bootProgress {
    0% { transform: translateX(-115%); }
    100% { transform: translateX(340%); }
}

/* =========================================
   🔥 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;
}

/* 🎨 ENHANCED: Gradient Text with Glow */
.title-gradient {
    font-family: 'Dancing Script', cursive;
    font-size: 3.5rem; /* BIGGER for PC Screens */
    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 4s ease infinite, textGlow 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 107, 157, 0.5));
}

@keyframes gradientShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes textGlow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 107, 157, 0.3)); }
    50% { filter: drop-shadow(0 0 20px rgba(255, 107, 157, 0.6)); }
}

/* =========================================
   💬 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;
}

@supports (animation: scroll-animation) {
    .chat-container {
        background-attachment: fixed;
        background-position: center;
    }
}

.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; }

/* 🎨 ENHANCED: Morphing Slide Entrance */
.message { display: flex; width: 100%; animation: messageSlideIn 0.4s ease-out both; }
.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);
    transition: all 0.3s ease; /* Smooth hover transition */
}
.message-content p { margin: 0; }

/* 🎨 ENHANCED: Hover Glow Effect */
.message-content:hover {
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.4);
    transform: translateX(-2px);
}
.message.user .message-content:hover { transform: translateX(2px); }

.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; }

/* 🎨 ENHANCED: Neumorphic Input Wrapper */
.input-wrapper {
    display: flex; align-items: center; 
    background: linear-gradient(145deg, #1c0e18, #2d1a27);
    border-radius: 30px; padding: 6px 12px; gap: 10px;
    border: 1px solid rgba(255, 107, 157, 0.2);
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.3),
        inset 0 -2px 5px rgba(255, 255, 255, 0.05),
        0 4px 15px rgba(255, 107, 157, 0.1);
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: rgba(255, 107, 157, 0.8);
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.3),
        inset 0 -2px 5px rgba(255, 255, 255, 0.05),
        0 0 20px rgba(255, 107, 157, 0.4);
}

#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); }

.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;
}

/* 🎨 ENHANCED: Advanced Glassmorphism Login Box */
.login-box {
    background: rgba(255, 255, 255, 0.05); 
    backdrop-filter: blur(30px); 
    -webkit-backdrop-filter: blur(30px);
    padding: 40px; border-radius: 24px; text-align: center; 
    border: 1px solid rgba(255, 255, 255, 0.15); 
    width: 90%; max-width: 400px; 
    box-shadow: 0 8px 32px rgba(0,0,0,0.1), inset 0 1px rgba(255, 255, 255, 0.2);
    animation: floatInBox 1s cubic-bezier(0.25, 1, 0.5, 1) both;
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    border-radius: inherit; pointer-events: none;
}

/* Keep child elements above the pseudo background */
.login-box > * { position: relative; z-index: 1; }

.login-box input { 
    width: 100%; padding: 14px; border-radius: 12px; border: none; 
    background: rgba(0,0,0,0.4); 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.1);
}

.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); }

#resendCodeBtn {
    background: transparent !important;
    border: 1px solid rgba(255, 20, 147, 0.4) !important;
    color: #ff90b8;
    box-shadow: none;
    font-size: 0.9rem;
}
#resendCodeBtn:hover:not(:disabled) {
    background: rgba(255, 20, 147, 0.12) !important;
    border-color: #ff1493 !important;
}
#resendCodeBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* =========================================
   ✨ 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); } }

/* 🎨 ENHANCED: Message Entrance */
@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(15px) scale(0.95); filter: blur(5px); }
    to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

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

.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: 2.2rem !important; /* PERFECT scale for smartphones */
        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 */
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 */
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 */
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 */
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 */
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 */
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;
}

/* 🎨 ENHANCED: Advanced Glassmorphism Settings Box */
.settings-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1), inset 0 1px rgba(255,255,255,0.2);
    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; 
    position: relative;
}

.settings-box::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    border-radius: inherit; pointer-events: none;
}

.settings-header, .settings-divider, .settings-body { position: relative; z-index: 1; }

.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[readonly] { cursor: default; color: rgba(255,255,255,.82); background: rgba(255,255,255,.035); }
.setting-hint { color: rgba(255,255,255,.5); font-size: .72rem; line-height: 1.4; }
.account-setting-group { grid-column: 1 / -1; }

.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 {
    display: inline-block; text-decoration: none; text-align: center;
    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); } }
/* =========================================
   MONIKA AI V3 PRODUCT LAYOUT
   ========================================= */
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid #ff6b9d;
    outline-offset: 2px;
}

.app-shell {
    width: 100%;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

.app-shell .container {
    min-width: 0;
    width: auto;
    max-width: none;
    flex: 1;
    padding: 18px 24px;
}

.conversation-sidebar {
    width: 290px;
    min-width: 290px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    background: rgba(16, 8, 18, 0.78);
    border-right: 1px solid rgba(255, 107, 157, 0.14);
    backdrop-filter: blur(24px);
    z-index: 80;
}

.sidebar-header, .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand { justify-content: flex-start; gap: 9px; font-size: 1.05rem; color: #ffb0c9; }
.icon-btn { border: 0; background: transparent; color: white; cursor: pointer; padding: 6px; }
.mobile-only { display: none; }

.new-chat-btn {
    margin: 18px 0 12px;
    padding: 11px 14px;
    border: 1px solid rgba(255, 107, 157, 0.35);
    border-radius: 12px;
    color: white;
    background: linear-gradient(135deg, rgba(255, 20, 147, 0.25), rgba(255, 107, 157, 0.08));
    cursor: pointer;
    transition: 0.2s ease;
}
.new-chat-btn:hover { transform: translateY(-1px); border-color: #ff6b9d; }

.sidebar-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border-radius: 11px;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.08);
}
.sidebar-search-wrap i { color: rgba(255,255,255,0.45); }
.sidebar-search-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: white; min-width: 0; }

.conversation-list, .search-results {
    flex: 1;
    overflow-y: auto;
    margin-top: 10px;
    padding-right: 3px;
}
.search-results { flex: none; max-height: 42vh; border-bottom: 1px solid rgba(255,255,255,0.08); }
.conversation-list::-webkit-scrollbar, .search-results::-webkit-scrollbar, .management-list::-webkit-scrollbar { width: 5px; }
.conversation-list::-webkit-scrollbar-thumb, .search-results::-webkit-scrollbar-thumb, .management-list::-webkit-scrollbar-thumb { background: rgba(255,107,157,.3); border-radius: 8px; }

.conversation-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
    padding: 10px 8px 10px 11px;
    border-radius: 11px;
    margin-bottom: 5px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: .18s ease;
}
.conversation-item:hover { background: rgba(255,255,255,0.055); }
.conversation-item.active { background: rgba(255,20,147,0.14); border-color: rgba(255,107,157,0.28); }
.conversation-main { min-width: 0; }
.conversation-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #f8edf3; font-size: .9rem; }
.conversation-time { display: block; margin-top: 3px; color: rgba(255,255,255,.4); font-size: .68rem; }
.conversation-actions { display: flex; gap: 2px; opacity: 0; transition: .15s; }
.conversation-item:hover .conversation-actions, .conversation-item.active .conversation-actions { opacity: 1; }
.conversation-action { width: 28px; height: 28px; border: 0; border-radius: 8px; color: rgba(255,255,255,.65); background: transparent; cursor: pointer; }
.conversation-action:hover { color: white; background: rgba(255,255,255,.1); }
.pin-indicator { color: #ff9bc0; margin-right: 5px; font-size: .7rem; }

.search-result-item { padding: 10px; border-radius: 10px; cursor: pointer; margin-bottom: 5px; background: rgba(255,255,255,.035); }
.search-result-item:hover { background: rgba(255,20,147,.1); }
.search-result-title { color: #ffb0ca; font-size: .78rem; }
.search-result-snippet { color: rgba(255,255,255,.7); font-size: .75rem; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding-top: 10px; }
.sidebar-footer-btn { width: 100%; border: 0; background: transparent; color: rgba(255,255,255,.6); text-align: left; padding: 9px 8px; border-radius: 9px; cursor: pointer; }
.sidebar-footer-btn:hover { color: white; background: rgba(255,255,255,.06); }
.sidebar-footer-btn i { width: 22px; }

.title-stack { min-width: 0; }
.title-stack .title-gradient { font-size: 2.5rem; line-height: 1; }
.conversation-title-button { display: block; max-width: 420px; padding: 3px 0; border: 0; background: transparent; color: rgba(255,255,255,.58); font-size: .76rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.conversation-title-button:hover { color: #ffb0ca; }
.logout-quick { border-color: rgba(255,77,77,.3); color: #ff7777; padding: 6px 15px; }
.avatar-img { width: 45px; height: 45px; font-size: 1.2rem; }

.chat-toolbar { min-height: 42px; display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-bottom: 1px solid rgba(255,255,255,.055); }
.toolbar-btn { border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.035); color: rgba(255,255,255,.63); border-radius: 9px; padding: 6px 9px; cursor: pointer; font-size: .73rem; }
.toolbar-btn:hover { color: white; border-color: rgba(255,107,157,.35); }
.toolbar-btn span { margin-left: 4px; }
.connection-status { margin-left: auto; color: rgba(255,255,255,.55); font-size: .72rem; }
.connection-status i { font-size: .55rem; margin-right: 4px; }
.connection-status.online i { color: #4ade80; }
.connection-status.offline i { color: #f87171; }

.empty-state { margin: auto; text-align: center; max-width: 420px; color: rgba(255,255,255,.58); padding: 30px; }
.empty-state-icon { font-size: 2.7rem; margin-bottom: 10px; }
.empty-state h2 { font-size: 1.25rem; color: #ffb0c9; margin-bottom: 8px; }
.empty-state p { font-size: .86rem; line-height: 1.6; }

.message { position: relative; flex-direction: column; }
.message.user { align-items: flex-end; }
.message.monika, .message.system { align-items: flex-start; }
.message-content { white-space: pre-wrap; overflow-wrap: anywhere; }

.chat-text.typewriter-active::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 3px;
    vertical-align: -0.16em;
    border-radius: 2px;
    background: currentColor;
    opacity: 0.85;
    animation: typewriterCaret 0.72s steps(1, end) infinite;
}

@keyframes typewriterCaret {
    0%, 45% { opacity: 0.85; }
    46%, 100% { opacity: 0; }
}
.message-meta { margin: 4px 8px 0; color: rgba(255,255,255,.3); font-size: .64rem; }
.message-actions { display: flex; gap: 3px; margin: 5px 7px 0; opacity: .25; transition: .16s; }
.message:hover .message-actions, .message:focus-within .message-actions { opacity: 1; }
.message.user .message-actions { justify-content: flex-end; }
.message-action-btn { border: 0; border-radius: 7px; background: transparent; color: rgba(255,255,255,.6); cursor: pointer; padding: 5px 7px; font-size: .72rem; }
.message-action-btn:hover { background: rgba(255,255,255,.08); color: white; }
.message-action-btn.selected { color: #ff90b8; background: rgba(255,20,147,.1); }
.message-attachments { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.message-attachment-chip { font-size: .7rem; padding: 4px 7px; border-radius: 8px; background: rgba(0,0,0,.22); }

.attachment-preview { display: flex; gap: 8px; overflow-x: auto; padding: 9px 18px 0; }
.attachment-card { min-width: 145px; max-width: 210px; display: grid; grid-template-columns: 34px minmax(0,1fr) 24px; gap: 7px; align-items: center; padding: 8px; border: 1px solid rgba(255,107,157,.18); background: rgba(0,0,0,.18); border-radius: 11px; }
.attachment-card-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,20,147,.12); color: #ff9dbc; }
.attachment-card-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.attachment-card-size { color: rgba(255,255,255,.42); font-size: .62rem; }
.remove-attachment { border: 0; color: rgba(255,255,255,.55); background: transparent; cursor: pointer; }
.remove-attachment:hover { color: #ff7474; }
.input-hint { display: flex; justify-content: space-between; padding: 5px 15px 0; color: rgba(255,255,255,.3); font-size: .62rem; }
.send-btn.stop-state { background: #ef4444; }
.send-btn.stop-state i { transform: none; margin: 0; }

.settings-box-wide { max-width: 820px; width: min(94vw, 820px); }
.settings-tabs { display: flex; gap: 5px; overflow-x: auto; padding: 12px 0 8px; border-bottom: 1px solid rgba(255,255,255,.08); position: relative; z-index: 1; }
.settings-tab { border: 0; background: transparent; color: rgba(255,255,255,.55); padding: 8px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.settings-tab:hover, .settings-tab.active { color: white; background: rgba(255,20,147,.14); }
.settings-panels { position: relative; z-index: 1; padding-top: 16px; }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.setting-group input[type="text"], .setting-group input[type="datetime-local"], .setting-group select, .memory-add-row input, .reminder-form input, .reminder-form select {
    width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); background: rgba(0,0,0,.35); color: white; outline: 0;
}
.toggle-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 16px 0; }
.settings-action-btn.compact { width: auto; margin: 0; padding: 9px 15px; }
.secondary-action-btn { border: 1px solid rgba(255,107,157,.28); background: rgba(255,20,147,.08); color: #ffd4e4; border-radius: 10px; padding: 10px 13px; cursor: pointer; }
.secondary-action-btn:hover { background: rgba(255,20,147,.16); }
.section-copy, .privacy-card p { color: rgba(255,255,255,.6); font-size: .82rem; line-height: 1.55; margin-bottom: 12px; }
.memory-add-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 13px 0; }
.management-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.management-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px; border-radius: 11px; background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.06); }
.management-title { color: #f7eaf0; font-size: .86rem; overflow-wrap: anywhere; }
.management-subtitle { color: rgba(255,255,255,.43); font-size: .69rem; margin-top: 3px; }
.management-actions { display: flex; gap: 5px; }
.management-btn { border: 0; border-radius: 8px; background: rgba(255,255,255,.06); color: rgba(255,255,255,.65); cursor: pointer; padding: 7px 9px; }
.management-btn:hover { color: white; }
.management-btn.danger:hover { background: rgba(239,68,68,.18); color: #ff8d8d; }
.reminder-form { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) 120px; gap: 8px; margin-bottom: 10px; }
.reminder-form .settings-action-btn { grid-column: 1 / -1; margin: 0; }
.journal-actions { display: flex; gap: 8px; margin-top: 10px; }
.journal-output { margin-top: 12px; white-space: pre-wrap; padding: 13px; border-radius: 11px; background: rgba(0,0,0,.22); color: rgba(255,255,255,.8); max-height: 260px; overflow-y: auto; }
.privacy-card { padding: 13px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(0,0,0,.18); }
.privacy-card h4 { color: #ffb0c9; margin-bottom: 7px; }

.login-title { font-size: 2.6rem !important; margin-bottom: 8px; }
.muted-copy { color: rgba(255,255,255,.7); margin-bottom: 20px; }
.google-button { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-separator { color: rgba(255,255,255,.4); font-size: .78rem; margin-bottom: 14px; letter-spacing: 2px; }
.auth-toggle-row { display: flex; gap: 10px; margin-bottom: 14px; }
.otp-note { color: #ff83ad; margin-bottom: 10px; font-size: .86rem; }
.verify-action { background: linear-gradient(45deg,#4ade80,#3b82f6) !important; }

.legal-consent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    margin-bottom: 18px;
    cursor: pointer;
    font-size: .82rem;
    color: rgba(255,255,255,.72);
    line-height: 1.45;
}
.legal-consent-row input[type="checkbox"] {
    margin-top: 3px;
    min-width: 16px;
    min-height: 16px;
    accent-color: #ff1493;
    cursor: pointer;
}
.legal-consent-row a {
    color: #ff99bb;
    text-decoration: underline;
    text-decoration-color: rgba(255,153,187,.35);
}
.legal-consent-row a:hover { color: #ff6b9d; }

.google-button.consent-blocked {
    pointer-events: none;
    opacity: 0.45;
    filter: grayscale(0.5);
    transition: opacity .25s, filter .25s;
}

.login-legal-footer {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: 18px;
    font-size: .72rem;
}
.login-legal-footer a {
    color: rgba(255,255,255,.4);
    text-decoration: none;
    transition: color .2s;
}
.login-legal-footer a:hover { color: #ff99bb; }

body.text-small .message-content { font-size: .82rem; }
body.text-large .message-content { font-size: 1.08rem; }

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 70; }

@media (max-width: 900px) {
    .mobile-only { display: inline-flex; }
    .conversation-sidebar { position: fixed; left: 0; top: 0; transform: translateX(-105%); transition: transform .24s ease; box-shadow: 18px 0 45px rgba(0,0,0,.35); }
    .conversation-sidebar.open { transform: translateX(0); }
    .app-shell .container { width: 100%; padding: 12px; }
    .title-stack .title-gradient { font-size: 2rem !important; }
    .conversation-title-button { max-width: 210px; }
    .settings-grid, .toggle-list { grid-template-columns: 1fr; }
    .reminder-form { grid-template-columns: 1fr; }
    .reminder-form .settings-action-btn { grid-column: auto; }
}

@media (max-width: 600px) {
    .app-shell .container { padding: 8px; }
    .app-header { margin-bottom: 8px; }
    .monika-avatar { display: none; }
    .title-stack .title-gradient { font-size: 1.7rem !important; }
    .conversation-title-button { max-width: 155px; font-size: .65rem; }
    .action-area { gap: 4px; }
    .logout-quick { padding: 5px 8px !important; }
    .chat-container { border-radius: 17px; }
    .chat-toolbar { padding: 6px 8px; }
    .toolbar-btn span { display: none; }
    .message-content { max-width: 94% !important; padding: 10px 13px; }
    .message-actions { opacity: .7; }
    .attachment-preview { padding-left: 9px; padding-right: 9px; }
    .input-hint { display: none; }
    .input-container { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
    .settings-box { padding: 17px; max-height: 92vh; }
    .settings-tabs { margin-left: -5px; margin-right: -5px; }
    .journal-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* =========================================
   ADMIN DASHBOARD
   ========================================= */
.admin-body { display: block; background: #160b15; min-height: 100vh; padding: 24px; }
.admin-container { max-width: 1300px; margin: 0 auto; }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.admin-header h1 { color: #ff9fbe; font-size: 2rem; }
.admin-header p { color: rgba(255,255,255,.55); margin-top: 4px; }
.admin-home-link { text-decoration: none; display: inline-flex; align-items: center; gap: 7px; }
.admin-status { padding: 18px; border-radius: 12px; background: rgba(255,255,255,.05); color: rgba(255,255,255,.75); }
.admin-status.error { border: 1px solid rgba(239,68,68,.4); color: #ff9c9c; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.metric-card, .admin-card { background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.metric-card { padding: 16px; }
.metric-card span { display: block; color: rgba(255,255,255,.5); font-size: .76rem; }
.metric-card strong { display: block; color: #ffb1ca; font-size: 1.8rem; margin-top: 6px; }
.admin-card { padding: 16px; margin-bottom: 16px; }
.admin-card h2 { color: #ffd2e1; font-size: 1.05rem; }
.admin-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.admin-form-row { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; margin-top: 12px; }
.admin-form-row input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); background: rgba(0,0,0,.28); color: white; }
.admin-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-list { max-height: 520px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.admin-list-item { padding: 11px; border-radius: 10px; background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.05); }
.admin-list-item strong { display: block; color: #ffb2ca; font-size: .8rem; overflow-wrap: anywhere; }
.admin-list-item p { color: rgba(255,255,255,.72); font-size: .78rem; line-height: 1.5; margin: 6px 0; white-space: pre-wrap; }
.admin-list-item small { color: rgba(255,255,255,.4); font-size: .68rem; }
@media (max-width: 900px) {
    .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .admin-grid-two { grid-template-columns: 1fr; }
    .admin-form-row { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .admin-body { padding: 14px; }
    .admin-header { align-items: flex-start; flex-direction: column; }
    .metric-grid { grid-template-columns: 1fr; }
}
