/* 🧾 ReceiptLedger AI Dark Glassmorphic Financial System */
:root {
    --bg-dark: #090d16;
    --card-bg: rgba(15, 23, 42, 0.75);
    --border-color: rgba(16, 185, 129, 0.2);
    --emerald-glow: #10b981;
    --cyan-glow: #06b6d4;
    --amber-glow: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --font-heading: 'Outfit', 'Do Hyeon', sans-serif;
    --font-body: 'Noto Sans KR', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.15), transparent 70%),
                      radial-gradient(circle at 100% 100%, rgba(6, 182, 212, 0.1), transparent 60%);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 16px;
}

.app-container {
    width: 100%;
    max-width: 1320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* HEADER */
.app-header {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-badge {
    align-self: flex-start;
    background: linear-gradient(135deg, var(--emerald-glow), var(--cyan-glow));
    color: #000;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 6px;
}

.brand-logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffffff, var(--emerald-glow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub { font-size: 0.85rem; color: var(--text-muted); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.financial-summary-badge {
    display: flex;
    gap: 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 6px 14px;
    border-radius: 10px;
}

.f-lbl { font-size: 0.7rem; color: #a7f3d0; display: block; }
.f-valSpent { font-size: 0.95rem; font-weight: 900; color: #ef4444; }
.f-valRemain { font-size: 0.95rem; font-weight: 900; color: var(--emerald-glow); }

.hdr-btn {
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
}

.btn-gold { background: #fbbf24; color: #000; }

/* FEATURE TABS */
.feature-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    min-width: 180px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active, .tab-btn:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
    border-color: var(--emerald-glow);
    color: #fff;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.suite-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 14px;
}

.card-header-row h3 { font-size: 1.2rem; font-weight: 800; color: var(--emerald-glow); }

.sample-receipt-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.chip:hover, .chip.chip-gold { background: #fbbf24; color: #000; border-color: #fbbf24; }

/* SCANNER LAYOUT */
.scanner-main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) { .scanner-main-layout { grid-template-columns: 1fr; } }

.camera-viewport-card { display: flex; flex-direction: column; gap: 14px; }

.video-wrapper {
    position: relative;
    width: 100%;
    height: 380px;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid var(--emerald-glow);
}

#receipt-camera-feed { width: 100%; height: 100%; object-fit: cover; }

.receipt-frame-reticle {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 220px; height: 300px;
    border: 1px dashed rgba(16, 185, 129, 0.5);
    pointer-events: none;
}

.r-border { position: absolute; width: 20px; height: 20px; border-color: var(--emerald-glow); border-style: solid; }
.top-left { top: 0; left: 0; border-width: 4px 0 0 4px; }
.top-right { top: 0; right: 0; border-width: 4px 4px 0 0; }
.bottom-left { bottom: 0; left: 0; border-width: 0 0 4px 4px; }
.bottom-right { bottom: 0; right: 0; border-width: 0 4px 4px 0; }

.r-laser-line {
    position: absolute; width: 100%; height: 3px;
    background: linear-gradient(90deg, transparent, var(--emerald-glow), transparent);
    animation: scanLaser 2s infinite ease-in-out;
}

@keyframes scanLaser { 0% { top: 0; } 50% { top: 100%; } 100% { top: 0; } }

.scan-status-badge {
    position: absolute; bottom: 12px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8); color: #fbbf24;
    padding: 6px 14px; border-radius: 20px; font-size: 0.75rem; font-weight: 700;
}

.camera-control-row { display: flex; gap: 10px; }

.btn-cam {
    flex: 1; padding: 12px; border-radius: 10px;
    font-weight: 800; font-size: 0.85rem; cursor: pointer; border: none; text-align: center;
}

.btn-cam.start { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid #3b82f6; }
.btn-cam.scan { background: var(--emerald-glow); color: #000; }
.btn-cam.upload { background: rgba(255, 255, 255, 0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2); }

/* RECEIPT RESULT PAPER */
.receipt-result-paper {
    background: #ffffff;
    color: #0f172a;
    padding: 24px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-family: 'Noto Sans KR', sans-serif;
}

.receipt-header { border-bottom: 2px dashed #cbd5e1; padding-bottom: 12px; }
.store-badge { font-size: 0.75rem; background: #e2e8f0; color: #475569; padding: 2px 8px; border-radius: 4px; font-weight: 800; width: fit-content; }
.store-name { font-size: 1.3rem; font-weight: 900; margin-top: 4px; color: #0f172a; }
.store-meta { font-size: 0.75rem; color: #64748b; margin-top: 2px; }

.receipt-items-table { display: flex; flex-direction: column; gap: 8px; }
.r-tbl-hdr { display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: 800; color: #64748b; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px; }

.r-items-list { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; }
.r-item-row { display: flex; justify-content: space-between; border-bottom: 1px dashed #f1f5f9; padding-bottom: 4px; }

.receipt-total-summary { border-top: 2px solid #0f172a; padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.r-sum-row { display: flex; justify-content: space-between; font-size: 0.85rem; color: #475569; }
.r-sum-row.total { font-size: 1.2rem; font-weight: 900; color: #0f172a; border-top: 1px solid #cbd5e1; padding-top: 6px; margin-top: 4px; }

.btn-primary-full { padding: 14px; background: var(--emerald-glow); color: #000; font-weight: 900; border: none; border-radius: 10px; cursor: pointer; }

/* BUDGET & LEDGER STYLES */
.budget-progress-card { background: rgba(15,23,42,0.9); padding: 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; gap: 8px; }
.b-progress-meta { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 700; }
.progress-bar-bg { width: 100%; height: 12px; background: rgba(255,255,255,0.1); border-radius: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--emerald-glow), var(--cyan-glow)); }

.ledger-analytics-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; }
@media (max-width: 900px) { .ledger-analytics-grid { grid-template-columns: 1fr; } }

.chart-box-card, .transaction-history-card { background: rgba(15,23,42,0.9); padding: 20px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.1); }
.t-hdr-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.btn-add-manual { padding: 6px 12px; background: #3b82f6; color: #fff; font-weight: 800; border: none; border-radius: 6px; cursor: pointer; }

.transaction-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.t-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: rgba(255,255,255,0.03); border-radius: 8px; font-size: 0.85rem; }

/* PRICE TRACKER */
.price-tracker-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.p-item-card { background: rgba(15,23,42,0.9); border: 1px solid rgba(255,255,255,0.1); padding: 18px; border-radius: 14px; display: flex; flex-direction: column; gap: 8px; }
.p-icon { font-size: 2rem; }
.p-price-row { display: flex; justify-content: space-between; align-items: center; }
.p-curr { font-size: 1.3rem; font-weight: 900; color: var(--emerald-glow); }
.p-badge { font-size: 0.75rem; font-weight: 800; padding: 2px 6px; border-radius: 4px; }
.p-badge.down { background: rgba(16,185,129,0.2); color: var(--emerald-glow); }
.p-badge.up { background: rgba(239,68,68,0.2); color: #ef4444; }
.p-badge.same { background: rgba(148,163,184,0.2); color: #94a3b8; }
.p-desc { font-size: 0.75rem; color: var(--text-muted); }

/* MODALS */
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); display: none; justify-content: center; align-items: center; z-index: 9999; }
.overlay.active { display: flex; }
.modal-box { background: #0f172a; border: 1px solid var(--emerald-glow); padding: 24px; border-radius: 16px; max-width: 480px; width: 90%; display: flex; flex-direction: column; gap: 14px; }
.modal-hdr { display: flex; justify-content: space-between; align-items: center; }
.btn-close { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }
