/* ============================================
   Receipt Scanner - Global Styles
   Single CSS file for all pages
   ============================================ */

/* Reset & Variables */
*{margin:0;padding:0;box-sizing:border-box}
:root {
    --bg: #0a0a0f;
    --surface: #13131a;
    --surface2: #1a1a24;
    --border: #2a2a3a;
    --text: #e8e8f0;
    --text-dim: #8888a0;
    --accent: #00d4aa;
    --accent-dim: #00d4aa22;
    --accent-glow: #00d4aa44;
    --red: #ff4466;
    --yellow: #ffcc00;
    --blue: #4488ff;
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'Space Mono', monospace;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 70px; /* space for bottom nav on mobile */
}
@media(min-width:769px) { body { padding-bottom: 0; } }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 960px; margin: 0 auto; padding: 20px; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* ============================================
   TOP NAVIGATION
   ============================================ */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}
.nav-brand {
    font-family: var(--mono);
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}
.nav-brand span { color: var(--accent); }
.nav-brand:hover { text-decoration: none; }
.nav-links {
    display: flex;
    gap: 16px;
    font-size: 14px;
}
.nav-links a { color: var(--text-dim); text-decoration: none; }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }
/* Login button */
.nav-login-btn { background: var(--accent); color: var(--bg) !important; padding: 6px 14px; border-radius: 6px; font-weight: 600; font-size: 13px; }
.nav-login-btn:hover { opacity: 0.9; }
/* User dropdown */
.nav-user-menu { position: relative; }
.nav-user-btn { color: var(--accent) !important; font-weight: 600; font-size: 13px; cursor: pointer; }
.nav-dropdown {
    display: none; position: absolute; right: 0; top: 100%; margin-top: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    min-width: 200px; padding: 10px 0; z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.nav-dropdown.show { display: block; }
.nav-dd-name { padding: 6px 14px; font-weight: 600; font-size: 14px; color: var(--text); }
.nav-dd-email { padding: 0 14px 6px; font-size: 12px; color: var(--text-dim); }
.nav-dropdown a { display: block; padding: 8px 14px; color: var(--text-dim); text-decoration: none; font-size: 13px; }
.nav-dropdown a:hover { background: var(--surface2); color: var(--text); }
/* Hide top nav links on mobile (bottom nav handles it) */
@media(max-width:768px) {
    .nav-links { display: none; }
}

/* ============================================
   BOTTOM NAVIGATION (Mobile)
   ============================================ */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 999;
    padding: 6px 0 env(safe-area-inset-bottom, 8px);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(19, 19, 26, 0.92);
}
@media(max-width:768px) { .bottom-nav { display: flex; } }
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    transition: color .2s;
}
.bottom-nav a .bnav-icon { font-size: 20px; }
.bottom-nav a.active { color: var(--accent); }
.bottom-nav a:hover { color: var(--accent); text-decoration: none; }

/* ============================================
   CARDS & SURFACES
   ============================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    animation: fadeUp .4s ease;
}
.card h2, .card h3 {
    font-family: var(--mono);
    font-size: 16px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 10px 20px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: inline-block;
    transition: all .2s;
    text-decoration: none;
}
.btn:hover { opacity: .9; transform: translateY(-1px); text-decoration: none; }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-red { background: var(--red); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-yellow { background: var(--yellow); color: var(--bg); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================
   FORMS
   ============================================ */
.fg { margin-bottom: 12px; }
.fg label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.fg input, .fg select, .fg textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    outline: none;
    font-family: var(--font);
    transition: border-color .2s;
}
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color: var(--accent); }
.fg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media(max-width:640px) { .fg-row { grid-template-columns: 1fr; } }

/* ============================================
   TABLES
   ============================================ */
.tw {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 16px;
}
table { width: 100%; border-collapse: collapse; min-width: 500px; }
thead th {
    background: var(--surface2);
    padding: 10px 12px;
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    font-family: var(--mono);
    border-bottom: 1px solid var(--border);
}
tbody td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
tbody tr { transition: background .2s; }
tbody tr:hover { background: var(--accent-dim); }

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.b-ok { background: #00d4aa22; color: var(--accent); }
.b-flag { background: #ffcc0022; color: var(--yellow); }
.b-err { background: #ff446622; color: var(--red); }
.b-blue { background: #4488ff22; color: var(--blue); }
.price { font-family: var(--mono); font-weight: 700; color: var(--accent); }

/* ============================================
   SUMMARY / STAT CARDS
   ============================================ */
.summary-grid, .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.sum-card, .sc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: all .3s;
    animation: fadeUp .4s ease;
}
.sc { cursor: pointer; text-decoration: none; color: var(--text); display: block; }
.sc:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; box-shadow: 0 4px 20px var(--accent-glow); }
.sum-card .val, .sc .n {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}
.sum-card .lbl, .sc .l {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   LAYOUT HELPERS
   ============================================ */
.ig { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.ii label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; display: block; margin-bottom: 2px; }
.ii span { font-size: 14px; font-weight: 600; }
.bl { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }
.bl:hover { color: var(--accent); text-decoration: none; }
.empty { text-align: center; padding: 40px; color: var(--text-dim); }
.empty .icon { font-size: 48px; margin-bottom: 8px; }
.sb { display: flex; gap: 8px; margin-bottom: 16px; }
.sb input, .sb select { padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; outline: none; }
.sb input { flex: 1; }
.sb input:focus { border-color: var(--accent); }

/* User status */
.s-active { color: var(--accent); }
.s-suspended { color: var(--yellow); }
.s-banned { color: var(--red); }

/* Meta badges */
.mbadge { padding: 4px 14px; border-radius: 16px; font-size: 12px; font-weight: 600; }
.mb-type { background: #4488ff22; color: var(--blue); }
.mb-cat { background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); }
.mb-trend-up { background: #ff446622; color: var(--red); }
.mb-trend-down { background: #00d4aa22; color: var(--accent); }
.mb-trend-flat { background: var(--surface2); color: var(--text-dim); }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes countUp {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* Staggered animations for lists */
.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: .05s; }
.card:nth-child(3) { animation-delay: .1s; }
.card:nth-child(4) { animation-delay: .15s; }
.card:nth-child(5) { animation-delay: .2s; }

.sc { animation: fadeUp .4s ease both; }
.sc:nth-child(1) { animation-delay: 0s; }
.sc:nth-child(2) { animation-delay: .05s; }
.sc:nth-child(3) { animation-delay: .08s; }
.sc:nth-child(4) { animation-delay: .11s; }
.sc:nth-child(5) { animation-delay: .14s; }
.sc:nth-child(6) { animation-delay: .17s; }
.sc:nth-child(7) { animation-delay: .20s; }
.sc:nth-child(8) { animation-delay: .23s; }

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 80px; border-radius: var(--radius); margin-bottom: 12px; }
.skeleton-avatar { width: 56px; height: 56px; border-radius: 50%; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media(max-width:640px) {
    .container { padding: 12px; }
    .container-wide { padding: 10px; }
    .summary-grid, .stats-grid { grid-template-columns: 1fr 1fr; }
    .fg-row { grid-template-columns: 1fr; }
    table { min-width: 400px; }
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */
.page-content {
    animation: slideUp .3s ease;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    text-align: center;
    padding: 30px 0;
    border-top: 1px solid var(--border);
    margin-top: 30px;
    font-size: 12px;
    color: var(--text-dim);
}
