@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #0b0e11;
    --panel: #181a20;
    --border: #2b3139;
    --text-primary: #eaecef;
    --text-secondary: #848e9c;
    --green: #0ecb81;
    --red: #f6465d;
    --accent: #fcd535;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body { 
    background-color: var(--bg); 
    color: var(--text-primary); 
    min-height: 100vh; 
    overflow-x: hidden;
}

/* CONTAINER UTAMA (Desktop Grid) */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr 280px; 
    grid-template-rows: 60px 1fr 250px; 
    gap: 8px;
    padding: 8px;
    height: 100vh;
    max-width: 1920px;
    margin: 0 auto;
}

/* HEADER */
.header { 
    grid-column: 1 / -1; 
    background: var(--panel); 
    display: flex; align-items: center; 
    padding: 0 20px; border-radius: 6px;
    border: 1px solid var(--border);
}
.logo { font-weight: 800; font-size: 1.2rem; color: var(--accent); letter-spacing: 1px; }

/* PANEL UMUM */
.panel { 
    background: var(--panel); 
    padding: 16px; 
    border: 1px solid var(--border); 
    border-radius: 6px;
    display: flex; flex-direction: column;
}
h3 { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 12px; font-weight: 600; text-transform: uppercase; }

/* GRAFIK (TENGAH) */
.market-view { grid-column: 2; grid-row: 2; }
.ticker-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 15px; }
.big-price { font-size: 2rem; font-weight: 700; line-height: 1; }
.price-change { font-size: 1rem; font-weight: 500; }
#chartContainer { flex-grow: 1; position: relative; width: 100%; min-height: 0; }

/* PORTFOLIO (KIRI) */
.portfolio { grid-column: 1; grid-row: 2 / -1; gap: 12px; }
.balance-card { background: rgba(255,255,255,0.03); padding: 12px; border-radius: 6px; }
.balance-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 4px; }
.balance-val { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); }

/* FORM ORDER (KANAN) */
.order-form { grid-column: 3; grid-row: 2 / -1; gap: 15px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group input { 
    width: 100%; background: var(--bg); border: 1px solid var(--border); 
    padding: 12px 50px 12px 60px; /* Space untuk label & tombol MAX */
    color: white; border-radius: 4px; outline: none; text-align: right; font-size: 1rem;
}
.input-group input:focus { border-color: var(--accent); }
.input-group label { 
    position: absolute; left: 12px; color: var(--text-secondary); 
    font-size: 0.8rem; font-weight: 600; pointer-events: none;
}

/* TOMBOL MAX */
.btn-max {
    position: absolute; right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 0.7rem; font-weight: bold;
    padding: 4px 8px; border-radius: 4px;
    cursor: pointer; transition: 0.2s; z-index: 5;
}
.btn-max:hover { background: var(--accent); color: black; }

.btn { width: 100%; padding: 14px; border: none; border-radius: 4px; font-weight: 600; cursor: pointer; color: white; margin-top: 8px; font-size: 0.9rem; transition: 0.2s; }
.btn:active { transform: scale(0.98); }
.btn-buy { background: var(--green); }
.btn-sell { background: var(--red); }

/* HISTORY (BAWAH) */
.history-panel { grid-column: 2; grid-row: 3; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th { text-align: left; color: var(--text-secondary); padding: 8px; position: sticky; top: 0; background: var(--panel); z-index: 2; }
td { padding: 8px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.badge { padding: 3px 6px; border-radius: 3px; font-size: 0.7rem; font-weight: 700; }
.badge-buy { color: var(--green); background: rgba(14, 203, 129, 0.15); }
.badge-sell { color: var(--red); background: rgba(246, 70, 93, 0.15); }

/* MOBILE RESPONSIVE FIX */
@media (max-width: 992px) {
    .app-container {
        display: flex; flex-direction: column; height: auto; padding: 10px; gap: 15px;
    }
    .header { order: 0; padding: 15px; }
    .market-view { order: 1; min-height: 400px; }
    .order-form { order: 2; }
    .portfolio { order: 3; }
    .history-panel { order: 4; min-height: 300px; }
    #chartContainer { height: 300px; min-height: 300px; }
    .ticker-header { align-items: center; }
    .big-price { font-size: 1.8rem; }
}
