/* ============================================================================
   🛡️ SARTHI AI - STEALTH / PANIC-PROOF EDITION (PRO CSS)
   Optimized for Domestic Violence Victims. Looks like a boring Notes/Utility App.
   No Neon, No Glow, No Flashy Animations. 'Invisible in Plain Sight'.
   ============================================================================ */

:root {
    /* 🌑 Stealth Colors: Boring Grays & Muted Blues */
    --sarthi-bg-dark: #f8fafc; /* Light Gray instead of Dark Space */
    --sarthi-surface: #ffffff; /* Pure White */
    
    --text-primary: #0f172a; /* Dark text for light background */
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    --accent-blue: #2563eb; /* Calm blue for subtle highlights */
}

/* ==========================================
   🔘 THE STEALTH FAB BUBBLE (FIXED POSITION & VISIBILITY)
   ========================================== */
#sarthi-bot-fab {
    position: fixed; 
    /* 💡 Moved higher so it doesn't block bottom navigation bars */
    bottom: calc(95px + env(safe-area-inset-bottom)); 
    right: 20px; 
    width: 54px; height: 54px; /* Slightly larger for easier tapping */
    
    /* 💡 Given a soft deep blue color to stand out from white/gray backgrounds */
    background: #1e293b; 
    color: #f8fafc; /* White Icon */
    
    border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 22px; 
    cursor: pointer; z-index: 2147483647;
    
    /* 💡 Distinct but not flashy shadow to look like a floating button */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid #ffffff; /* White ring to separate from dark backgrounds */
    
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s, background 0.2s;
}

#sarthi-bot-fab.sarthi-hide {
    display: none !important;
}

#sarthi-bot-fab:active { 
    transform: scale(0.92); 
    background: #0f172a; 
}

/* 🪟 PLAIN SCREEN WINDOW (Looks like a notepad/utility app) */
#sarthi-chat-window {
    display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh;
    background-color: var(--sarthi-bg-dark);
    z-index: 2147483647; flex-direction: column; overflow: hidden; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 📁 BORING HEADER (Looks like settings or a document) */
#sarthi-header { 
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: max(15px, env(safe-area-inset-top)) 20px 15px; 
    color: var(--text-primary); 
    display: flex; justify-content: space-between; align-items: center; 
}
#sarthi-header span { 
    display: flex; align-items: center; gap: 10px; font-size: 16px; 
    font-weight: 600; color: #334155;
}
#sarthi-header i.fa-robot { color: #64748b; font-size: 18px; }

#sarthi-controls i { 
    cursor: pointer; font-size: 16px; color: var(--text-secondary); transition: 0.2s; 
    padding: 8px; border-radius: 6px; margin-left: 5px;
}
#sarthi-controls i:active { background: #f1f5f9; }

/* ==========================================
   💬 MESSAGES AREA (WIDER CARDS)
   ========================================== */
#sarthi-messages { 
    flex: 1; padding: 20px 15px; overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; 
    background: var(--sarthi-bg-dark);
}

.sarthi-msg { 
    padding: 15px 20px; 
    border-radius: 12px; 
    font-size: 15px; 
    /* 💡 INCREASED WIDTH: Now takes up more space on the right side */
    max-width: 98%; 
    line-height: 1.6; 
    word-wrap: break-word; 
    position: relative; 
}

/* 🤖 AI BOT MESSAGE (Simple White Bubble) */
.sarthi-bot-msg { 
    background: #ffffff; color: var(--text-primary); align-self: flex-start; 
    border: 1px solid var(--border-color); 
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04); /* Slightly better shadow for separation */
}

/* 🙋‍♀️ USER MESSAGE (Simple Blue Bubble) */
.sarthi-user-msg { 
    background: #e0f2fe; 
    border: 1px solid #bae6fd;
    color: #0f172a; 
    align-self: flex-end; 
    border-bottom-right-radius: 2px;
}

/* ==========================================
   📄 HIGHLY READABLE TEXT FORMATTING
   ========================================== */

/* Main Heading (H3) - Distinct & Clear */
.sarthi-bot-msg h3 { 
    color: #0f172a; 
    font-size: 17px; 
    font-weight: 700;
    margin: 20px 0 10px 0; 
    border-bottom: 2px solid var(--border-color); 
    padding-bottom: 6px;
    letter-spacing: -0.3px;
}
.sarthi-bot-msg h3:first-child { margin-top: 0; }

/* Sub-heading (H4) - Subtle but visible */
.sarthi-bot-msg h4 { 
    color: var(--text-secondary); 
    font-size: 15px; 
    margin: 16px 0 8px 0; 
    font-weight: 600; 
}

/* Bold Text */
.sarthi-bot-msg b, .sarthi-bot-msg strong { 
    color: #0f172a; 
    font-weight: 600; 
    background: #f1f5f9; 
    padding: 2px 5px; 
    border-radius: 4px;
}

/* Numbered Lists (Ordered) */
.sarthi-bot-msg ol { 
    padding-left: 22px; 
    margin: 12px 0; 
    color: var(--text-primary); 
    font-weight: 500; 
}
.sarthi-bot-msg ol > li { 
    margin-bottom: 12px; 
    padding-left: 4px;
}

/* Bullet Points (Unordered) */
.sarthi-bot-msg ul { 
    list-style-type: disc; 
    padding-left: 24px; 
    margin: 8px 0 12px 0; 
    color: var(--text-secondary); 
    font-weight: 400; 
}
.sarthi-bot-msg ul > li { 
    margin-bottom: 6px; 
    line-height: 1.5;
}

/* Fix for nested lists */
.sarthi-bot-msg ol ul {
    margin-top: 6px;
    margin-bottom: 0;
}
.sarthi-bot-msg ol ul li {
    font-size: 14px; 
}

/* Paragraphs */
.sarthi-bot-msg p { margin: 0 0 12px 0; }
.sarthi-bot-msg p:last-child { margin-bottom: 0; }

/* ==========================================
   ✨ SUGGESTIONS & PROMO FOOTER
   ========================================== */
.sarthi-promo-footer { margin-top: 15px; padding-top: 10px; border-top: 1px solid var(--border-color); font-size: 12px; color: #64748b; }
.sarthi-read-more-btn { 
    background: #f1f5f9; border: 1px solid var(--border-color); color: #334155; 
    cursor: pointer; font-size: 12px; padding: 6px 12px; border-radius: 6px; 
    display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; 
    font-weight: 500;
}
.sarthi-details-content { display: none; margin-top: 10px; background: #f8fafc; padding: 12px; border-radius: 6px; border: 1px solid var(--border-color); }
.sarthi-details-content.show { display: block; }

.s-mini-btn { text-decoration: none; padding: 5px 10px; border-radius: 4px; font-weight: 500; font-size: 12px; display: inline-block; margin-right: 6px; margin-top: 6px; border: 1px solid var(--border-color); color: #334155; background: #ffffff;}

/* ⌨️ COMMAND CENTER (Plain Input Area) */
#sarthi-input-area { 
    padding: 10px 15px calc(10px + env(safe-area-inset-bottom));
    background: #ffffff; 
    display: flex; gap: 10px; align-items: flex-end; 
    border-top: 1px solid var(--border-color); 
    width: 100%; box-sizing: border-box;
}
#sarthi-input { 
    flex: 1; background: #f1f5f9; border: 1px solid var(--border-color); 
    color: #0f172a; padding: 12px 15px; border-radius: 20px; outline: none; 
    font-family: inherit; font-size: 14px; width: 100%;
    resize: none; overflow-y: auto; min-height: 44px; max-height: 100px; line-height: 1.4;
}
#sarthi-input:focus { border-color: #94a3b8; background: #ffffff; }
#sarthi-input::placeholder { color: #94a3b8; }

.sarthi-btn { 
    background: #ffffff; border: 1px solid var(--border-color); color: #64748b; width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 50%; cursor: pointer; display: flex; justify-content: center; align-items: center; 
    font-size: 16px; transition: 0.2s;
}
.sarthi-btn:active { background: #f1f5f9; transform: scale(0.95); }

#sarthi-mic-btn.mic-active { background: #fee2e2; color: #ef4444; border-color: #fca5a5; }

/* Simple Typing Cursor (No Glow) */
.typing-cursor { display: inline-block; width: 6px; height: 14px; background: #334155; margin-left: 4px; animation: blink 1s infinite; vertical-align: text-bottom; }
@keyframes blink { 50% { opacity: 0; } }
