/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
    --sidebar-width:    260px;
    --sidebar-bg:       #0f172a;
    --sidebar-border:   #1e293b;
    --sidebar-text:     #94a3b8;
    --sidebar-hover-bg: rgba(255,255,255,.05);
    --sidebar-active-bg:#1e40af1a;
    --sidebar-active-border: #3b82f6;
    --brand-color:      #3b82f6;
    --cta-color:        #10b981;
    --cta-hover:        #059669;
    --body-bg:          #f1f5f9;
    --card-bg:          #ffffff;
    --card-border:      #e2e8f0;
    --card-shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --card-shadow-hover:0 4px 16px rgba(0,0,0,.12);
    --text-primary:     #0f172a;
    --text-secondary:   #64748b;
    --text-muted:       #94a3b8;
    --radius:           12px;
    --radius-sm:        8px;
    --transition:       all .18s ease;
}

/* ─── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ─── App Wrapper ────────────────────────────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    border-right: 1px solid var(--sidebar-border);
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(59,130,246,.4);
}

.brand-name {
    color: #f1f5f9;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -.3px;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #334155;
    padding: 20px 20px 8px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item i { font-size: 16px; flex-shrink: 0; }

.nav-item:hover {
    background: var(--sidebar-hover-bg);
    color: #e2e8f0;
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: #93c5fd;
    border-left-color: var(--sidebar-active-border);
}

/* New Payment CTA — stands out */
.nav-item-cta {
    background: rgba(16, 185, 129, .1);
    color: #6ee7b7 !important;
    margin-top: 8px;
}
.nav-item-cta:hover {
    background: rgba(16, 185, 129, .2) !important;
    color: #a7f3d0 !important;
}
.nav-item-cta.active {
    background: rgba(16, 185, 129, .2) !important;
    border-left-color: var(--cta-color) !important;
}

.sidebar-spacer { flex: 1; }

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px;
    border-top: 1px solid var(--sidebar-border);
    margin-top: auto;
}

.clerk-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.clerk-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.clerk-name {
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clerk-role {
    color: #475569;
    font-size: 11px;
    font-weight: 500;
}

.logout-btn {
    color: #475569;
    font-size: 18px;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    flex-shrink: 0;
}
.logout-btn:hover { color: #ef4444; background: rgba(239,68,68,.1); }

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Page Header ────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 28px 32px 0;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -.4px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 4px 0 0;
}

.page-body {
    padding: 24px 32px 40px;
    flex: 1;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    padding: 18px 24px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header i { color: var(--brand-color); }

.card-body { padding: 24px; }

/* ─── Stat Cards ─────────────────────────────────────────────────────────── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.stat-card.stat-primary::before   { background: linear-gradient(90deg, #3b82f6, #6366f1); }
.stat-card.stat-success::before   { background: linear-gradient(90deg, #10b981, #059669); }
.stat-card.stat-warning::before   { background: linear-gradient(90deg, #f59e0b, #d97706); }
.stat-card.stat-danger::before    { background: linear-gradient(90deg, #ef4444, #dc2626); }

.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-1px);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -.5px;
    line-height: 1;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.stat-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
    opacity: .07;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-wrapper {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    background: var(--card-bg);
}

.table {
    margin: 0;
    font-size: 14px;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 13px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-color: #f1f5f9;
    color: var(--text-primary);
}

.table tbody tr {
    transition: background .12s ease;
}

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

.payment-ref {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 3px 7px;
    border-radius: 4px;
}

.client-cell strong { display: block; font-size: 14px; }
.client-cell small  { color: var(--text-muted); font-size: 12px; }

/* ─── Status Badges ──────────────────────────────────────────────────────── */
.status-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
    letter-spacing: .2px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 600; font-size: 14px; }

.btn-primary {
    background: var(--brand-color);
    border-color: var(--brand-color);
}
.btn-primary:hover { background: #2563eb; border-color: #2563eb; }

.btn-success {
    background: var(--cta-color);
    border-color: var(--cta-color);
}
.btn-success:hover { background: var(--cta-hover); border-color: var(--cta-hover); }

.btn-lg { padding: 12px 28px; font-size: 15px; border-radius: 10px; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #d1d5db;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
    outline: none;
}

.form-text { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.input-group-text {
    background: #f8fafc;
    border: 1.5px solid #d1d5db;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
}

/* Section dividers inside forms */
.form-section {
    margin-bottom: 28px;
}
.form-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 18px;
}

/* ─── Payment URL Box ────────────────────────────────────────────────────── */
.payment-url-box {
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border: 2px dashed #93c5fd;
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
}

.payment-url-box .url-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--brand-color);
    margin-bottom: 12px;
}

.payment-url-box .url-text {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 14px;
    color: var(--text-primary);
    background: white;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 12px 16px;
    word-break: break-all;
    text-align: left;
    margin-bottom: 16px;
}

/* ─── Checkout Method Cards ──────────────────────────────────────────────── */
.checkout-option {
    border: 2px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.checkout-option:hover {
    border-color: var(--brand-color);
    background: #eff6ff;
}

.checkout-option input[type=radio] {
    position: absolute;
    opacity: 0;
}

.checkout-option.selected {
    border-color: var(--brand-color);
    background: #eff6ff;
}

.checkout-option.selected::after {
    content: '\f26a';
    font-family: 'Bootstrap Icons';
    position: absolute;
    top: 12px; right: 14px;
    color: var(--brand-color);
    font-size: 18px;
}

.checkout-option-icon {
    font-size: 24px;
    color: var(--brand-color);
    margin-bottom: 6px;
}

.checkout-option-label {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.checkout-option-currencies {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ─── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    opacity: .3;
    display: block;
    margin-bottom: 16px;
}

.empty-state h5 {
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ─── Search / Filter Bar ────────────────────────────────────────────────── */
.filter-bar {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* ─── Timeline ───────────────────────────────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px; top: 8px; bottom: 8px;
    width: 2px;
    background: var(--card-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 22px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 3px;
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid;
    background: white;
}

.timeline-dot.success { border-color: #10b981; background: #d1fae5; }
.timeline-dot.pending { border-color: #f59e0b; background: #fef3c7; }
.timeline-dot.failed  { border-color: #ef4444; background: #fee2e2; }
.timeline-dot.info    { border-color: #3b82f6; background: #dbeafe; }

.timeline-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.timeline-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ─── State Search Dropdown ─────────────────────────────────────────────── */
.state-search-wrap { position: relative; }

.state-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: white;
    border: 1.5px solid var(--brand-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    max-height: 220px;
    overflow-y: auto;
    z-index: 200;
}

.state-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 14px;
    transition: background .1s;
}

.state-option:hover,
.state-option.active { background: #eff6ff; }

.state-option .state-name { color: var(--text-primary); }
.state-option .state-name strong { color: var(--brand-color); font-weight: 700; }

.state-option .state-code {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* ─── Wizard Progress Bar ────────────────────────────────────────────────── */
.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 8px 0 4px;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wizard-step-num {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 2px solid var(--card-border);
    background: white;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}

.wizard-step.active .wizard-step-num {
    border-color: var(--brand-color);
    background: var(--brand-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(59,130,246,.15);
}

.wizard-step.completed .wizard-step-num {
    border-color: #10b981;
    background: #10b981;
    color: white;
}

.wizard-step.completed .wizard-step-num::after {
    content: '✓';
}

.wizard-step.completed .wizard-step-num { font-size: 0; }
.wizard-step.completed .wizard-step-num::after { font-size: 16px; }

.wizard-step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.wizard-step.active .wizard-step-label  { color: var(--brand-color); }
.wizard-step.completed .wizard-step-label { color: #10b981; }

.wizard-connector {
    flex: 1;
    height: 2px;
    background: var(--card-border);
    margin: 0 8px;
    margin-bottom: 22px;
    max-width: 80px;
    transition: background .3s ease;
}

/* ─── Login Page ─────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 48px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,.3);
}

.login-brand {
    text-align: center;
    margin-bottom: 36px;
}

.login-brand-icon {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 28px;
    margin: 0 auto 16px;
    box-shadow: 0 6px 20px rgba(59,130,246,.4);
}

.login-brand h2 {
    font-weight: 800;
    font-size: 22px;
    color: var(--text-primary);
    margin: 0;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 4px 0 0;
}

.login-btn {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: .3px;
}

.login-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59,130,246,.4);
}

/* ─── Result Page ────────────────────────────────────────────────────────── */
.result-page {
    min-height: 100vh;
    background: var(--body-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.result-card {
    background: white;
    border-radius: 20px;
    padding: 52px 44px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,.1);
}

.result-icon {
    font-size: 72px;
    margin-bottom: 20px;
    display: block;
}

/* ─── Webhook Event Row ──────────────────────────────────────────────────── */
.event-type-badge {
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
    padding: 4px 10px;
    border-radius: 6px;
    background: #f1f5f9;
    color: var(--text-primary);
    white-space: nowrap;
}

.verified-check   { color: #10b981; }
.unverified-cross { color: #ef4444; }

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.pagination .page-link {
    border-radius: 8px !important;
    margin: 0 2px;
    color: var(--brand-color);
    border-color: var(--card-border);
    font-weight: 500;
    font-size: 14px;
}

.pagination .page-item.active .page-link {
    background: var(--brand-color);
    border-color: var(--brand-color);
}

/* ─── Alert tweaks ───────────────────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); border: none; font-size: 14px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger  { background: #fee2e2; color: #991b1b; }

/* ─── Copy success animation ─────────────────────────────────────────────── */
@keyframes copied { 0%,100% { opacity:1 } 50% { opacity:.4 } }
.copied { animation: copied .4s ease; }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
.mobile-topbar {
    background: var(--sidebar-bg);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    padding: 0;
    cursor: pointer;
}

.mobile-brand { font-weight: 700; font-size: 16px; }

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .page-header {
        padding: 20px 16px 0;
        flex-direction: column;
    }
    .page-body {
        padding: 16px 16px 32px;
    }
    .stat-value { font-size: 22px; }
}

@media (max-width: 575.98px) {
    .login-card  { padding: 32px 24px; }
    .result-card { padding: 36px 24px; }
    .page-title  { font-size: 20px; }
}
