/* ============================================
   Glidyr Dashboard Styles
   Matches layout.ejs design tokens from theme.css
   ============================================ */

:root {
  --bg: #0c0f1a;
  --bg-2: #13172a;
  --surface: #1a1e30;
  --surface-2: #20243a;
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.12);
  --amber-glow: rgba(245, 158, 11, 0.06);
  --ivory: #faf7f0;
  --muted: #a8adc4;
  --subtle: #5c6380;
  --border: rgba(168, 173, 196, 0.1);
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

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

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--ivory);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ivory);
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
}

.sidebar-nav { flex: 1; padding: 1rem 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  border-radius: 0;
}

.nav-link:hover { color: var(--ivory); background: var(--surface); }
.nav-link.active { color: var(--amber); background: var(--amber-dim); }

.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--subtle);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 2rem;
  max-width: 1100px;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ivory);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- Stats Row ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--subtle);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ivory);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-value.amber { color: var(--amber); }
.stat-value.success { color: var(--success); }
.stat-value.error { color: var(--error); }

.stat-sub { font-size: 0.8rem; color: var(--muted); }

/* ---- Section ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ivory);
}

/* ---- Activity Feed ---- */
.activity-list { display: flex; flex-direction: column; gap: 0.5rem; }

.activity-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: border-color 0.15s;
}

.activity-item:hover { border-color: rgba(168, 173, 196, 0.2); }

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.activity-icon.found { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.activity-icon.submitted { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.activity-icon.failed { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.activity-icon.scored { background: rgba(168, 173, 196, 0.1); color: var(--muted); }
.activity-icon.profile_updated { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.activity-icon.filled_preview { background: rgba(168, 173, 196, 0.1); color: var(--muted); }

.activity-body { flex: 1; min-width: 0; }

.activity-action {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ivory);
  margin-bottom: 0.15rem;
}

.activity-meta {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--subtle);
  flex-shrink: 0;
}

/* ---- Job Cards ---- */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.15s, transform 0.15s;
}

.job-card:hover { border-color: rgba(168, 173, 196, 0.2); transform: translateY(-1px); }

.job-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.job-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ivory);
  line-height: 1.3;
}

.job-company {
  font-size: 0.825rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.job-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.score-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  background: var(--amber-dim);
  color: var(--amber);
  font-weight: 600;
}

.job-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--amber);
  color: #0c0f1a;
  border-color: var(--amber);
}

.btn-primary:hover { background: #d97706; border-color: #d97706; }

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

.btn-secondary:hover { color: var(--ivory); border-color: rgba(168, 173, 196, 0.3); background: var(--surface); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.875rem;
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.15s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--amber);
  background: var(--surface);
}

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

.form-hint { font-size: 0.8rem; color: var(--subtle); margin-top: 0.35rem; }

.form-error { font-size: 0.8rem; color: var(--error); margin-top: 0.35rem; }

/* ---- Discover Form ---- */
.discover-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.discover-form .form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.discover-form .form-input { flex: 1; }

/* ---- Alerts ---- */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: var(--success); }
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--error); }
.alert-info { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); color: #3b82f6; }

/* ---- Status Badge ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

.status-badge.pending { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.status-badge.submitted { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-badge.failed { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.status-badge.discovered { background: rgba(168, 173, 196, 0.1); color: var(--muted); }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--subtle);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1rem; color: var(--muted); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; }

/* ---- Section divider ---- */
.section { margin-bottom: 2.5rem; }

/* ---- Profile form ---- */
.profile-form {
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

/* ---- Tabs ---- */
.tab-row {
  display: flex;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
  width: fit-content;
}

.tab-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.tab-btn:hover { color: var(--ivory); }
.tab-btn.active { background: var(--amber); color: #0c0f1a; }

/* ---- Loading spinner ---- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 15, 26, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 3rem;
  text-align: center;
}

.loading-box p { color: var(--muted); font-size: 0.9rem; margin-top: 0.75rem; }

/* ---- Animations ---- */
.fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

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

@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 1rem; }
  .jobs-grid { grid-template-columns: 1fr; }
}