/* PayVault Merchant Portal — CSS */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-glass: rgba(17, 24, 39, 0.5);
    --border-color: rgba(6, 182, 212, 0.15);
    --border-active: rgba(6, 182, 212, 0.4);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.3);
    --accent-hover: #22d3ee;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 4px 24px rgba(0,0,0,0.3);
    --transition: all 0.2s ease;
    --sidebar-width: 260px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { font-family: var(--font); background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; -webkit-font-smoothing: antialiased; }

/* ─── Login ──────────────────────────────────────────────────────────────── */
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0a0e17 0%, #0f172a 50%, #0a0e17 100%); }
.login-card { background: var(--bg-card); backdrop-filter: blur(20px); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 48px; width: 420px; max-width: 90vw; box-shadow: var(--shadow-card); }
.login-card .logo { text-align: center; margin-bottom: 32px; }
.login-card .logo h1 { font-size: 28px; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent-hover)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-card .logo p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.login-card .form-group { margin-bottom: 20px; }
.login-card label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.login-card input { width: 100%; padding: 12px 16px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px; transition: var(--transition); outline: none; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.login-card .btn-login { width: 100%; padding: 12px; background: linear-gradient(135deg, var(--accent), #0891b2); border: none; border-radius: var(--radius-sm); color: white; font-size: 15px; font-weight: 600; cursor: pointer; transition: var(--transition); margin-top: 8px; }
.login-card .btn-login:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.login-card .error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; display: none; }

/* ─── Shell Layout ───────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(11, 17, 32, 0.95);
    backdrop-filter: blur(24px);
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
    position: fixed; height: 100vh;
    z-index: 100;
}

.sidebar-header { padding: 20px 16px; border-bottom: 1px solid var(--border-color); }
.sidebar-logo { display: flex; align-items: center; gap: 12px; }
.logo-name { font-size: 16px; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent-hover)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.logo-sub { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); padding: 16px 12px 6px; font-weight: 600; }

.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none;
    font-size: 13.5px; font-weight: 500;
    transition: var(--transition); margin-bottom: 1px;
}
.nav-link:hover { background: rgba(6, 182, 212, 0.08); color: var(--text-primary); }
.nav-link.active { background: rgba(6, 182, 212, 0.12); color: var(--accent); }
.nav-link.active .nav-icon { color: var(--accent); }

.nav-icon { width: 17px; height: 17px; flex-shrink: 0; color: var(--text-muted); transition: var(--transition); }
.nav-link:hover .nav-icon { color: var(--text-primary); }
.nav-external { width: 11px; height: 11px; margin-left: auto; opacity: 0.4; }
.nav-label { flex: 1; }
.nav-badge { font-size: 10px; font-weight: 700; background: var(--danger); color: white; padding: 1px 6px; border-radius: 10px; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border-color); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); margin-bottom: 8px; background: rgba(255,255,255,0.03); }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #0891b2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.user-info-text { overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { width: 100%; padding: 8px 12px; background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.2); border-radius: var(--radius-sm); color: var(--danger); font-size: 12px; font-weight: 500; cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-logout i { width: 13px; height: 13px; }
.btn-logout:hover { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.35); }

/* ─── Main content ───────────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); flex: 1; padding: 32px; min-height: 100vh; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--text-secondary); font-size: 13.5px; margin-top: 4px; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card { background: var(--bg-card); backdrop-filter: blur(16px); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-card); margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); backdrop-filter: blur(16px); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 20px; transition: var(--transition); }
.stat-card:hover { border-color: var(--border-active); transform: translateY(-1px); }
.stat-card .stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; font-weight: 600; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 10px 16px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); border-bottom: 1px solid var(--border-color); font-weight: 600; }
tbody td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--text-secondary); }
tbody tr:hover { background: rgba(6, 182, 212, 0.03); }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.success { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.badge.danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge.warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge.info { background: rgba(59, 130, 246, 0.12); color: var(--info); }
.badge.muted { background: rgba(100, 116, 139, 0.12); color: var(--text-muted); }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn { padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; transition: var(--transition); border: none; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font); }
.btn i { flex-shrink: 0; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #0891b2); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
.btn-secondary { background: var(--bg-secondary); border: 1px solid var(--border-color); color: var(--text-secondary); }
.btn-secondary:hover { border-color: var(--border-active); color: var(--text-primary); }
.btn-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.25); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.22); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 14px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13.5px; transition: var(--transition); outline: none; font-family: var(--font); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); animation: fadeIn 0.15s ease; }
.modal { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 28px; width: 520px; max-width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,0.5); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.modal-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.modal-close i { width: 18px; height: 18px; }
.modal-body { }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-color); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Code blocks ────────────────────────────────────────────────────────── */
.code-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border-color); }
.code-tab { padding: 8px 16px; font-size: 12px; font-weight: 500; color: var(--text-muted); cursor: pointer; border: none; background: none; transition: var(--transition); border-bottom: 2px solid transparent; font-family: var(--font); }
.code-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.code-block { background: #070c14; border: 1px solid var(--border-color); border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding: 16px; overflow-x: auto; position: relative; }
.code-block pre { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65; color: #c9d1d9; white-space: pre; }
.code-block .btn-copy { position: absolute; top: 8px; right: 8px; padding: 4px 10px; font-size: 11px; }

/* ─── Webhook list ───────────────────────────────────────────────────────── */
.webhook-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 12px; transition: var(--transition); }
.webhook-card:hover { border-color: var(--border-active); }
.webhook-url { font-family: var(--font-mono); font-size: 13px; color: var(--accent); word-break: break-all; }
.webhook-events { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.webhook-event { font-size: 11px; padding: 2px 8px; background: rgba(6, 182, 212, 0.08); border: 1px solid rgba(6, 182, 212, 0.2); border-radius: 4px; color: var(--accent); }
.webhook-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ─── Key display ────────────────────────────────────────────────────────── */
.key-display { display: flex; align-items: center; gap: 10px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 12px; }
.key-display .key-prefix { font-family: var(--font-mono); font-size: 14px; color: var(--accent); flex: 1; }
.key-display .key-full { font-family: var(--font-mono); font-size: 12px; color: var(--success); flex: 1; word-break: break-all; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
#toast-container, .toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; animation: toastIn 0.3s ease; box-shadow: 0 4px 20px rgba(0,0,0,0.35); pointer-events: all; max-width: 360px; }
.toast.success { background: rgba(16, 185, 129, 0.92); color: white; backdrop-filter: blur(8px); }
.toast.error { background: rgba(239, 68, 68, 0.92); color: white; backdrop-filter: blur(8px); }
.toast.warning { background: rgba(245, 158, 11, 0.92); color: white; backdrop-filter: blur(8px); }
.toast.info { background: rgba(59, 130, 246, 0.92); color: white; backdrop-filter: blur(8px); }
.toast.fade-out { animation: toastOut 0.4s ease forwards; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(20px); } }

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-icon { display: flex; justify-content: center; margin-bottom: 16px; opacity: 0.35; }
.empty-icon i { width: 48px; height: 48px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ─── Loading ────────────────────────────────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; padding: 48px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border-color); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Checkbox ───────────────────────────────────────────────────────────── */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); font-size: 12px; }
.checkbox-item:hover { border-color: var(--border-active); }
.checkbox-item input { width: 14px; height: 14px; accent-color: var(--accent); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 16px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
