/* --- TEMA MAGICAL BLUE (INSPIRED BY SCREENSHOT) --- */
:root {
    /* Background tetap Dark Mode sesuai request */
    --bg-main: #1a202c; 
    --bg-gradient: linear-gradient(180deg, #121621 0%, #1a202c 100%);
    
    /* Panel Glass dengan tint biru */
    --glass-panel: rgba(44, 62, 80, 0.4);
    --glass-border: 1px solid rgba(168, 216, 234, 0.15);
    
    --text-primary: #ffffff; 
    --text-secondary: #a8d8ea; /* Biru pastel muda */
    
    /* Warna Bubble Bot: Dark Slate Blue */
    --bubble-bot: #2c3e50; 
    
    /* Warna Utama (Tombol & Bubble User) */
    --bubble-user: #34638a; 
    --bubble-user-gradient: linear-gradient(135deg, #34638a 0%, #254b6e 100%);
    --bubble-user-chat: #254b6e; 
    
    /* Accent: Biru Pastel Cerah */
    --accent: #5dade2; 
    
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Quicksand', sans-serif; -webkit-tap-highlight-color: transparent; }
.material-icons, button, .menu-list li, .settings-btn, .persona-item, .header-left, .close-btn, .close-modal-btn { user-select: none; -webkit-user-select: none; }

body { background: var(--bg-main); height: 100dvh; width: 100vw; display: flex; justify-content: center; overflow: hidden; }
.app-container { width: 100%; max-width: 500px; height: 100%; background: var(--bg-gradient); display: flex; flex-direction: column; position: relative; box-shadow: var(--shadow); z-index: 10; }

/* --- BACKGROUND LANGIT MALAM --- */
#star-background {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
    z-index: 0; overflow: hidden; pointer-events: none;
}
.star-twinkle {
    position: absolute; background: white; border-radius: 50%; opacity: 0.8;
    animation: twinkle ease-in-out infinite; box-shadow: 0 0 5px rgba(255, 255, 224, 0.8);
}
@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); box-shadow: 0 0 8px rgba(255, 215, 0, 0.8); }
}

/* --- LANDING PAGE --- */
.landing-container { position: absolute; top:0; left:0; width:100%; height:100%; z-index: 9000; display: flex; align-items: center; justify-content: center; flex-direction: column; background: transparent; }
.landing-content { text-align: center; padding: 30px; width: 100%; max-width: 400px; animation: popIn 0.6s ease; }
.landing-avatar { width: 120px; height: 120px; border-radius: 50%; border: 4px solid var(--accent); overflow: hidden; margin: 0 auto 20px auto; box-shadow: 0 0 25px rgba(93, 173, 226, 0.4); transition: transform 0.3s; }
.landing-avatar:hover { transform: scale(1.05) rotate(5deg); }
.landing-avatar img { width: 100%; height: 100%; object-fit: cover; }
.landing-content h1 { font-size: 28px; color: white; margin-bottom: 5px; text-shadow: 0 0 10px rgba(93, 173, 226, 0.5); font-weight: 700; }
.subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 15px; font-weight: 600; }

/* ABOUT SECTION LANDING (TYPING EFFECT) */
.about-section { background: rgba(52, 99, 138, 0.2); backdrop-filter: blur(5px); padding: 20px; border-radius: 20px; margin-bottom: 30px; border: 1px solid rgba(168, 216, 234, 0.2); box-shadow: 0 4px 15px rgba(0,0,0,0.2); min-height: 80px; display: flex; align-items: center; justify-content: center; }
.about-section p { color: #e1e8ed; font-size: 13px; line-height: 1.6; text-align: center; width: 100%; }
.cursor-blink { display: inline-block; width: 2px; height: 14px; background-color: var(--accent); animation: blink 1s infinite; vertical-align: middle; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* --- PREMIUM BUTTON STYLES (Detailed Animation) --- */
.enter-btn, .link-btn, .generate-btn, .dl-btn, .sidebar-action-btn, .promo-btn { 
    background: var(--bubble-user-gradient); 
    color: white; border: none; border-radius: 50px; 
    font-size: 15px; font-weight: bold; cursor: pointer; 
    box-shadow: 0 4px 15px rgba(52, 99, 138, 0.3); 
    display: flex; align-items: center; justify-content: center; gap: 10px; 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 15px 40px; margin: 0 auto; text-decoration: none;
    position: relative; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Shine Effect Animation */
.enter-btn::after, .link-btn::after, .generate-btn::after, .dl-btn::after, .sidebar-action-btn::after, .promo-btn::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent); transition: 0.5s;
}

/* Hover State */
.enter-btn:hover, .link-btn:hover, .generate-btn:hover, .dl-btn:hover, .sidebar-action-btn:hover, .promo-btn:hover {
    transform: translateY(-3px); box-shadow: 0 8px 25px rgba(93, 173, 226, 0.5); 
    background: linear-gradient(135deg, #3e75a3 0%, #2f5d85 100%);
}
.enter-btn:hover::after, .link-btn:hover::after, .generate-btn:hover::after, .dl-btn:hover::after, .sidebar-action-btn:hover::after, .promo-btn:hover::after { left: 100%; }

/* Click/Active State (Bouncy) */
.enter-btn:active, .link-btn:active, .generate-btn:active, .dl-btn:active, .sidebar-action-btn:active, .promo-btn:active { 
    transform: scale(0.95) translateY(0); box-shadow: 0 2px 10px rgba(52, 99, 138, 0.2);
}

.landing-links { display: flex; gap: 15px; justify-content: center; margin-top: 25px; width: 100%; box-sizing: border-box; }
.link-btn { flex: 1; padding: 12px 10px; white-space: nowrap; font-size: 13px; }

/* LOADING SCREEN */
.loading-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #121621; z-index: 9500;
    display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.loading-content-box { text-align: center; color: white; width: 80%; max-width: 300px; }
.progress-bar-container { width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 10px; margin-top: 15px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); width: 0%; box-shadow: 0 0 15px var(--accent); }

/* HEADER & CHAT */
.chat-header { flex: 0 0 70px; background: rgba(26, 32, 44, 0.95); backdrop-filter: blur(12px); border-bottom: var(--glass-border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; z-index: 50; }
.header-left { display: flex; align-items: center; gap: 15px; flex: 1; }
.hamburger { color: var(--text-secondary); font-size: 28px; cursor: pointer; padding: 10px; margin-left: -10px; transition: 0.2s; }
.hamburger:hover { color: white; }

/* FIX ICON PROFIL HEADER (BULAT SEMPURNA) */
.avatar-container { 
    width: 42px; height: 42px; 
    border-radius: 50% !important; 
    border: 2px solid var(--accent); overflow: hidden; 
    box-shadow: 0 0 12px rgba(93, 173, 226, 0.4); 
    margin-left: auto; display: flex; align-items: center; justify-content: center; 
}
.avatar-container img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.chat-info h3 { color: var(--text-primary); font-size: 17px; margin-bottom: 2px; }
.chat-info p { color: var(--accent); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.chat-info p::before { content:''; width:8px; height:8px; background:var(--accent); border-radius:50%; box-shadow: 0 0 8px var(--accent); }

.chat-background { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.message { max-width: 85%; display: flex; flex-direction: column; animation: popIn 0.3s ease-out; }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.message.bot { align-self: flex-start; align-items: flex-start; }
.message.user { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 12px 16px; border-radius: 18px; font-size: 15px; line-height: 1.5; position: relative; color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); width: fit-content; word-wrap: break-word; word-break: break-word; }
.message.bot .bubble { background: var(--bubble-bot); border-bottom-left-radius: 4px; color: #e2e8f0; border: 1px solid rgba(255,255,255,0.05); }
.message.user .bubble { background: var(--bubble-user-chat); border: 1px solid rgba(168, 216, 234, 0.2); border-bottom-right-radius: 4px; color: #ffffff; }
.time { font-size: 10px; opacity: 0.7; text-align: right; margin-top: 5px; display: block; color: var(--text-secondary); margin-right: 5px; }
.bubble.loading { padding: 15px 20px !important; background: var(--bubble-bot) !important; display: flex; align-items: center; justify-content: center; width: fit-content; }
.typing { display: flex; gap: 5px; }
.typing span { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; animation: blink 1.4s infinite both; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

/* INPUT AREA */
.chat-input-area { 
    flex: 0 0 auto; background: var(--bg-main); padding: 10px 15px; 
    display: flex; align-items: center; gap: 12px; border-top: var(--glass-border); 
    z-index: 100; position: relative; padding-bottom: env(safe-area-inset-bottom, 10px);
}
.settings-btn { color: var(--text-secondary); font-size: 34px; cursor: pointer; padding: 5px; border-radius: 50%; transition: 0.2s; display: flex; align-items: center; justify-content: center; margin: 0; }
.settings-btn:hover { color: var(--accent); transform: rotate(45deg); }
.input-wrapper { flex: 1; background: var(--bubble-bot); border-radius: 25px; padding: 10px 18px; display: flex; align-items: center; border: 1px solid rgba(255,255,255,0.1); min-height: 48px; max-height: 120px; overflow-y: auto; transition: 0.3s; }
.input-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 0 10px rgba(93, 173, 226, 0.2); }
.input-wrapper textarea { width: 100%; background: transparent; border: none; outline: none; color: white; font-size: 15px; resize: none; padding: 0; margin: 0; line-height: 1.4; height: 24px; }
.send-btn { 
    width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; border: none; 
    background: var(--bubble-user-gradient); color: white; display: flex; align-items: center; justify-content: center; 
    cursor: pointer; box-shadow: 0 4px 15px rgba(52, 99, 138, 0.4); transition: 0.3s; margin: 0; 
}
.send-btn:hover { transform: scale(1.1) rotate(-10deg); box-shadow: 0 6px 20px rgba(93, 173, 226, 0.6); }
.send-btn:active { transform: scale(0.9); }

/* TOOLS & DASHBOARD */
.view-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.tools-container { flex: 1; padding: 20px; padding-bottom: 150px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; transition: 0.3s; }
.image-preview-box { display: none; width: 100%; min-height: 250px; height: auto; background: rgba(0,0,0,0.3); border-radius: 20px; border: 2px dashed rgba(168, 216, 234, 0.3); align-items: center; justify-content: center; position: relative; overflow: hidden; margin-bottom: 10px; flex-direction: column; padding: 20px; transition: border 0.3s; }
.image-preview-box:hover { border-color: var(--accent); }
.image-preview-box img { width: 100%; height: auto; max-height: 70vh; object-fit: contain; border-radius: 18px; display: block; }
.placeholder-upload { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-secondary); height: 100%; width: 100%; cursor: pointer; padding: 20px; }
.placeholder-upload i { font-size: 35px; margin-bottom: 10px; opacity: 0.6; color: var(--accent); }
.download-overlay { display: none; position: absolute; bottom: 15px; right: 15px; width: 50px; height: 50px; background: rgba(30, 41, 59, 0.85); backdrop-filter: blur(5px); border-radius: 15px; align-items: center; justify-content: center; color: white; font-size: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); cursor: pointer; z-index: 20; transition: 0.3s; text-decoration: none; border: 1px solid rgba(255,255,255,0.2); }
.download-overlay:hover { background: var(--bubble-user); transform: scale(1.1); }
.tools-panel { background: var(--glass-panel); border: var(--glass-border); padding: 20px; border-radius: 20px; display: flex; flex-direction: column; gap: 15px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.input-group label, .setting-item label { display: block; color: var(--text-secondary); font-size: 12px; font-weight: 700; margin-bottom: 8px; letter-spacing: 0.5px; }
textarea#img-prompt, textarea#dl-url, textarea#tts-text { width: 100%; height: 90px; background: var(--bubble-bot); border: 1px solid rgba(255,255,255,0.1); border-radius: 15px; padding: 15px; color: white; outline: none; resize: none; font-size: 14px; font-family: 'Quicksand', sans-serif; transition: 0.3s; }
textarea#img-prompt:focus, textarea#dl-url:focus, textarea#tts-text:focus { border-color: var(--accent); background: rgba(44, 62, 80, 0.8); box-shadow: 0 0 10px rgba(93, 173, 226, 0.1); }
.settings-row { display: flex; gap: 15px; }
.setting-item { flex: 1; }
select { width: 100%; padding: 12px; background: var(--bubble-bot); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; color: white; outline: none; appearance: none; font-size: 13px; transition: 0.3s; }
select:focus { border-color: var(--accent); }
.generate-btn { width: 100%; font-size: 16px; margin-top: 10px; }

/* DASHBOARD STYLES */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 10px; }
.stat-card { background: var(--glass-panel); border: var(--glass-border); border-radius: 20px; padding: 15px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.stat-value { font-size: 16px; font-weight: bold; color: white; margin: 5px 0; font-family: monospace; }
.stat-label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }

h4#dl-title { color: white; font-size: 14px; margin-bottom: 20px; display: block; line-height: 1.5; word-wrap: break-word; }
.dl-btn-grid { display: flex; gap: 10px; justify-content: center; width: 100%; flex-wrap: wrap; }
.dl-btn { flex: 1; min-width: 120px; padding: 12px; font-size: 14px; }

/* SIDEBAR & MODAL */
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(5px); z-index: 998; opacity: 0; visibility: hidden; transition: 0.3s; }
.overlay.active { opacity: 1; visibility: visible; }
.sidebar { position: fixed; top: 0; left: -280px; width: 260px; height: 100%; background: #151b26; z-index: 1000; transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); border-right: 1px solid rgba(168, 216, 234, 0.1); box-shadow: 5px 0 25px rgba(0,0,0,0.5); }
.sidebar.open { left: 0; }
.sidebar-header { padding: 25px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.05); color: var(--accent); }
.menu-list { padding: 15px; list-style: none; }
.menu-list.menu-border { border-top: 1px solid rgba(255, 255, 255, 0.05); border-bottom: 1px solid rgba(255, 255, 255, 0.05); margin: 10px 0; padding: 20px 15px; }

/* FIX MENU BULAT (PILL SHAPE) */
.menu-list li { 
    padding: 15px; margin-bottom: 8px; color: #b0c4de; 
    display: flex; align-items: center; gap: 15px; 
    border-radius: 50px; /* BORDER MENU JADI BULAT */
    cursor: pointer; font-weight: 500; transition: 0.2s; line-height: 1.2; 
}
.menu-list li i { font-size: 18px; color: #5d7fa3; transition: 0.2s; }
.menu-list li:hover { background: rgba(255,255,255,0.05); color: white; }
.menu-list li:hover i { color: var(--accent); }
.menu-list li.active { background: rgba(52, 99, 138, 0.2); color: var(--accent); border: 1px solid rgba(168, 216, 234, 0.2); }
.menu-list li.active i { color: var(--accent); }

.sidebar-footer { padding: 0 15px 20px 15px; display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.sidebar-action-btn { 
    width: 100%; padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.03); 
    border: 1px solid rgba(255,255,255,0.1); color: var(--text-secondary); 
    display: flex; align-items: center; justify-content: center; gap: 10px; 
    text-decoration: none; font-weight: 600; font-size: 14px; cursor: pointer; transition: 0.2s; box-shadow: none;
}
.sidebar-action-btn:hover { background: rgba(255,255,255,0.1); color: white; border-color: var(--accent); transform: translateY(-2px); }
.sidebar-action-btn.special { background: linear-gradient(90deg, #ff7675, #d63031); color: white; border: none; }

.modal-settings { position: fixed; bottom: 0; left: 0; width: 100%; background: #1a202c; color: white; border-top-left-radius: 25px; border-top-right-radius: 25px; padding: 30px; z-index: 2000; transform: translateY(110%); transition: 0.3s; box-shadow: 0 -10px 40px rgba(0,0,0,0.5); display: flex; flex-direction: column; border-top: 1px solid rgba(168, 216, 234, 0.2); }
.modal-settings.active { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; margin-bottom: 25px; align-items: center; flex-shrink: 0; }
.modal-body { overflow-y: auto; max-height: 60vh; padding-bottom: 20px; } 
.persona-options { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.persona-item { background: rgba(255,255,255,0.05); padding: 15px; border-radius: 15px; text-align: center; border: 1px solid transparent; cursor: pointer; display: flex; flex-direction: column; gap: 8px; align-items: center; transition: 0.2s; }
.persona-item:hover { background: rgba(255,255,255,0.08); transform: translateY(-2px); }
.persona-item.active { border-color: var(--accent); background: rgba(93, 173, 226, 0.15); color: var(--accent); box-shadow: 0 4px 15px rgba(93, 173, 226, 0.15); }

/* SPINNER & MODALS */
.global-loader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(18, 22, 33, 0.9); backdrop-filter: blur(8px); z-index: 9999; display: none; align-items: center; justify-content: center; flex-direction: column; animation: fadeIn 0.3s ease; }
.global-loader.active { display: flex; }
.loader-content { text-align: center; color: white; background: transparent; position: relative; }
.loader-content p { font-size: 16px; font-weight: 600; margin-top: 20px; letter-spacing: 0.5px; color: var(--accent); }
.spinner-container { position: relative; width: 80px; height: 80px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.spinner-ring { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; border: 5px solid rgba(255, 255, 255, 0.1); border-top-color: var(--accent); border-left-color: var(--bubble-user); animation: spinRing 1s linear infinite; box-shadow: 0 0 15px rgba(93, 173, 226, 0.2); }
.spinner-text { color: white; font-size: 16px; font-weight: 700; font-family: monospace; z-index: 2; }
@keyframes spinRing { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.custom-alert-box { background: rgba(26, 32, 44, 0.95); border: 1px solid rgba(168, 216, 234, 0.3); border-radius: 20px; padding: 30px; width: 80%; max-width: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; box-shadow: 0 10px 40px rgba(0,0,0,0.5); animation: popIn 0.3s ease; text-align: center; }
.support-box { background: rgba(30, 41, 59, 0.95); border-radius: 25px; padding: 30px; width: 85%; max-width: 350px; text-align: center; color: white; border: 1px solid rgba(255,255,255,0.1); animation: popIn 0.3s ease; }
.support-box h3 { margin: 10px 0; color: #ff7675; }
.support-box p { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }
.bank-info { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.bank-item { background: rgba(255,255,255,0.05); padding: 12px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.bank-label { color: var(--accent); font-weight: bold; }
.bank-number { font-family: monospace; color: white; background: rgba(0,0,0,0.2); padding: 4px 8px; border-radius: 5px; }

.promo-box { background: #1a1f29; width: 85%; max-width: 340px; border-radius: 20px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.6); animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); border: 1px solid rgba(255,255,255,0.1); }
.promo-header { background: linear-gradient(90deg, #25D366, #128C7E); padding: 15px; color: white; font-weight: bold; display: flex; align-items: center; gap: 10px; }
.promo-body { padding: 25px; text-align: center; color: white; }
.promo-body h3 { font-size: 20px; margin-bottom: 10px; }
.promo-body p { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; line-height: 1.5; }
.promo-list { text-align: left; list-style: none; margin-bottom: 25px; font-size: 14px; color: #dcdde1; }
.promo-list li { margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.promo-list i { color: #25D366; }
.promo-btn { display: block; background: #25D366; color: white; padding: 12px; border-radius: 50px; text-decoration: none; font-weight: bold; transition: 0.2s; box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3); }
.promo-btn:hover { background: #128C7E; transform: scale(1.02); box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5); }
.promo-close { padding: 15px; text-align: center; color: var(--text-secondary); font-size: 12px; cursor: pointer; border-top: 1px solid rgba(255,255,255,0.05); transition: 0.2s; }
.promo-close:hover { color: white; background: rgba(255,255,255,0.05); }
