/* --- PREMIUM DESIGN SYSTEM (Monochrome & Dark Mode) --- */
:root {
    --bg-body: #000000;
    --bg-panel: #0a0a0a;
    --border: #333333;
    --border-active: #666666;
    --text-main: #ffffff;
    --text-muted: #888888;
    --accent: #ffffff;
    --radius: 8px;
    --danger: #ef4444;
}

* { box-sizing: border-box; outline: none; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column; /* Layout Atas-Bawah (Header - Body) */
    overflow: hidden;
}

/* --- CUSTOM SCROLLBAR (Elegan & Tipis) --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; border: 1px solid #000; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* --- HEADER GLOBAL --- */
.app-header {
    width: 100%; padding: 20px 0; border-bottom: 1px solid var(--border);
    background: var(--bg-body); display: flex; flex-direction: column;
    align-items: center; justify-content: center; flex-shrink: 0; z-index: 10; position: relative;
}
.header-badge { font-size: 0.6rem; background: #111; border: 1px solid #333; color: #10b981; padding: 4px 12px; border-radius: 20px; margin-bottom: 10px; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.header-title { font-size: 1.8rem; font-weight: 800; letter-spacing: -1px; margin: 0; background: linear-gradient(135deg, #ffffff 0%, #777777 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-transform: uppercase; }
.header-subtitle { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; letter-spacing: 2px; margin-top: 5px; }

/* Tombol Gear (Settings) di Header */
.btn-settings-trigger { position: absolute; right: 30px; top: 30px; background: transparent; border: 1px solid #333; color: #666; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-settings-trigger:hover { border-color: #fff; color: #fff; }

/* --- LAYOUT UTAMA (Wrapper) --- */
.layout-wrapper { display: flex; flex: 1; overflow: hidden; width: 100%; }
.sidebar { width: 420px; background: var(--bg-panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 0; overflow-y: auto; flex-shrink: 0; }
.sidebar-content { padding: 30px; padding-top: 20px; }
.workspace { flex: 1; display: flex; flex-direction: row; overflow: hidden; height: 100%; }

/* --- COMPONENTS: VISUAL SLOTS --- */
.section-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 1.5px; margin: 0 0 12px 0; display: block; }
.slots-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 30px; }

.img-slot { height: 90px; background: #111; border: 1px dashed var(--border-active); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; overflow: hidden; transition: 0.2s; }
.img-slot:hover { background: #1a1a1a; border-color: #fff; }
.img-slot.active { border: 1px solid #fff; background: #1a1a1a; box-shadow: 0 0 15px rgba(255,255,255,0.05); }

.slot-label { font-size: 0.6rem; color: var(--text-muted); z-index: 2; font-weight: 700; margin-top: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.slot-icon { font-size: 1.2rem; color: var(--border-active); z-index: 2; margin-bottom: 2px; }
.slot-img-preview { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; filter: brightness(0.6); }

/* Tombol Hapus Gambar (X) */
.slot-remove { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.8); color: var(--danger); border: none; border-radius: 4px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; font-size: 12px; opacity: 0; transition: 0.2s; }
.img-slot:hover .slot-remove { opacity: 1; }

/* --- COMPONENTS: GALLERY --- */
.gallery-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.btn-upload-trigger { width: fit-content; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; margin: 0; font-size: 0.7rem; height: 28px; text-transform: none; letter-spacing: 0.5px; border-radius: 4px; background: rgba(255,255,255,0.05); cursor: pointer; border: 1px solid var(--border-active); color: var(--text-muted); }
.btn-upload-trigger:hover { border-color: #fff; color: #fff; }

.gallery-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-height: 130px; min-height: 100px; overflow-y: auto; padding: 8px; background: #050505; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 30px; }
.asset-thumb { width: 100%; height: 45px; object-fit: cover; border-radius: 4px; cursor: pointer; opacity: 0.5; transition: 0.2s; border: 1px solid transparent; }
.asset-thumb:hover { opacity: 1; border-color: #fff; transform: scale(1.05); }

/* --- COMPONENTS: INPUTS & DROPDOWN --- */
.input-dark { width: 100%; background: #050505; border: 1px solid var(--border); color: var(--text-main); padding: 15px; border-radius: var(--radius); font-family: 'Inter', sans-serif; font-size: 0.9rem; margin-bottom: 15px; transition: 0.2s; }
.input-dark:focus { border-color: #666; background: #000; }
textarea.input-dark { min-height: 180px; line-height: 1.6; resize: vertical; }

/* Custom Dropdown Arrow */
select.input-dark { appearance: none; -webkit-appearance: none; -moz-appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 15px center; background-size: 16px; padding-right: 40px; cursor: pointer; background-color: #050505; }
select.input-dark option { background-color: #000; color: #fff; padding: 10px; }

/* --- BUTTONS --- */
.btn { width: 100%; padding: 14px; border: none; border-radius: var(--radius); font-weight: 700; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; transition: all 0.2s ease; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.5px; position: relative; overflow: hidden; }
.btn-primary { background: var(--text-main); color: #000; box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1); font-weight: 800; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 255, 255, 0.25); opacity: 0.9; }
.btn-outline { background: transparent; border: 1px solid var(--border-active); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--text-main); color: var(--text-main); background: rgba(255,255,255,0.05); }
.btn-sm { width: auto; padding: 8px 16px; font-size: 0.7rem; letter-spacing: 1px; height: 32px; }

/* --- WORKSPACE PANES --- */
.pane-code { flex: 1; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: #050505; min-width: 300px; }
.pane-preview { flex: 1; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; background-image: radial-gradient(#1a1a1a 1px, transparent 1px); background-size: 20px 20px; min-width: 350px; }
.pane-header { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg-panel); }
.pane-title { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* Prompt & Code Areas */
.prompt-area { height: 35%; padding: 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; }
.prompt-box { flex: 1; background: #080808; border: none; color: #a1a1aa; font-family: 'JetBrains Mono', monospace; padding: 20px; font-size: 0.8rem; white-space: pre-wrap; overflow-y: auto; resize: none; line-height: 1.5; }
.code-area { flex: 1; padding: 0; display: flex; flex-direction: column; }
#codeEditor { flex: 1; background: #0c0c0c; border: none; color: #d4d4d4; padding: 20px; font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; resize: none; line-height: 1.5; }

/* Preview Frame */
.preview-label { margin-bottom: 10px; color: var(--text-muted); font-size: 0.7rem; letter-spacing: 1px; }
.mobile-frame { width: 360px; height: 100%; max-height: 720px; background: white; border-radius: 20px; border: 8px solid #222; overflow: hidden; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
iframe { width: 100%; height: 100%; border: none; background: #1a1a1a; }

/* --- MODALS (QUICK FIX & SETTINGS) --- */
.qf-modal, .settings-modal { position: absolute; background: #151515; border: 1px solid #444; padding: 20px; border-radius: var(--radius); box-shadow: 0 20px 50px rgba(0,0,0,0.8); z-index: 100; display: none; flex-direction: column; }

/* Quick Fix Specific */
.qf-modal { top: 70px; left: 20px; right: 20px; gap: 15px; animation: slideDown 0.2s ease-out; }
.qf-row { display: flex; flex-direction: column; gap: 5px; }
.qf-input-group { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.qf-label-text { font-size: 0.65rem; color: #888; font-weight: 600; letter-spacing: 0.5px; }
.qf-input { width: 100%; background: #000; border: 1px solid #333; color: #fff; padding: 12px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; transition: border-color 0.2s; }
.qf-input:focus { border-color: #fff; }
.qf-arrow { display: flex; justify-content: center; align-items: center; padding: 5px 0; color: #555; font-size: 1.2rem; }
.qf-btn-action { width: 100%; background: #fff; color: #000; border: none; padding: 14px; border-radius: var(--radius); font-weight: 800; cursor: pointer; text-transform: uppercase; letter-spacing: 1.5px; font-size: 0.8rem; margin-top: 10px; transition: all 0.2s ease; box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1); }
.qf-btn-action:hover { opacity: 0.9; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 255, 255, 0.25); }

/* Settings Specific */
.settings-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 400px; z-index: 2000; gap: 20px; }
.set-group { display: flex; flex-direction: column; gap: 8px; }
.set-label { font-size: 0.7rem; color: #888; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.set-input { background: #000; border: 1px solid #333; color: #fff; padding: 12px; border-radius: 4px; font-family: 'Inter', sans-serif; }
.set-divider { height: 1px; background: #222; width: 100%; margin: 5px 0; }

/* Modal General & Overlay */
.qf-modal.active, .settings-modal.active { display: flex; }
.overlay-bg { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 1999; display: none; backdrop-filter: blur(2px); }
.overlay-bg.active { display: block; }
.modal-title { font-size: 0.75rem; font-weight: 700; color: #fff; letter-spacing: 1px; text-transform: uppercase; }
.qf-btn-close { background: transparent; border: 1px solid #333; color: #888; width: 30px; height: 30px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qf-btn-close:hover { border-color: var(--danger); color: var(--danger); }

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* --- TOAST NOTIFICATION --- */
#toastBox { position: fixed; bottom: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #fff; color: #000; padding: 12px 24px; border-radius: 4px; font-weight: 600; box-shadow: 0 5px 15px rgba(0,0,0,0.3); animation: fadeUp 0.3s; font-size: 0.85rem; }
@keyframes fadeUp { from{opacity:0; transform:translateY(10px);} to{opacity:1; transform:translateY(0);} }