/* ═══════════════════════════════════════════════════════════════
   WAKEED DESIGN SYSTEM - LIGHT THEME
   Based on Wakeed Brand Colors
   Primary: #1e6aa8 (Blue)
   Secondary: #2dd4bf (Teal/Turquoise)
═══════════════════════════════════════════════════════════════ */

/* ─── Design Tokens (Light Theme) ─── */
:root {
  /* Wakeed Brand Colors */
  --wakeed-blue: #1e6aa8;
  --wakeed-blue-dark: #164d7a;
  --wakeed-blue-light: #4a9bd6;
  --wakeed-teal: #2dd4bf;
  --wakeed-teal-dark: #1fa89a;
  --wakeed-teal-light: #6ee7d8;
  
  /* Light Backgrounds */
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #e2e8f0;
  
  /* Accent Colors (Wakeed Brand) */
  --accent: #1e6aa8;
  --accent-dim: #164d7a;
  --accent-glow: rgba(30, 106, 168, 0.15);
  --accent-soft: rgba(30, 106, 168, 0.08);
  --teal: #2dd4bf;
  --teal-soft: rgba(45, 212, 191, 0.12);
  
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* Text Colors (Dark for light bg) */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-accent: #1e6aa8;
  
  /* Borders */
  --border: rgba(0, 0, 0, 0.08);
  --border-mid: rgba(0, 0, 0, 0.12);
  --border-focus: rgba(30, 106, 168, 0.5);
  
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
  
  --transition: .2s cubic-bezier(.4, 0, .2, 1);
}

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

html { height: 100%; }

body {
  font-family: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* ─── Background Effects (Light) ─── */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 30% 20%, rgba(30, 106, 168, .08) 0%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 75% 80%, rgba(45, 212, 191, .06) 0%, transparent 70%);
  z-index: 0;
}

/* ─── Scrollbar (Light) ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .15); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, .25); }

/* ─── Buttons (Wakeed Brand) ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(30, 106, 168, .3);
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(30, 106, 168, .4);
}

.btn:active:not(:disabled) { transform: translateY(0); }

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn svg { width: 16px; height: 16px; }

/* Secondary Button */
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-mid);
  color: var(--text-primary);
  transform: none;
  box-shadow: none;
}

/* Header Button */
.header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.header-btn svg { width: 13px; height: 13px; }

.header-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-mid);
  color: var(--text-primary);
}

.header-btn.danger:hover {
  border-color: rgba(239, 68, 68, .35);
  color: var(--danger);
  background: rgba(239, 68, 68, .06);
}

/* ─── Form Elements ─── */
.field-group { margin-bottom: 16px; }

.field-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.field-group label svg { width: 13px; height: 13px; opacity: .7; }

.field-group input,
.field-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', monospace;
  font-size: 13.5px;
  direction: ltr;
  text-align: left;
  transition: all var(--transition);
  outline: none;
}

.field-group input:focus,
.field-group textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-group input::placeholder,
.field-group textarea::placeholder { color: var(--text-muted); }

/* Highlighted Field (Teal) */
.field-group.highlight input {
  border-color: rgba(45, 212, 191, .5);
  background: rgba(45, 212, 191, .04);
}

.field-group.highlight label { color: #0d9488; }

.field-group.highlight input:focus {
  box-shadow: 0 0 0 3px rgba(45, 212, 191, .15);
}

/* ─── Auth Card (Light Theme) ─── */
.auth-card {
  position: relative;
  width: 460px;
  max-width: calc(100vw - 32px);
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  padding: 48px 40px 40px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(30, 106, 168, .05);
  animation: cardIn .5s cubic-bezier(.34, 1.56, .64, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(28px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: linear-gradient(90deg, transparent, var(--teal), var(--accent), var(--teal), transparent);
}

.auth-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(145deg, #fff, #f1f5f9);
  border: 1px solid rgba(30, 106, 168, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 40px rgba(30, 106, 168, .15), 0 0 0 8px rgba(30, 106, 168, .04);
}

.auth-logo img { width: 48px; height: 48px; object-fit: contain; }

.auth-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.3px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 32px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 18px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-error {
  color: var(--danger);
  font-size: 12.5px;
  text-align: center;
  margin-top: 12px;
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ─── Auth Overlay (Light) ─── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  transition: opacity .5s ease, transform .5s ease;
}

.auth-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 30% 20%, rgba(30, 106, 168, .06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 75% 80%, rgba(45, 212, 191, .05) 0%, transparent 70%);
  pointer-events: none;
}

.auth-overlay.hidden {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

/* ─── Status Badge ─── */
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  display: inline-block;
}

/* ─── Spinner ─── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  animation: spin .8s linear infinite;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--success);
  color: #fff;
  padding: 10px 22px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(34, 197, 94, .3);
  transition: transform .3s cubic-bezier(.34, 1.2, .64, 1);
  z-index: 400;
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); box-shadow: 0 8px 24px rgba(239, 68, 68, .3); }

/* ─── Filter Selects ─── */
.filter-select {
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
}

.filter-select.wide { width: 300px; }

/* ─── Modal Overlay ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

/* ─── Modal Card ─── */
.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 400px;
}

.modal-card h3 {
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── Form Input ─── */
.form-input {
  width: 100%;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
}

/* ─── Grid Columns for Tables ─── */
.grid-col-2 { grid-template-columns: 2fr 1fr 1fr 2fr; }
.grid-col-6 { grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr; }
.grid-col-7 { grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr 1fr 0.8fr; }
.grid-col-8 { grid-template-columns: 1.5fr 1.2fr 0.8fr 0.7fr 1.2fr 0.8fr 1fr 0.7fr; }
.grid-col-models { grid-template-columns: 1fr 2fr 1fr 1.2fr 1fr 0.8fr; }
.grid-col-requests { grid-template-columns: 130px 140px minmax(200px, 2fr) 85px 70px 80px 70px 95px 60px; }

/* Request table row - taller to fit multi-line agents */
#requestsList .table-row {
  min-height: 70px;
  padding: 12px 16px;
}
.grid-col-requests { grid-template-columns: 120px 140px 2fr 90px 70px 90px 80px 110px 70px; }

/* ─── Preset Button (model config quick presets) ─── */
.preset-btn {
  padding: 4px 12px;
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ─── Pagination ─── */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 16px;
}

.pagination-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: var(--bg-card);
}

.pagination-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ─── Page Header ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-desc {
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── Model Cards ─── */
.model-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-card.unavailable { opacity: 0.5; }

.model-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(30, 106, 168, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.model-card.unavailable .model-card-icon {
  background: var(--bg-hover);
}

/* ─── Tab Navigation ─── */
.tabs-nav {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 14px 24px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
}

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

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

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

.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--accent); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.stat-card.success .stat-icon { background: rgba(34, 197, 94, .1); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245, 158, 11, .1); color: var(--warning); }
.stat-card.danger .stat-icon { background: rgba(239, 68, 68, .1); color: var(--danger); }
.stat-card.info .stat-icon { background: rgba(30, 106, 168, .1); color: var(--accent); }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Table Styles ─── */
.data-table {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-header {
  display: grid;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.table-row {
  display: grid;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  align-items: center;
  transition: background var(--transition);
}

.table-row:last-child { border-bottom: none; }
.table-row:hover { background: var(--bg-hover); }

/* ─── Utilities ─── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.mb-4 { margin-bottom: 4px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-2 { gap: 2px; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--text-accent); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-monospace { font-family: monospace; }
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ─── Width & Spacing ─── */
.w-full { width: 100%; }
.mt-10 { margin-top: 10px; }

/* ─── Icons ─── */
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 24px; height: 24px; }

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

/* ─── Table Cell Padding ─── */
.td-right { padding: 12px; text-align: right; }
.td-sm { padding: 10px; }

/* ─── Badge Colors ─── */
.tier-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* ─── Logs Table ─── */
.logs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.logs-header { padding: 16px 20px; background: var(--bg-card); border-bottom: 1px solid var(--border); font-weight: 600; }

/* ─── Models Grid ─── */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

/* ─── Text Colors ─── */
.text-secondary { color: var(--text-secondary); }

/* ─── Margin 12px ─── */
.mb-12 { margin-bottom: 12px; }

/* ─── Table Header for JS ─── */
.table-section-header {
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

/* ─── Phone Display ─── */
.phone-display {
  font-size: 12px;
  direction: ltr;
  text-align: right;
}

/* ─── Subscription Display ─── */
.subscription-display {
  font-size: 12px;
  color: var(--text-accent);
}

/* ─── Inline Icon ─── */
.icon-inline {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
}

/* ─── Tooltip ─── */
.tooltip {
  cursor: help;
  opacity: 0.6;
  font-size: 12px;
}

.tooltip:hover {
  opacity: 1;
}

/* ─── Input Help Text ─── */
.input-help {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

/* ─── Model Card Recommended ─── */
.model-card.recommended {
  border-color: rgba(30, 106, 168, 0.4);
  background: rgba(30, 106, 168, 0.03);
}

/* ─── Icon Sizes ─── */
.icon-lg { width: 40px; height: 40px; }
.object-contain { object-fit: contain; }

/* ─── Code Block ─── */
.code-inline {
  background: rgba(30, 106, 168, .1);
  border: 1px solid rgba(30, 106, 168, .15);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  color: #1e6aa8;
}

/* ─── Color Utilities ─── */
.text-wakeed-blue { color: #1e6aa8; }
.text-wakeed-teal { color: #2dd4bf; }

/* ─── Tab Button ─── */
.tab-btn-alt {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn-alt:hover { color: var(--text-primary); background: var(--bg-elevated); }

.tab-btn-alt.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 600;
}

/* ─── Modal Logo Container ─── */
.modal-logo-wrap {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(30, 106, 168, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 40px rgba(30, 106, 168, .15);
}

/* ─── Tab Row ─── */
.tab-row {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

/* ─── Emoji Block ─── */
.emoji-block {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}
