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

:root {
    --a-primary: #1d8f43;
    --a-accent:  #0f5c2a;
    --a-bg:      #f0f4f2;
    --a-sidebar: #0e2d1a;
    --a-white:   #ffffff;
    --a-text:    #111d15;
    --a-muted:   #5a6e62;
    --a-border:  #dde8e2;
    --a-danger:  #c0392b;
    --a-warn:    #d97706;
    --a-success: #16a34a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Manrope', sans-serif;
    background: var(--a-bg);
    color: var(--a-text);
    min-height: 100vh;
}

/* ── login page ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f2d1b, #1a5c30);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 36px;
    width: min(420px, 100%);
    box-shadow: 0 40px 60px rgba(0,0,0,.35);
}
.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo span {
    display: inline-block;
    background: var(--a-primary);
    color: #fff;
    font-weight: 800;
    font-size: 1.5rem;
    padding: 12px 24px;
    border-radius: 14px;
}
.login-logo p { margin-top: 10px; color: var(--a-muted); font-size: .9rem; }
.login-card h2 { font-size: 1.35rem; margin-bottom: 22px; }
.login-err { background: #fdecea; color: var(--a-danger); padding: 12px; border-radius: 10px; margin-bottom: 16px; font-size: .9rem; }

/* ── form basics ── */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--a-text); }
input[type=text], input[type=password], input[type=url], input[type=number],
input[type=email], input[type=tel], select, textarea {
    width: 100%;
    border: 1.5px solid var(--a-border);
    border-radius: 10px;
    padding: 11px 14px;
    font-family: inherit;
    font-size: .95rem;
    background: #fff;
    color: var(--a-text);
    transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--a-primary); }
textarea { resize: vertical; min-height: 80px; }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 22px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: .9rem;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    text-decoration: none;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn-primary   { background: var(--a-primary); color: #fff; }
.btn-danger    { background: var(--a-danger);  color: #fff; }
.btn-outline   { background: transparent; border: 1.5px solid var(--a-border); color: var(--a-text); }
.btn-sm        { padding: 7px 14px; font-size: .82rem; border-radius: 8px; }
.btn-full      { width: 100%; justify-content: center; }

/* ── admin layout ── */
.admin-wrap { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--a-sidebar);
    color: #c8ddd0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    z-index: 100;
}
.sidebar-brand {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand a { text-decoration: none; }
.sidebar-brand .brand-name {
    display: block;
    font-weight: 800;
    font-size: 1.15rem;
    color: #fff;
}
.sidebar-brand .brand-sub { font-size: .75rem; color: rgba(255,255,255,.45); margin-top: 2px; display: block; }
.sidebar-nav { padding: 14px 0; flex: 1; }
.nav-section-label {
    padding: 10px 20px 4px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: rgba(255,255,255,.3);
    text-transform: uppercase;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    border-left: 3px solid transparent;
    transition: color .15s, background .15s, border-color .15s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,.07);
    color: #fff;
    border-left-color: var(--a-primary);
}
.sidebar-nav a svg { flex-shrink: 0; }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a { color: rgba(255,255,255,.5); font-size: .82rem; text-decoration: none; }
.sidebar-footer a:hover { color: #fff; }

/* ── main content area ── */
.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.topbar-admin {
    background: #fff;
    border-bottom: 1px solid var(--a-border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-admin h1 { font-size: 1.2rem; font-weight: 800; }
.topbar-admin .user-chip {
    display: flex; align-items: center; gap: 8px;
    font-size: .85rem; color: var(--a-muted); font-weight: 600;
}

.content-area { padding: 28px; flex: 1; }

/* ── cards ── */
.card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--a-border);
    box-shadow: 0 4px 14px rgba(0,0,0,.04);
    margin-bottom: 24px;
}
.card h3 { font-size: 1.1rem; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--a-border); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--a-border); }
.card-header h3 { margin: 0; padding: 0; border: none; font-size: 1.1rem; }

/* ── stats row ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid var(--a-border);
    box-shadow: 0 4px 14px rgba(0,0,0,.04);
}
.stat-card .label { font-size: .78rem; font-weight: 700; color: var(--a-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { font-size: 2rem; font-weight: 800; color: var(--a-primary); margin-top: 4px; }

/* ── table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead tr { background: var(--a-bg); }
th { padding: 11px 14px; text-align: left; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--a-muted); }
td { padding: 12px 14px; border-bottom: 1px solid var(--a-border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8faf9; }

/* ── badges ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warn    { background: #fef9c3; color: #854d0e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-muted   { background: #f1f5f3; color: #5a6e62; }

/* ── flash messages ── */
.flash { padding: 13px 18px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; font-size: .9rem; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── video list ── */
.video-list-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 0;
    border-bottom: 1px solid var(--a-border);
    flex-wrap: wrap;
}
.video-list-item:last-child { border-bottom: none; }
.video-thumb { width: 100px; height: 60px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #111; }
.video-info { flex: 1; min-width: 160px; }
.video-info strong { display: block; font-size: .95rem; margin-bottom: 4px; }
.video-info small { color: var(--a-muted); font-size: .8rem; }
.video-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── per-video stat pills ── */
.video-stat-pills {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
    margin-top: 2px;
}
.vpill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: .02em;
    white-space: nowrap;
}
.vpill svg { opacity: .75; flex-shrink: 0; }
.vpill-visit { background: #eff6ff; color: #1d4ed8; }
.vpill-txn   { background: #fef9c3; color: #854d0e; }
.vpill-earn  { background: #dcfce7; color: #166534; }

/* ── upload area ── */
.upload-hint { font-size: .78rem; color: var(--a-muted); margin-top: 5px; }
.or-divider { text-align: center; color: var(--a-muted); font-size: .85rem; margin: 10px 0; font-weight: 600; }

/* ── transaction list (replaces old table) ── */
.txn-empty {
    text-align: center;
    padding: 40px 0;
    color: var(--a-muted);
    font-size: .9rem;
}
.txn-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.txn-row {
    display: grid;
    grid-template-columns: 28px 1fr auto auto auto;
    align-items: center;
    gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--a-border);
    transition: background .12s;
    border-radius: 8px;
}
.txn-row:last-child { border-bottom: none; }
.txn-row:hover { background: #f6faf7; }

/* status dot */
.txn-status-col { display: flex; align-items: center; justify-content: center; }
.txn-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.txn-dot-completed { background: #16a34a; box-shadow: 0 0 0 3px #dcfce7; }
.txn-dot-failed    { background: #dc2626; box-shadow: 0 0 0 3px #fee2e2; }
.txn-dot-pending   { background: #d97706; box-shadow: 0 0 0 3px #fef9c3; }

/* phone + id */
.txn-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.txn-phone { font-size: .92rem; font-weight: 700; color: var(--a-text); letter-spacing: .02em; }
.txn-id    { font-size: .72rem; color: var(--a-muted); font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* amount */
.txn-amount-col { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.txn-amount  { font-size: 1rem; font-weight: 800; color: var(--a-text); }
.txn-currency { font-size: .7rem; font-weight: 700; color: var(--a-muted); letter-spacing: .04em; }

/* status badge */
.txn-badge-col { display: flex; align-items: center; }
.txn-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    white-space: nowrap;
}
.txn-badge-completed { background: #dcfce7; color: #166534; }
.txn-badge-failed    { background: #fee2e2; color: #991b1b; }
.txn-badge-pending   { background: #fef9c3; color: #854d0e; }

/* date */
.txn-date-col { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.txn-date { font-size: .78rem; font-weight: 600; color: var(--a-text); white-space: nowrap; }
.txn-time { font-size: .72rem; color: var(--a-muted); }

/* ── mobile ── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .content-area { padding: 16px; }
    .txn-row { grid-template-columns: 28px 1fr auto; grid-template-rows: auto auto; gap: 8px 10px; }
    .txn-badge-col { grid-column: 2; grid-row: 2; }
    .txn-date-col  { grid-column: 3; grid-row: 2; }
}
