:root {
    --bg-dark: #020617;
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --accent-cyan: #22d3ee;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-gold: #f59e0b;
    --text-dim: #94a3b8;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { 
    background-color: var(--bg-dark);
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    color: #f8fafc; font-family: 'Inter', sans-serif; 
    margin: 0; padding: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; align-items: center;
}

/* HEADER */
header {
    width: 100%; padding: 15px 20px; height: 70px;
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(2, 6, 23, 0.85); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border); z-index: 10;
}
h1 { margin: 0; font-weight: 700; font-size: 1.1rem; text-transform: uppercase; background: linear-gradient(to right, #fff, #94a3b8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.header-btns { display: flex; gap: 10px; align-items: center; }
.btn-header {
    background: rgba(34, 211, 238, 0.1); border: 1px solid rgba(34, 211, 238, 0.3); color: var(--accent-cyan);
    padding: 6px 12px; border-radius: 6px; font-size: 0.75rem; font-family: 'JetBrains Mono'; font-weight: 600;
    cursor: pointer; text-transform: uppercase; display: flex; align-items: center; gap: 6px;
}
.btn-header.primary { background: var(--accent-cyan); color: #000; border: none; }
.btn-header svg { width: 14px; height: 14px; fill: currentColor; }

/* STATUS BUTTON */
#status-indicator {
    padding: 6px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; font-family: 'JetBrains Mono';
    display: flex; align-items: center; gap: 6px; cursor: default;
    transition: all 0.3s ease;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
/* Status States */
.status-init { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); border: 1px solid rgba(245, 158, 11, 0.3); }
.status-init .status-dot { background: var(--accent-gold); animation: blink 1s infinite; }
.status-connected { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.3); }
.status-connected .status-dot { background: var(--accent-green); box-shadow: 0 0 10px var(--accent-green); }
.status-disconnected { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.3); }
.status-disconnected .status-dot { background: var(--accent-red); }

@keyframes blink { 50% { opacity: 0.3; } }

/* ANIMATED SYSTEM CARD */
.card.system { 
    border-left-color: var(--accent-cyan); 
    background: rgba(15, 23, 42, 0.85); 
    position: relative; overflow: hidden;
}
/* The Scanning Animation Effect */
.card.system::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.1), transparent);
    animation: scan 3s infinite linear;
}
.card.system .message { position: relative; z-index: 2; }
@keyframes scan { 0% { left: -100%; } 100% { left: 200%; } }

/* STATS */
#stats-grid { width: 100%; max-width: 600px; padding: 15px 20px 0 20px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.stat-box { background: rgba(15, 23, 42, 0.6); border: 1px solid var(--glass-border); padding: 12px; border-radius: 8px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; }
.stat-value { font-family: 'JetBrains Mono'; font-size: 1.1rem; font-weight: 700; color: #fff; }

/* MAIN AREA */
#main-scroll-area {
    flex: 1; width: 100%; max-width: 600px; overflow-y: auto; padding: 20px;
    display: flex; flex-direction: column; gap: 15px; scrollbar-width: none;
}
#main-scroll-area::-webkit-scrollbar { display: none; }

.recent-section-title { font-size: 0.75rem; color: var(--accent-cyan); font-family: 'JetBrains Mono'; margin-bottom: 5px; text-transform: uppercase; display:none; }
#recent-transactions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

/* CARDS */
.card {
    background: rgba(15, 23, 42, 0.6); border: 1px solid var(--glass-border); border-left: 3px solid var(--glass-border);
    padding: 18px 20px; border-radius: 12px; backdrop-filter: blur(8px);
    display: flex; flex-direction: column; gap: 6px;
    animation: slideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.card.recent { border-left-color: var(--accent-green); background: rgba(16, 185, 129, 0.05); }

.card-header { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; font-family: 'JetBrains Mono'; }
.amount { font-size: 1.4rem; font-weight: 700; color: #fff; font-family: 'JetBrains Mono'; }
.detail-row { font-size: 0.8rem; color: #cbd5e1; display: flex; justify-content: space-between; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 8px; margin-top: 4px; }
.detail-label { color: var(--text-dim); font-size: 0.75rem; }
.message { font-size: 0.95rem; line-height: 1.4; color: #e2e8f0; }

@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* MODALS */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; z-index: 200; }
.modal-content { background: #0f172a; width: 90%; max-width: 400px; border: 1px solid var(--glass-border); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.modal-header { padding: 15px; border-bottom: 1px solid var(--glass-border); display: flex; justify-content: space-between; color:#fff; font-weight:bold; }
.modal-body { padding: 20px; }

/* QR & POPUP STYLES */
.qr-input-group { display: flex; flex-direction: column; gap: 15px; }
.qr-input { background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); padding: 12px; color: #fff; border-radius: 6px; font-family: 'JetBrains Mono'; font-size: 1rem; }
.qr-btn { background: var(--accent-cyan); color: #000; padding: 12px; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; text-transform: uppercase; font-family: 'JetBrains Mono'; }

.qr-result { display: none; flex-direction: column; align-items: center; gap: 15px; margin-top: 10px; text-align: center; }
.qr-wrapper {
    width: 250px; height: 250px; background: #fff; border-radius: 12px; overflow: hidden; 
    display: flex; align-items: center; justify-content: center; border: 3px solid rgba(255, 255, 255, 0.1);
}
.qr-img { 
    width: 100%; 
    height: auto; 
    /* MODIFIED: Moves image UP by 22px total */
    transform: scale(1.7) translateY(calc(2% - 22px)); 
}
.qr-status { color: var(--accent-green); font-size: 0.9rem; font-weight: bold; display:none; padding: 10px; background: rgba(16, 185, 129, 0.1); border-radius: 6px; width: 100%; }

/* PAYMENT ALERT POPUP */
#payment-popup { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 500; display: none; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.payment-alert-card {
    background: rgba(16, 185, 129, 0.1); border: 2px solid var(--accent-green); box-shadow: 0 0 50px rgba(16, 185, 129, 0.3);
    width: 90%; max-width: 450px; border-radius: 16px; padding: 30px; text-align: center;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: flex; flex-direction: column; gap: 15px;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }

.pay-success-icon { font-size: 4rem; margin-bottom: 10px; }
.pay-title { color: var(--accent-green); font-weight: 700; font-size: 1.2rem; text-transform: uppercase; letter-spacing: 1px; }
.pay-amount { font-family: 'JetBrains Mono'; font-size: 3.5rem; font-weight: 700; color: #fff; margin: 10px 0; }
.pay-details { color: #cbd5e1; font-size: 0.9rem; line-height: 1.6; }

/* HISTORY TABLE */
table { width: 100%; border-collapse: collapse; font-family: 'JetBrains Mono'; font-size: 0.8rem; }
th { text-align: left; padding: 10px; background: rgba(255,255,255,0.05); color: var(--text-dim); }
td { padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.05); color: #cbd5e1; }

/* START OVERLAY */
#start-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(2,6,23,0.95); backdrop-filter: blur(15px); display: flex; align-items: center; justify-content: center; z-index: 999; transition: opacity 0.4s; }
.btn-start { background: var(--accent-cyan); color: #000; border: none; padding: 16px 32px; font-weight: 700; font-family: 'JetBrains Mono'; cursor: pointer; clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%); }
