:root {
    /* Themes*/
    --bg-main: #0b141a;
    --bg-sidebar: #111b21;
    --bg-header: rgba(32, 44, 51, 0.95); /* Glass effect */
    --bg-input: #2a3942;
    --bg-panel: #111b21;
    
    --primary: #00a884;
    --primary-hover: #00c298;
    
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-muted: #667781;
    
    --border: #222d34;
    
    --msg-in: #202c33;
    --msg-out: #005c4b;
    --system-msg: #182229;
    
    --shadow-sm: 0 1px 0.5px rgba(0,0,0,0.13);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    
    --highlight: #f5c518;
    
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body.light-theme {
    --bg-main: #dfd7cf;
    --bg-sidebar: #ffffff;
    --bg-header: rgba(240, 242, 245, 0.95);
    --bg-input: #ffffff;
    --bg-panel: #ffffff;
    
    --primary: #00a884;
    
    --text-primary: #111b21;
    --text-secondary: #54656f;
    --text-muted: #667781;
    
    --border: #e9edef;
    
    --msg-in: #ffffff;
    --msg-out: #d9fdd3;
    --system-msg: #fff;
}

/* Base */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { 
    background: var(--bg-main); 
    color: var(--text-primary); 
    height: 100vh; 
    width: 100vw; 
    overflow: hidden; 
    font-family: var(--font-family); 
    font-size: 14.5px;
    line-height: 1.5;
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(134, 150, 160, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(134, 150, 160, 0.5); }

/* Layout */
.app-layout { 
    display: flex; 
    height: 100%; 
    width: 100%; 
    max-width: 1600px; 
    margin: 0 auto; 
    position: relative; 
    background: var(--bg-main);
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

/* Sidebar */
.sidebar { 
    width: 400px; 
    min-width: 320px; 
    background: var(--bg-sidebar); 
    border-right: 1px solid var(--border); 
    display: flex; 
    flex-direction: column; 
    z-index: 200; 
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}

.sidebar-header { 
    height: 60px; 
    background: var(--bg-header); 
    backdrop-filter: blur(10px);
    padding: 10px 16px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-shrink: 0;
}

.profile-thumb img { 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    object-fit: cover; 
    cursor: pointer; 
    transition: opacity 0.2s; 
}
.profile-thumb img:hover { opacity: 0.8; }

.sidebar-nav button { 
    background: none; 
    border: none; 
    color: var(--text-secondary); 
    font-size: 24px; 
    cursor: pointer; 
    padding: 8px; 
    border-radius: 50%; 
    transition: background 0.2s;
}
.sidebar-nav button:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.sidebar-content { flex: 1; position: relative; overflow: hidden; }

.sidebar-footer { 
    padding: 12px; 
    text-align: center; 
    font-size: 11px; 
    color: var(--text-muted); 
    border-top: 1px solid var(--border); 
    background: var(--bg-sidebar);
}
.sidebar-footer a { color: var(--text-secondary); text-decoration: none; }

/* Upload Panel */
.upload-state { 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    padding: 30px 20px; 
    gap: 20px; 
    overflow-y: auto;
}

.brand-hero { text-align: center; margin-bottom: 10px; }
.brand-hero h2 { font-weight: 300; font-size: 28px; color: var(--text-primary); }
.brand-hero span { font-size: 12px; color: var(--primary); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }

.input-wrapper label { display: block; color: var(--primary); font-size: 12px; font-weight: 600; margin-bottom: 8px; margin-left: 4px; }
.input-wrapper input { 
    width: 100%; 
    padding: 12px 16px; 
    background: var(--bg-input); 
    border: 1px solid var(--border); 
    border-radius: 10px; 
    color: var(--text-primary); 
    transition: border 0.2s;
}
.input-wrapper input:focus { border-color: var(--primary); }

.drop-target { 
    border: 2px dashed var(--border); 
    border-radius: 16px; 
    padding: 40px 20px; 
    text-align: center; 
    color: var(--text-secondary); 
    transition: all 0.2s; 
    cursor: pointer; 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center;
}
.drop-target:hover { border-color: var(--primary); background: rgba(0, 168, 132, 0.04); }
.drop-target i { font-size: 48px; margin-bottom: 15px; color: var(--text-muted); }

.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text-primary); padding: 8px 20px; border-radius: 20px; margin-top: 15px; cursor: pointer; font-weight: 500; }
.btn-primary { 
    width: 100%; 
    padding: 14px; 
    background: var(--primary); 
    color: #fff; 
    font-weight: 600; 
    border: none; 
    border-radius: 24px; 
    cursor: pointer; 
    font-size: 15px; 
    box-shadow: 0 4px 10px rgba(0, 168, 132, 0.3); 
    transition: transform 0.1s;
}
.btn-primary:active { transform: scale(0.98); }

.privacy-pill { 
    background: rgba(0,168,132,0.08); 
    color: var(--primary); 
    padding: 10px; 
    border-radius: 8px; 
    font-size: 11px; 
    text-align: center; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px;
    font-weight: 500; 
}

/* Chat List (After Load) */
.chat-list { padding: 10px; height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.hidden { display: none !important; }

.search-bar-sidebar { 
    background: var(--bg-input); 
    padding: 8px 12px; 
    border-radius: 8px; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    margin-bottom: 15px; 
    border-bottom: 1px solid transparent;
}
.search-bar-sidebar:focus-within { border-bottom: 1px solid var(--primary); }
.search-bar-sidebar input { background: transparent; border: none; flex: 1; color: var(--text-primary); }

.chat-item { 
    display: flex; 
    gap: 15px; 
    padding: 12px; 
    background: transparent; 
    border-radius: 12px; 
    cursor: pointer; 
    transition: background 0.2s; 
    align-items: center;
}
.chat-item.active, .chat-item:hover { background: var(--bg-header); }
.chat-item-avatar { width: 50px; height: 50px; border-radius: 50%; background: #6a7175; flex-shrink: 0; }
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-info h4 { font-weight: 500; font-size: 16px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-info span { font-size: 13px; color: var(--text-secondary); }

/* Drawers (Profile/Stats) */
.drawer { 
    position: absolute; 
    top: 0; left: 0; width: 100%; height: 100%; 
    background: var(--bg-panel); 
    transform: translateX(-100%); 
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1); 
    z-index: 300; 
    display: flex; 
    flex-direction: column; 
}
.drawer.open { transform: translateX(0); }

.drawer-header { 
    height: 110px; 
    background: var(--bg-header); 
    display: flex; 
    align-items: flex-end; 
    padding: 20px; 
    font-size: 19px; 
    font-weight: 500; 
    gap: 20px;
    border-bottom: 1px solid var(--border);
}
.drawer-header button { background: none; border: none; color: var(--text-primary); font-size: 24px; cursor: pointer; }
.drawer-scroll { padding: 20px; overflow-y: auto; flex: 1; }

/* Profile Styles */
.profile-hero { text-align: center; margin-bottom: 30px; }
.large-avatar { width: 200px; height: 200px; margin: 0 auto 20px; position: relative; cursor: pointer; border-radius: 50%; overflow: hidden; }
.large-avatar img { width: 100%; height: 100%; object-fit: cover; }
.large-avatar .overlay { 
    position: absolute; inset: 0; 
    background: rgba(0,0,0,0.4); 
    display: flex; align-items: center; justify-content: center; 
    color: #fff; font-size: 40px; 
    opacity: 0; transition: 0.2s; 
}
.large-avatar:hover .overlay { opacity: 1; }

.section-label { color: var(--primary); font-size: 12px; font-weight: 600; margin-bottom: 15px; margin-top: 30px; }

.support-card { 
    background: var(--bg-header); 
    padding: 20px; 
    border-radius: 12px; 
    border: 1px solid var(--border); 
    text-align: center; 
}
.upi-display { 
    background: var(--bg-input); 
    padding: 12px; 
    border-radius: 8px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    font-family: monospace; 
    margin-bottom: 20px;
    font-size: 14px;
}
.upi-display button { background: none; border: none; color: var(--primary); cursor: pointer; }
.qr-frame { background: #fff; padding: 15px; border-radius: 8px; display: inline-block; }
.qr-frame img { display: block; width: 160px; height: 160px; }

/* Stats Styles */
.stats-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 30px; }
.stat-box { background: var(--bg-input); padding: 20px 15px; border-radius: 12px; text-align: center; border: 1px solid var(--border); }
.stat-box .val { display: block; font-size: 26px; color: var(--primary); font-weight: 300; margin-bottom: 5px; }
.stat-box .label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.stats-list { display: flex; flex-direction: column; gap: 15px; }
.stat-row { font-size: 13px; }
.stat-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.stat-name { font-weight: 500; color: var(--text-primary); }
.stat-pct { color: var(--text-secondary); }
.progress-bg { height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.progress-val { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.5s ease; }

/* Chat Interface */
.chat-interface { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    background: var(--bg-main); 
    position: relative; 
    border-left: 1px solid var(--border); 
    z-index: 10;
}

.chat-bg { 
    position: absolute; inset: 0; 
    opacity: 0.06; 
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png'); 
    pointer-events: none; 
}
body.light-theme .chat-bg { opacity: 0.4; }

.chat-header { 
    height: 60px; 
    background: var(--bg-header); 
    backdrop-filter: blur(10px);
    padding: 0 16px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    z-index: 20; 
    border-bottom: 1px solid var(--border);
}

.header-profile { display: flex; align-items: center; gap: 12px; cursor: pointer; overflow: hidden; }
.header-pfp { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.header-info h3 { font-size: 16px; font-weight: 500; white-space: nowrap; }
.header-info p { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

.header-tools { display: flex; gap: 8px; }
.header-tools button { background: none; border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer; padding: 8px; border-radius: 50%; }
.header-tools button:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.mobile-menu { display: none; background: none; border: none; color: var(--text-primary); font-size: 24px; margin-right: 12px; cursor: pointer; }

/* Search Toolbar (Hidden) */
.search-toolbar { 
    height: 60px; 
    background: var(--bg-header); 
    border-bottom: 1px solid var(--border); 
    display: none; 
    align-items: center; 
    padding: 0 16px; 
    gap: 15px; 
    z-index: 19; 
    animation: slideDown 0.2s ease;
}
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.search-toolbar.active { display: flex; }

.search-input-group { flex: 1; background: var(--bg-input); height: 40px; border-radius: 8px; display: flex; align-items: center; padding: 0 12px; gap: 10px; }
.search-input-group input { background: transparent; border: none; flex: 1; color: var(--text-primary); font-size: 14px; }
.search-input-group button { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 20px; }

.search-nav { display: flex; gap: 4px; align-items: center; color: var(--text-secondary); font-size: 13px; white-space: nowrap; }
.search-nav button { background: none; border: none; color: var(--text-primary); cursor: pointer; font-size: 20px; padding: 4px; border-radius: 50%; }
.search-nav button:hover { background: rgba(255,255,255,0.05); }

/* Messages Area */
.messages-viewport { flex: 1; overflow-y: auto; padding: 20px 5%; position: relative; z-index: 10; scroll-behavior: auto; }

.empty-placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-secondary); padding: 20px; }
.empty-placeholder .illustration { font-size: 80px; margin-bottom: 20px; color: var(--border); opacity: 0.5; }
.empty-placeholder h1 { color: var(--text-primary); font-weight: 300; margin-bottom: 10px; }

/* System & Bubbles */
.system-msg { align-self: center; background: var(--system-msg); color: var(--text-secondary); font-size: 12px; padding: 6px 14px; border-radius: 8px; margin: 8px 0; text-transform: uppercase; font-weight: 600; text-align: center; box-shadow: var(--shadow-sm); border: 1px solid rgba(0,0,0,0.05); }
.sticky-date { position: sticky; top: 10px; z-index: 50; }

.msg-row { display: flex; flex-direction: column; max-width: 65%; margin-bottom: 2px; position: relative; width: 100%; }
.msg-row.sent { align-self: flex-end; align-items: flex-end; }
.msg-row.received { align-self: flex-start; align-items: flex-start; }

.bubble { 
    padding: 6px 7px 8px 9px; 
    border-radius: 8px; 
    position: relative; 
    font-size: 14.2px; 
    line-height: 19px; 
    color: var(--text-primary); 
    box-shadow: var(--shadow-sm); 
    min-width: 70px; 
    word-wrap: break-word; 
    border: 1px solid transparent;
}
.received .bubble { background: var(--msg-in); border-top-left-radius: 0; }
.sent .bubble { background: var(--msg-out); border-top-right-radius: 0; }

.sender { font-size: 13px; font-weight: 600; margin-bottom: 4px; cursor: pointer; color: #f39c12; }
.meta { float: right; margin-left: 12px; margin-top: 4px; font-size: 11px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; opacity: 0.8; }
.msg-text { display: inline; }
.msg-text a { color: #53bdeb; text-decoration: none; }
.msg-text a:hover { text-decoration: underline; }

/* Tails (SVG kinda using css) */
.tail-in .bubble::before { content: ""; position: absolute; top: 0; left: -8px; width: 8px; height: 13px; background: var(--msg-in); clip-path: polygon(100% 0, 100% 100%, 0 0); }
.tail-out .bubble::after { content: ""; position: absolute; top: 0; right: -8px; width: 8px; height: 13px; background: var(--msg-out); clip-path: polygon(0 0, 0 100%, 100% 0); }
.msg-row.tail { margin-top: 8px; }

/* Search Highlights */
.hl { background: rgba(245, 197, 24, 0.4); color: inherit; padding: 0 1px; border-radius: 2px; }
.hl.focus { background: var(--highlight); color: #000; box-shadow: 0 0 0 2px var(--highlight); }

/* Footer */
.chat-footer { 
    height: 62px; 
    background: var(--bg-header); 
    display: flex; 
    align-items: center; 
    padding: 0 12px; 
    gap: 12px; 
    border-left: 1px solid var(--border); 
    z-index: 20; 
}
.chat-footer button { background: none; border: none; color: var(--text-secondary); font-size: 26px; cursor: pointer; }
.fake-input { 
    flex: 1; 
    background: var(--bg-input); 
    height: 42px; 
    border-radius: 8px; 
    padding: 11px 16px; 
    color: var(--text-secondary); 
    cursor: text; 
    font-size: 15px; 
}

/* Toast */
#toast { 
    position: fixed; 
    bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px); 
    background: var(--primary); color: #fff; 
    padding: 12px 24px; border-radius: 30px; 
    font-weight: 600; font-size: 14px; 
    opacity: 0; pointer-events: none; 
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    z-index: 9999; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Mobile Friendliness stuff */
@media (max-width: 800px) {
    .sidebar { position: absolute; width: 100%; height: 100%; transform: translateX(-100%); box-shadow: 5px 0 15px rgba(0,0,0,0.3); }
    .sidebar.active { transform: translateX(0); }
    .mobile-menu { display: block; }
    .messages-viewport { padding: 20px 10px; }
    .msg-row { max-width: 85%; }
    .chat-footer { padding: 0 8px; }
    .header-info h3 { font-size: 15px; }
}

/* Info Drawer */
.info-block { margin-bottom: 25px; }
.info-block h4 { color: var(--primary); font-size: 14px; margin-bottom: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.info-block p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.inline-code { background: var(--bg-input); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 12px; color: var(--text-primary); }

.feature-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.feature-list li { display: flex; align-items: flex-start; gap: 10px; color: var(--text-primary); font-size: 14px; line-height: 1.5; }
.feature-list li i { color: var(--primary); font-size: 18px; margin-top: 2px; flex-shrink: 0; }

.feature-list.warning li i { color: #f1c40f; }

.repo-card { 
    display: flex; align-items: center; gap: 15px; 
    background: var(--bg-input); 
    padding: 15px; border-radius: 12px; 
    border: 1px solid var(--border); 
    text-decoration: none; color: var(--text-primary); 
    transition: all 0.2s;
}
.repo-card:hover { border-color: var(--primary); background: rgba(0,168,132,0.05); }
.repo-card i:first-child { font-size: 32px; color: var(--text-primary); }
.repo-card i:last-child { margin-left: auto; color: var(--text-secondary); }
.repo-card div { display: flex; flex-direction: column; }
.repo-card div span { font-size: 12px; color: var(--text-secondary); }

.support-text { margin-bottom: 15px; color: var(--text-secondary); font-size: 14px; }
.secure-badge { margin-top: 10px; font-size: 12px; color: var(--primary); display: flex; align-items: center; justify-content: center; gap: 6px; opacity: 0.8; }