/* =========================================
   MIZO MIXSTATION V8.6.0 - PRO EDITION
   ========================================= */

:root {
    --bg-main: #131314;
    --bg-sidebar: #1e1f22;
    --bg-composer: #1e1f22;
    --bg-bubble-user: #1e293b;
    --text-main: #e3e3e3;
    --text-muted: #a1a1aa;
    --border-color: rgba(255,255,255,0.08);
    --accent-blue: #3b82f6;
    --font-base: 15px;
}

[data-theme="light"] {
    --bg-main: #ffffff;
    --bg-sidebar: #f0f4f9;
    --bg-composer: #f0f4f9;
    --bg-bubble-user: #e3f2fd;
    --text-main: #1f1f1f;
    --text-muted: #444746;
    --border-color: rgba(0,0,0,0.1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0;}
html, body { height: 100%; overflow: hidden; }
body {
    background-color: var(--bg-main); color: var(--text-main);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: var(--font-base); display: flex; flex-direction: column;
}
.hidden { display: none !important; }

/* Top Header */
.topbar {
    position: relative; z-index: 90; height: 60px; padding: 0 16px;
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-sidebar); border-bottom: 1px solid var(--border-color); flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text-main); text-decoration: none; font-size: 18px; font-weight: 800; }
.brand img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.net-badge { font-size: 10px; font-weight: 700; padding: 4px 8px; border-radius: 12px; background: #1e293b; color: #10b981;}
.global-profile-pic { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; cursor: pointer; border: 1px solid var(--accent-blue);}

/* Main App Container */
#mainContainer { flex: 1; overflow-y: auto; position: relative; }
.page { display: none; padding: 16px; max-width: 800px; margin: auto; animation: fadeIn 0.2s ease; min-height: 100%; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.page-header { padding: 5px 0 15px 0; }
.eyebrow { letter-spacing: 0.1em; font-size: 11px; font-weight: 700; color: #38bdf8; text-transform: uppercase; margin-bottom: 5px;}
.page-header h1, .hero h1 { font-size: clamp(30px, 8vw, 45px); font-weight: 800; line-height: 1.1; margin: 0 0 8px 0; }
.hero { padding-bottom: 15px;}
.hero h1 span { background: linear-gradient(90deg, #ff3266, #8c5cff, #20d7ed); -webkit-background-clip: text; color: transparent; }

/* Cards & Buttons */
.section-container { margin-bottom: 25px; }
.section-title { margin-bottom: 12px; }
.section-title h2 { margin: 0; font-size: 1.3em; font-weight: 700;}
.card-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.app-card { padding: 18px; border-radius: 18px; text-decoration: none; color: white; display: flex; flex-direction: column; justify-content: center; box-shadow: 0 4px 15px rgba(0,0,0,0.15); transition: 0.2s; }
.app-card:active { transform: scale(0.96); }
.app-card .app-icon { font-size: 2.2em; margin-bottom: 8px; }
.app-card h3 { margin: 0 0 2px 0; font-size: 1.15em; font-weight: 700;}

.mini-app-card { background: #1e293b; padding: 14px 8px; border-radius: 14px; text-align: center; text-decoration: none; color: white; cursor: pointer;}
.mini-app-card:active { background: #334155; transform: scale(0.96); }
.mini-app-card .mini-icon { font-size: 1.8em; margin-bottom: 6px; }
.mini-app-card h4 { margin: 0; font-size: 0.85em; font-weight: 600; }

.item-card { background: var(--bg-sidebar); padding: 15px; border-radius: 15px; display: flex; flex-direction: column; gap: 6px; cursor: pointer;}
.item-card .icon { font-size: 1.6em; }
.item-card h4 { margin: 0; font-size: 1em; color: var(--text-main); }
.item-card p { margin: 0; font-size: 0.8em; color: var(--text-muted); }

/* ================= ZONUN-I PRO ================= */
body:has(#ai.active) .topbar, body:has(#ai.active) .bottom-nav { display: none !important; }
body:has(#ai.active) { padding: 0 !important; }

.gemini-workspace {
    display: flex; flex-direction: row; height: 100vh !important; max-width: 100% !important;
    background-color: var(--bg-main); color: var(--text-main); padding: 0 !important; margin: 0 !important; overflow: hidden;
}

/* Sidebar */
.gemini-sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 95; backdrop-filter: blur(4px); }
.gemini-sidebar {
    width: 290px; background-color: var(--bg-sidebar); display: flex; flex-direction: column;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border-color); z-index: 100; height: 100%;
}
.sidebar-top-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.sidebar-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.sparkle-logo { background: linear-gradient(135deg, #4285F4, #9B72CF, #EA4335); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 1.4em; }
.sidebar-mode-pills { display: flex; gap: 6px; padding: 0 16px 12px; }
.pill-btn { flex: 1; padding: 6px 10px; border-radius: 20px; border: 1px solid var(--border-color); background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer;}
.pill-btn.active { background: var(--accent-blue); color: #fff; border-color: transparent;}
.new-chat-btn { background-color: var(--bg-main); color: var(--text-main); border: 1px solid var(--border-color); border-radius: 20px; padding: 10px 18px; margin: 0 16px 12px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; cursor: pointer; transition: 0.2s;}

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 0 12px; }
.sidebar-item { padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; display: flex; align-items: center; gap: 10px; color: var(--text-main); transition: 0.15s;}
.sidebar-item:hover { background-color: var(--border-color); }
.sidebar-item-with-action { display: flex; justify-content: space-between; align-items: center; padding-right: 8px; }
.recent-menu-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; border-radius: 4px; z-index: 10;}
.recent-menu-btn:hover { color: var(--text-main); background: var(--border-color); }
.sidebar-divider { font-size: 11px; color: var(--text-muted); margin: 14px 12px 6px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }
.sidebar-bottom { padding: 12px 16px; border-top: 1px solid var(--border-color); }
.profile-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.profile-row img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover;}
.profile-info { flex: 1; display: flex; flex-direction: column; }
.profile-info b { font-size: 13.5px; }

/* Main Chat Area */
.gemini-main { flex: 1; display: flex; flex-direction: column; position: relative; height: 100%; }
.gemini-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; flex-shrink: 0; }
.gemini-icon-btn { background: transparent; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.gemini-icon-btn:hover { background-color: var(--border-color); color: var(--text-main); }
.model-selector { display: flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 600; cursor: pointer; padding: 6px 12px; border-radius: 8px; color: var(--text-main);}

/* Welcome Screen */
.welcome-screen { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; padding: 20px; pointer-events: none; z-index: 10; }
.sparkle-large { font-size: 50px; background: linear-gradient(135deg, #4285F4, #9B72CF, #EA4335); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 20px; animation: spinSparkle 2s linear infinite; }
.welcome-screen h2 { font-size: clamp(24px, 5vw, 32px); font-weight: 500; background: linear-gradient(90deg, var(--text-muted), var(--text-main), var(--text-muted)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.gemini-messages { flex: 1; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 24px; max-width: 800px; margin: 0 auto; width: 100%; scroll-behavior: smooth; z-index: 20;}

/* Bubbles */
.bubble.user { align-self: flex-end; background: var(--bg-bubble-user); padding: 12px 18px; border-radius: 20px 20px 4px 20px; color: var(--text-main); max-width: 85%; cursor: pointer; user-select: text; }
.bubble.bot { align-self: flex-start; padding: 4px 8px; max-width: 100%; width: 100%; }
.bubble-img { max-width: 200px; border-radius: 12px; margin-bottom: 8px; display: block; border: 1px solid var(--border-color);}

.markdown-body { line-height: 1.6; }
.markdown-body p { margin-bottom: 8px; }
.markdown-body pre { background: var(--bg-sidebar); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 10px 0; border: 1px solid var(--border-color);}
.markdown-body code { color: #38bdf8; font-family: monospace;}

.thinking-sparkle { display: inline-block; font-size: 24px; background: linear-gradient(135deg, #4285F4, #9B72CF, #EA4335); -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: spinSparkle 1.5s linear infinite; }
@keyframes spinSparkle { 0% { transform: scale(0.8) rotate(0deg); opacity: 0.5;} 50% { transform: scale(1.2) rotate(180deg); opacity: 1;} 100% { transform: scale(0.8) rotate(360deg); opacity: 0.5;} }

.answer-actions { display: flex; gap: 4px; margin-top: 10px; align-items: center; flex-wrap: wrap;}
.answer-action-icon { background: transparent; border: none; color: var(--text-muted); font-size: 1.1em; padding: 6px; border-radius: 50%; cursor: pointer; }
.answer-action-icon:hover { background: var(--border-color); color: var(--text-main); }
.source-box { margin-left: auto; font-size: 10px; color: var(--text-muted);}

/* NEW COMPOSER DESIGN (FIXED LAYOUT) */
.gemini-composer-container { padding: 10px 16px 16px; max-width: 820px; margin: 0 auto; width: 100%; flex-shrink: 0; z-index: 30;}
.gemini-composer {
    display: flex; flex-direction: column; background-color: var(--bg-composer);
    border-radius: 24px; border: 1px solid var(--border-color);
    padding: 8px 12px;
}
.gemini-composer:focus-within { border-color: rgba(255,255,255,0.2); }

/* Attachment Preview Inside Composer (Fixed) */
.attachment-preview { 
    display: flex; align-items: center; gap: 10px; 
    margin-bottom: 8px; padding-bottom: 8px; 
    border-bottom: 1px solid var(--border-color);
}
.attachment-preview img { width: 45px; height: 45px; border-radius: 8px; object-fit: cover;}
.attachment-info { flex: 1; font-size: 13px; color: var(--text-main); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500;}
.remove-attach-btn { background: var(--border-color); border: none; color: var(--text-main); font-size: 14px; cursor: pointer; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;}
.remove-attach-btn:hover { background: #ef4444; color: #fff;}

.composer-inputs { display: flex; align-items: flex-end; gap: 10px; width: 100%;}
.input-wrapper { flex: 1; position: relative; display: flex; align-items: center; background: transparent;}
#chatInput {
    width: 100%; background: transparent; border: none; color: var(--text-main);
    font-size: inherit; padding: 10px 0; min-height: 40px; max-height: 120px; outline: none; resize: none; font-family: inherit; overflow-y: auto; line-height: 1.4;
}
#chatInput::placeholder { color: var(--text-muted); }

/* Buttons inside Composer */
.add-btn { width: 40px; height: 40px; border-radius: 50%; border: none; background: transparent; color: var(--text-main); font-size: 26px; font-weight: 300; cursor: pointer; flex-shrink: 0; display: grid; place-items: center;}
.add-btn:hover { background-color: var(--border-color); }

/* Mic inside Input */
.mic-btn-inline { background: transparent; border: none; color: var(--text-muted); width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; border-radius: 50%; margin-bottom: 2px;}
.mic-btn-inline:hover { color: var(--text-main); }
.mic-btn-inline.listening { color: #ef4444; animation: pulse 1s infinite; }

/* Dynamic Action Button (Voice Toggle / Send) */
.dynamic-action-btn {
    width: 44px; height: 44px; border-radius: 50%; border: none; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: 0.2s; margin-left: 5px;
    background-color: var(--accent-blue); color: #fff; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.dynamic-action-btn.send-mode {
    background-color: var(--text-main); color: var(--bg-main); font-weight: bold; font-size: 20px; box-shadow: none;
}
.dynamic-action-btn:hover { transform: scale(1.05); }
.dynamic-action-btn:active { transform: scale(0.92); }
.dynamic-action-btn.muted { background-color: #334155; box-shadow: none;}

.chat-disclaimer { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 8px; }

/* Attachment Menu Popup */
.attach-wrapper { position: relative; }
.attach-menu { position: absolute; bottom: 120%; left: 0; background: var(--bg-sidebar); border: 1px solid var(--border-color); border-radius: 20px; padding: 16px; width: 280px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); z-index: 200; display: flex; flex-direction: column; gap: 16px; }
.attach-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; }
.attach-item { cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.attach-icon { width: 45px; height: 45px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; color: #fff;}
.attach-item span { font-size: 11px; color: var(--text-muted); }

/* Popup Menus */
.popup-menu-bottom { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-sidebar); border-top-left-radius: 20px; border-top-right-radius: 20px; padding: 16px 16px 30px; box-shadow: 0 -5px 25px rgba(0,0,0,0.8); z-index: 1000; display: flex; flex-direction: column; gap: 4px; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.popup-menu-bottom:not(.hidden) { transform: translateY(0); display: flex !important; }
.popup-menu-bottom .menu-header { text-align: center; width: 30px; height: 4px; background: var(--text-muted); border-radius: 4px; margin: 0 auto 16px; color: transparent; }
.popup-menu-bottom button { background: transparent; border: none; color: var(--text-main); padding: 14px; text-align: left; border-radius: 12px; font-size: 15px; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.popup-menu-bottom button:active { background: var(--border-color); }

/* Bottom Nav */
.bottom-nav { position: relative; z-index: 90; height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: var(--bg-sidebar); border-top: 1px solid var(--border-color); flex-shrink: 0; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-muted); text-decoration: none; }
.bottom-nav a.active { color: var(--accent-blue); }

.toast { position: fixed; z-index: 2000; left: 50%; bottom: 80px; transform: translate(-50%, 20px); background: var(--text-main); color: var(--bg-main); padding: 10px 20px; border-radius: 20px; font-size: 13px; opacity: 0; pointer-events: none; transition: 0.25s; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ================= GAMES UI ================= */
.fullscreen-game { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; z-index: 3000; display: flex; flex-direction: column; }
.game-topbar { padding: 16px; display: flex; justify-content: space-between; align-items: center; background: #111; color: #fff;}
.game-close-btn { background: #333; border: none; color: #fff; padding: 8px 16px; border-radius: 20px; cursor: pointer;}
.game-canvas-container { flex: 1; display: flex; justify-content: center; align-items: center; position: relative; background: #0a0a0a;}
canvas { background: #1e293b; border: 2px solid #3b82f6; border-radius: 8px; box-shadow: 0 0 20px rgba(59,130,246,0.3);}
.game-over { position: absolute; background: rgba(0,0,0,0.8); color: white; padding: 20px; border-radius: 12px; text-align: center; }
.game-over button { margin-top: 10px; padding: 10px 20px; background: #ef4444; border: none; color: white; border-radius: 8px; cursor: pointer;}
.mobile-controls { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px; background: #111; }
.control-row { display: flex; gap: 10px; }
.d-pad-btn { width: 60px; height: 60px; border-radius: 50%; background: #333; color: white; border: none; font-size: 24px; cursor: pointer; box-shadow: inset 0 -4px 0 rgba(0,0,0,0.5);}
.d-pad-btn:active { transform: translateY(4px); box-shadow: inset 0 0 0 rgba(0,0,0,0.5); background: #444;}

@media(max-width: 768px) {
    .gemini-sidebar { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-100%); }
    .gemini-sidebar.open { transform: translateX(0); box-shadow: 4px 0 25px rgba(0,0,0,0.7); }
}
