/* ═══════════════════════════════════════════
   BARCODIFY — Stylesheet
   Aesthetic: Dark industrial-tech with 
   emerald accent. Nigerian fintech feel.
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-deep: #050b14;
    --bg-base: #080f1e;
    --bg-card: #0c1627;
    --bg-elevated: #101d33;
    --bg-input: #060d1a;
    --border: #15253f;
    --border-light: #1a3050;
    --text-primary: #e8eff7;
    --text-secondary: #7a95b4;
    --text-muted: #4a6580;
    --accent: #00d4aa;
    --accent-dim: rgba(0,212,170,0.12);
    --accent-hover: #00eabb;
    --blue: #0088ff;
    --blue-dim: rgba(0,136,255,0.12);
    --orange: #ff6633;
    --orange-dim: rgba(255,102,51,0.12);
    --red: #ff3355;
    --red-dim: rgba(255,51,85,0.12);
    --purple: #8855ff;
    --success: #00d4aa;
    --danger: #ff3355;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.4);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Background pattern */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(0,212,170,0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0,136,255,0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown {
    from { opacity: 0; transform: translate(-50%, -120%); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.fade-up { animation: fadeUp 0.5s ease forwards; }
.fade-up-delay { animation: fadeUp 0.5s ease 0.1s forwards; opacity: 0; }
.fade-up-delay2 { animation: fadeUp 0.5s ease 0.2s forwards; opacity: 0; }

/* ─── LAYOUT ─── */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 24px 20px 60px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* ─── HEADER ─── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(5,11,20,0.85);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-decoration: none;
}
.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #009977);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-deep);
    font-size: 18px;
}
.logo-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 3px;
    color: #fff;
}
.logo-dot {
    color: var(--accent);
    font-size: 28px;
    font-weight: 800;
    margin-left: -4px;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.wallet-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: var(--transition);
}
.wallet-badge:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.wallet-badge svg { width: 18px; height: 18px; }
.admin-badge {
    background: var(--orange);
    color: #fff;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
}
.header-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.header-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ─── TOAST ─── */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 28px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    z-index: 9999;
    animation: slideDown 0.35s ease;
    box-shadow: var(--shadow-lg);
    color: var(--bg-deep);
}
.toast.success { background: var(--accent); }
.toast.error { background: var(--red); color: #fff; }

/* ─── AUTH FORMS ─── */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 20px;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    animation: fadeUp 0.5s ease;
}
.auth-title {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
}
.auth-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
}
.auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}
.auth-link {
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.auth-link:hover { color: var(--accent-hover); }

/* ─── FORMS ─── */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
    letter-spacing: 0.4px;
}
.form-input {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: 'Outfit', sans-serif;
    transition: var(--transition);
}
.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-muted); }

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a95b4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* ─── BUTTONS ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #00a888);
    color: var(--bg-deep);
    width: 100%;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-hover), #00bb99); box-shadow: 0 4px 20px rgba(0,212,170,0.25); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-blue {
    background: linear-gradient(135deg, var(--blue), #0066cc);
    color: #fff;
}
.btn-blue:hover { box-shadow: 0 4px 20px rgba(0,136,255,0.25); }

.btn-danger {
    background: var(--red-dim);
    border: 1px solid rgba(255,51,85,0.3);
    color: var(--red);
}
.btn-danger:hover { background: rgba(255,51,85,0.2); }

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-xs);
}
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-xs);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent); }

.btn-back {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 16px;
    font-family: 'Outfit', sans-serif;
    transition: var(--transition);
}
.btn-back:hover { color: var(--accent); }

/* ─── CARDS ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
}
.card:hover { border-color: var(--border-light); }

/* ─── STAT CARDS ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    border-left: 4px solid var(--accent);
}
.stat-card.blue { border-left-color: var(--blue); }
.stat-card.orange { border-left-color: var(--orange); }
.stat-card.purple { border-left-color: var(--purple); }
.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
}

/* ─── ACTION CARDS ─── */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}
.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}
.action-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.action-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 22px;
    color: #fff;
}
.action-icon.green { background: linear-gradient(135deg, var(--accent), #009977); }
.action-icon.blue { background: linear-gradient(135deg, var(--blue), #0066cc); }
.action-icon.orange { background: linear-gradient(135deg, var(--orange), #cc4400); }
.action-icon.purple { background: linear-gradient(135deg, var(--purple), #6633cc); }
.action-title { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.action-desc { font-size: 13px; color: var(--text-secondary); }

/* ─── SECTION ─── */
.section { margin-bottom: 32px; }
.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
}
.page-title { font-size: 28px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.page-subtitle { color: var(--text-secondary); font-size: 15px; margin-bottom: 24px; }

/* ─── CODE TYPE GRID ─── */
.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.type-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.type-card:hover { border-color: var(--border-light); }
.type-card.active {
    border-color: var(--accent);
    background: rgba(0,212,170,0.04);
}
.type-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.type-name { font-size: 14px; font-weight: 700; color: #fff; }
.type-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}
.type-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.type-check {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--accent);
    font-size: 18px;
}

/* ─── GENERATE FORM ─── */
.generate-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}
.generate-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.balance-note {
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}
.generate-footer .btn-primary { width: auto; }

/* ─── RESULT CARD ─── */
.result-card {
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 36px;
    text-align: center;
    margin-bottom: 28px;
    animation: fadeUp 0.4s ease;
}
.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: var(--accent-dim);
    border-radius: 20px;
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 24px;
}
.result-image {
    max-width: 300px;
    width: 100%;
    border-radius: var(--radius);
    background: #fff;
    padding: 16px;
    margin: 0 auto 20px;
    display: block;
}
.result-type { font-size: 18px; font-weight: 600; color: #fff; margin-bottom: 16px; }

/* ─── CODE LIST / HISTORY ─── */
.code-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: var(--transition);
}
.code-item:hover { border-color: var(--border-light); }
.code-thumb {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    object-fit: cover;
    background: #fff;
    flex-shrink: 0;
}
.code-info { flex: 1; min-width: 0; }
.code-name { font-size: 14px; font-weight: 600; color: #fff; }
.code-date { font-size: 12px; color: var(--text-muted); }
.code-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}
.history-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}
.history-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.history-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    background: #fff;
    padding: 20px;
}
.history-details { padding: 18px; }
.history-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

/* ─── SEARCH BOX ─── */
.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    color: var(--text-muted);
}
.search-box svg { width: 18px; height: 18px; flex-shrink: 0; }
.search-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Outfit', sans-serif;
    outline: none;
}
.search-input::placeholder { color: var(--text-muted); }

/* ─── USER CARDS (Admin) ─── */
.user-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 12px;
}
.user-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-deep);
    font-weight: 800;
    font-size: 18px;
    flex-shrink: 0;
}
.user-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.user-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.user-stat-value {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
}
.user-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.fund-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}
.fund-row .form-input {
    flex: 1;
    min-width: 120px;
    margin-bottom: 0;
    padding: 10px 14px;
}
.status-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.status-badge.active { background: var(--accent-dim); color: var(--accent); }
.status-badge.suspended { background: var(--red-dim); color: var(--red); }

/* ─── PRICE TABLE ─── */
.price-grid { display: flex; flex-direction: column; gap: 6px; }
.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* ─── FUND MODAL ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    width: 100%;
    max-width: 420px;
    animation: fadeUp 0.3s ease;
}
.modal-title { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.modal-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }

.quick-amounts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.quick-amount {
    padding: 12px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}
.quick-amount:hover, .quick-amount.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-icon {
    font-size: 48px;
    color: var(--border-light);
    margin-bottom: 16px;
}
.empty-text { color: var(--text-secondary); font-size: 15px; }

/* ─── TRANSACTION LIST ─── */
.transaction-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}
.trans-type {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.trans-type.credit { background: var(--accent-dim); color: var(--accent); }
.trans-type.debit { background: var(--orange-dim); color: var(--orange); }
.trans-amount {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.trans-amount.credit { color: var(--accent); }
.trans-amount.debit { color: var(--orange); }

/* ─── DEMO CREDS ─── */
.demo-creds {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.demo-creds-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.demo-creds p {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.8;
}

/* ─── FOOTER ─── */
.footer {
    text-align: center;
    padding: 24px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
}

/* ─── LOADING ─── */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
    .header-inner { padding: 12px 16px; }
    .logo-text { font-size: 16px; letter-spacing: 2px; }
    .main-content { padding: 16px; }
    .auth-card { padding: 28px 24px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 20px; }
    .type-grid { grid-template-columns: 1fr; }
    .history-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 22px; }
    .generate-footer { flex-direction: column; }
    .generate-footer .btn-primary { width: 100%; }
    .modal { padding: 28px 24px; }
    .quick-amounts { grid-template-columns: repeat(2, 1fr); }
    .user-stats { gap: 16px; }
}
