@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    --bg-dark: #0f172a;     
    --card-bg: rgba(30, 41, 59, 0.7); 
    --border: rgba(255, 255, 255, 0.1);
    --gold: #fbbf24;
    --red: #ef4444;
    --green: #4ade80;
    --white: #ffffff;
    --dim: #94a3b8;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }

body {
    font-family: 'Poppins', sans-serif;
    margin: 0; padding: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    color: var(--white);
    font-size: 13px;
    display: flex; justify-content: center;
    user-select: none;
}

/* CONTAINER */
.app-container {
    width: 100%; max-width: 500px; min-height: 100vh;
    padding-bottom: 100px;
    background: transparent;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

/* HEADER (UPDATED FOR LOGOUT) */
.glass-header {
    padding: 15px 20px; 
    display: flex; align-items: center; justify-content: space-between; /* Kiri Kanan Pisah */
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark); 
    position: sticky; top: 0; z-index: 50;
}
/* Group Logo & Text Kiri */
.header-left { display: flex; align-items: center; gap: 12px; }

.logo-circle { 
    width: 38px; height: 38px; background: #fff; 
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--gold);
}
.logo-circle img { width: 18px; }
.brand-text h1 { margin: 0; font-size: 0.9rem; font-weight: 700; letter-spacing: 0.5px; line-height: 1.2; }
.brand-text span { font-size: 0.65rem; color: var(--gold); display: block; }

/* TOMBOL LOGOUT MERAH */
.btn-logout {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red);
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s;
}
.btn-logout:active { transform: scale(0.9); background: rgba(239, 68, 68, 0.3); }
.btn-logout svg { width: 18px; height: 18px; }

main { padding: 15px; }

/* KARTU KACA */
.glass-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 15px;
}

/* DASHBOARD STATS */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.stat-card { text-align: center; padding: 15px 10px; }
.stat-card small { display: block; font-size: 0.7rem; color: var(--dim); text-transform: uppercase; margin-bottom: 5px; }
.stat-card h3 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card.danger h3 { color: var(--red); text-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }
.stat-card.success h3 { color: var(--green); text-shadow: 0 0 10px rgba(74, 222, 128, 0.3); }

/* SEARCH */
.search-wrapper { position: relative; margin-bottom: 20px; }
.search-wrapper input {
    width: 100%; padding: 12px 15px 12px 40px;
    border-radius: 50px; border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3); color: #fff; font-size: 0.9rem;
}
.search-wrapper svg { position: absolute; left: 15px; top: 12px; width: 18px; color: var(--dim); }

/* LIST ITEM */
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 0 5px; }
.section-title h4 { margin: 0; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); }
.section-title span { font-size: 0.7rem; background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 6px; }

.order-item { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; cursor: pointer; padding: 12px; }
.gi-date {
    background: rgba(255,255,255,0.05); width: 40px; height: 40px; border-radius: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 1px solid var(--border);
}
.gi-date b { font-size: 1rem; line-height: 1; font-weight: 700; }
.gi-date span { font-size: 0.6rem; color: var(--gold); margin-top: 2px; }

.gi-info { flex: 1; min-width: 0; }
.gi-name { font-size: 0.9rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gi-menu { font-size: 0.7rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.glass-tag { font-size: 0.6rem; background: rgba(56, 189, 248, 0.2); color: #38bdf8; padding: 1px 5px; border-radius: 4px; margin-left: 5px; vertical-align: middle; }

.gi-meta { text-align: right; }
.gi-price { font-size: 0.85rem; font-weight: 700; color: var(--gold); display: block; margin-bottom: 4px; }
.gi-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-success { background: var(--green); box-shadow: 0 0 5px var(--green); }
.dot-danger { background: var(--red); box-shadow: 0 0 5px var(--red); }

/* FORM & INPUT */
.form-title { text-align: center; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 15px; }
.form-title h2 { margin: 0; font-size: 1.1rem; color: var(--gold); }

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 0.7rem; color: var(--dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 12px; background: rgba(0,0,0,0.3); 
    border: 1px solid var(--border); border-radius: 10px; 
    color: #fff; font-family: inherit; font-size: 0.9rem;
}
.field input:focus { border-color: var(--gold); }

.calc-box { 
    background: rgba(251, 191, 36, 0.05); border-radius: 12px; padding: 15px; 
    border: 1px dashed rgba(251, 191, 36, 0.3); margin-bottom: 20px; 
}
.total-row { display: flex; justify-content: space-between; margin-bottom: 10px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.total-row strong { font-size: 1.2rem; color: var(--gold); }
.sisa-text { text-align: right; font-weight: 700; font-size: 0.95rem; margin-top: 10px; }

/* BUTTONS */
.btn-glass { width: 100%; padding: 14px; border-radius: 10px; border: none; font-weight: 600; cursor: pointer; color: #fff; font-size: 0.9rem; margin-top: 5px; }
.btn-glass.primary { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); }
.btn-glass.danger { background: rgba(239, 68, 68, 0.2); color: #fca5a5; margin-top: 10px; }
.btn-text { width: 100%; background: transparent; border: none; color: var(--dim); padding: 10px; margin-top: 5px; cursor: pointer; }

/* NAVBAR */
.glass-nav {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: #1e293b; border: 1px solid var(--border); border-radius: 50px;
    padding: 8px 30px; display: flex; gap: 30px; align-items: center; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 1000;
}
.nav-btn { color: var(--dim); padding: 10px; display: flex; transition: all 0.2s; }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--white); }
.add-btn { background: var(--gold); color: #000; border-radius: 50%; padding: 12px; transform: translateY(-5px); box-shadow: 0 0 15px rgba(251, 191, 36, 0.4); }

/* --- MODAL WELCOME (PIN) --- */
.modal-overlay { 
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); 
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; 
}
.modal-content { 
    text-align: center; width: 100%; max-width: 320px; 
    background: #0f172a; border: 1px solid var(--gold);
    border-radius: 20px; padding: 30px 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.modal-content img.main-logo { width: 100px; margin-bottom: 20px; }
.modal-content h2 { margin: 0; font-size: 1.2rem; color: var(--white); }
.modal-content p { color: var(--gold); font-size: 0.8rem; margin: 5px 0 25px 0; }

.modal-footer { 
    margin-top: 25px; padding-top: 15px; border-top: 1px solid var(--border); 
    display: flex; flex-direction: column; align-items: center; gap: 8px; 
}
.modal-footer span { font-size: 0.65rem; color: var(--dim); letter-spacing: 1px; }
.modal-footer img { height: 22px; width: auto; opacity: 0.8; }

/* PIN INPUT 3D */
.pin-wrapper { display: none; animation: fadeIn 0.5s ease; }
.pin-input {
    width: 180px; padding: 15px; margin-bottom: 20px;
    text-align: center; letter-spacing: 15px; 
    background: rgba(0,0,0,0.3); color: var(--gold);
    border: 1px solid var(--border); border-radius: 12px;
    font-size: 1.5rem; font-weight: 800;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    outline: none; transition: 0.2s;
}
.pin-input:focus { border-color: var(--gold); box-shadow: 0 0 15px rgba(251, 191, 36, 0.2); }
.pin-error { border-color: var(--red) !important; animation: shake 0.3s; color: var(--red); }

/* SECURITY ALERT */
.sec-overlay { z-index: 99999; background: #000; }
.sec-box { 
    border: 1px solid var(--red); box-shadow: 0 0 50px rgba(239, 68, 68, 0.4); 
    background: #0a0a0a; text-align: left; width: 100%; max-width: 400px; 
}
.sec-title { 
    color: var(--red); font-family: 'JetBrains Mono', monospace; 
    font-size: 1rem; font-weight: 700; margin-bottom: 15px; border-bottom: 1px solid var(--red); padding-bottom: 10px;
}
.sec-code { 
    background: rgba(239, 68, 68, 0.1); color: var(--red); 
    padding: 8px; font-size: 0.75rem; border-radius: 4px; 
    display: block; margin-bottom: 20px; font-family: 'JetBrains Mono', monospace; 
}
.sec-msg { 
    color: #cbd5e1; font-family: 'JetBrains Mono', monospace; 
    font-size: 0.75rem; line-height: 1.6; margin-bottom: 25px; 
}
.sec-msg strong { color: #fff; }
.sec-footer { text-align: center; margin-top: 10px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,0.1); }
.sec-footer img { max-width: 100%; height: auto; max-height: 35px; opacity: 0.7; display: inline-block; }

@keyframes shake { 0%, 100% {transform: translateX(0);} 25% {transform: translateX(-5px);} 75% {transform: translateX(5px);} }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.hidden { display: none !important; }
.loading { text-align: center; padding: 30px; color: var(--dim); font-style: italic; }