/* ============================================================
   REV* Velocity Lab — Admin Theme
   Modern Shopify-style dark UI with Archivo Black + Inter
   Color scheme from rev.com.ph
   ============================================================ */

:root {
  --black: #000000;
  --bg: #0A0A0A;
  --surface: #141414;
  --card: #1C1C1C;
  --card-hover: #242424;
  --border: #2A2A2A;
  --border-light: #3A3A3A;
  --white: #FFFFFF;
  --text-secondary: #9A9A9A;
  --text-muted: #666666;
  --accent: #E2FF00;
  --error: #FC4F4F;
  --success: #34D399;
  --warning: #FBBF24;
  --info: #6366F1;

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--white);
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Archivo Black', 'Inter', sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

a { color: var(--white); text-decoration: none; }
code, .font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.85em; }

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

.sidebar.collapsed { width: 0; overflow: hidden; }

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-mark {
  font-family: 'Archivo Black', sans-serif;
  font-size: 24px;
  color: var(--white);
  letter-spacing: 3px;
  line-height: 1;
}

.brand-sub {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 4px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section {
  padding: 8px 12px 4px;
}

.nav-section-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  padding: 8px 8px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  margin: 1px 0;
}

.nav-item:hover {
  background: var(--surface);
  color: var(--white);
}

.nav-item.active {
  background: var(--surface);
  color: var(--white);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 3px;
  height: 20px;
  background: var(--white);
  border-radius: 0 2px 2px 0;
}

.nav-item i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 8px 12px 16px;
  border-top: 1px solid var(--border);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.2s ease;
}

.sidebar.collapsed ~ .main-content { margin-left: 0; }

/* Topbar */
.topbar {
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

.sidebar-toggle:hover { background: var(--surface); }

.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 18px; margin: 0; }
.topbar-title p { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-user { display: flex; align-items: center; gap: 8px; }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Page Content */
.page-content { padding: 24px; }

/* Alerts */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  margin: 0 24px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}

.alert-success { background: rgba(52, 211, 153, 0.1); color: var(--success); border: 1px solid rgba(52, 211, 153, 0.2); }
.alert-error { background: rgba(252, 79, 79, 0.1); color: var(--error); border: 1px solid rgba(252, 79, 79, 0.2); }

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.6;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 14px;
  font-family: 'Archivo Black', sans-serif;
  letter-spacing: 0.5px;
}

.card-body { padding: 20px; }

.card-footer {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stats-grid-sm {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 0;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.stat-card-sm {
  padding: 14px;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-info { display: flex; flex-direction: column; }

.stat-value {
  font-family: 'Archivo Black', sans-serif;
  font-size: 22px;
  color: var(--white);
  line-height: 1.1;
}

.stat-card-sm .stat-value { font-size: 18px; }

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

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* Integration Grid */
.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.integration-card .card-body { padding: 20px; }

.integration-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.integration-icon {
  width: 42px;
  height: 42px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
}

.integration-name {
  font-size: 16px;
  margin-bottom: 4px;
}

/* Tables */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover { background: var(--surface); }

.table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* User Cell */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-success { background: rgba(52, 211, 153, 0.12); color: var(--success); }
.badge-error   { background: rgba(252, 79, 79, 0.12); color: var(--error); }
.badge-warning { background: rgba(251, 191, 36, 0.12); color: var(--warning); }
.badge-accent  { background: rgba(226, 255, 0, 0.12); color: var(--accent); }
.badge-muted   { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-primary {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}

.btn-primary:hover { background: #e0e0e0; }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--surface);
  color: var(--white);
  border-color: var(--border-light);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: rgba(252, 79, 79, 0.3);
}

.btn-danger:hover { background: rgba(252, 79, 79, 0.1); }

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="datetime-local"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.15s ease;
  line-height: 1.4;
  height: auto;
  margin: 0;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--white);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-error {
  display: block;
  font-size: 12px;
  color: var(--error);
  margin-top: 4px;
}

.toggle-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px !important;
  color: var(--white) !important;
}

.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Breakdown Bars */
.breakdown-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.breakdown-label {
  width: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.breakdown-bar {
  flex: 1;
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}

.breakdown-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #c4e600);
  border-radius: 4px;
  min-width: 4px;
  transition: width 0.5s ease;
}

.breakdown-value {
  font-family: 'Archivo Black', sans-serif;
  font-size: 14px;
  color: var(--white);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s ease;
  text-align: center;
}

.quick-action:hover {
  background: var(--card-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.quick-action i {
  font-size: 24px;
  color: var(--text-secondary);
}

.quick-action span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Detail Rows */
.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Code Block */
.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 12px;
  overflow-x: auto;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* API Key Display */
.api-key-display {
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--border);
}

/* Utility Classes */
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-semibold { font-weight: 600; }
.py-lg { padding-top: 32px !important; padding-bottom: 32px !important; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 16px; }
}
