/* ForgeCommerce Admin — CSS */
/* Minimal, functional admin styles. No framework dependency. */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
  --topbar-height: 56px;
  --radius: 6px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 14px; line-height: 1.5; background: var(--gray-50); color: var(--gray-900); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--gray-900); color: white; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; transition: width 0.2s; overflow: hidden; display: flex; flex-direction: column; }
.sidebar-collapsed { width: var(--sidebar-collapsed); }
.sidebar-header { padding: 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.logo { font-size: 20px; font-weight: 700; color: var(--primary); background: white; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); flex-shrink: 0; font-size: 12px; }
.logo-text { font-size: 16px; font-weight: 600; white-space: nowrap; }
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-link { display: block; padding: 8px 16px; color: var(--gray-300); font-size: 13px; transition: background 0.15s; white-space: nowrap; }
.nav-link:hover { background: rgba(255,255,255,0.08); color: white; text-decoration: none; }
.nav-link-active { background: rgba(255,255,255,0.12); color: white; border-right: 3px solid var(--primary); }
.nav-divider { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 8px 16px; }

.main-content { flex: 1; margin-left: var(--sidebar-width); transition: margin-left 0.2s; }
.top-bar { height: var(--topbar-height); background: white; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 50; }
.top-bar-right { display: flex; align-items: center; gap: 12px; }
.content-area { padding: 24px; }

/* Page header */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 24px; font-weight: 600; }

/* Cards */
.card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.card-header { padding: 12px 16px; font-weight: 600; font-size: 13px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--gray-200); }
.card-body { padding: 16px; }
.stat-value { font-size: 28px; font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }

/* Login */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-100); padding: 20px; }
.login-card { background: white; border: 1px solid var(--gray-200); border-radius: 8px; padding: 32px; width: 100%; max-width: 400px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.login-card-wide { max-width: 520px; }
.login-header { text-align: center; margin-bottom: 24px; }
.login-header h1 { font-size: 24px; font-weight: 700; }
.login-header p { color: var(--gray-500); margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--gray-700); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 14px; width: 100%; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer; background: white; color: var(--gray-700); transition: all 0.15s; }
.btn:hover { background: var(--gray-50); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-full { width: 100%; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 20px; padding: 4px 8px; color: var(--gray-700); }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: var(--warning); border: 1px solid #fde68a; }

/* 2FA setup */
.setup-2fa { text-align: center; }
.qr-code { margin: 16px 0; }
.qr-code img { border-radius: var(--radius); }
.secret-key { font-size: 12px; color: var(--gray-500); margin-bottom: 16px; }
.secret-key code { background: var(--gray-100); padding: 4px 8px; border-radius: 4px; font-size: 11px; letter-spacing: 0.05em; }
.recovery-codes { padding: 16px 0; }
.codes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0; }
.recovery-code { display: block; padding: 8px 12px; background: var(--gray-100); border-radius: 4px; text-align: center; font-size: 14px; letter-spacing: 0.1em; }

/* Tables */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 2px solid var(--gray-200); }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); }
tbody tr:hover { background: var(--gray-50); }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-success { background: #dcfce7; color: var(--success); }
.badge-warning { background: #fef3c7; color: var(--warning); }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-muted { background: var(--gray-100); color: var(--gray-500); }
.badge-primary { background: #dbeafe; color: var(--primary); }

/* Form grid */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* HTMX indicators */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }

/* Tabs */
.tab-link:hover { color: var(--gray-900); }
.tab-active { color: var(--primary) !important; border-bottom-color: var(--primary) !important; font-weight: 500; }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; z-index: 200; }
.modal-overlay.active { display: flex; }
.modal-content { background: white; border-radius: 8px; box-shadow: 0 4px 24px rgba(0,0,0,0.15); max-height: 80vh; overflow-y: auto; width: 90%; max-width: 500px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--gray-200); }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 16px; }

/* Keyboard shortcut keys */
kbd { display: inline-block; padding: 2px 6px; background: var(--gray-100); border: 1px solid var(--gray-300); border-radius: 4px; font-family: monospace; font-size: 12px; line-height: 1.4; min-width: 22px; text-align: center; }

/* Toast notifications */
.toast { position: fixed; bottom: 20px; right: 20px; padding: 10px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 500; z-index: 300; opacity: 0; transform: translateY(10px); transition: all 0.3s; pointer-events: none; }
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-warning { background: var(--warning); color: white; }

/* Batch actions bar */
#batch-actions { display: none; align-items: center; gap: 12px; padding: 8px 16px; background: #dbeafe; border-radius: var(--radius); margin-bottom: 12px; }
.batch-count { font-weight: 600; color: var(--primary); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .logo-text { display: none; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
