/* FinishAI — Global Design System & Styles (Linear.app Aesthetic + macOS Dock) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ─── EXACT COLORS & DESIGN TOKENS ────────────────────────────────────────── */
:root {
  --bg-page: #0A0F1E;
  --bg-card: #162038;
  --bg-elevated: #1D2A4A;
  --bg-hover: #25345A;
  --bg-active: #2D3E6B;
  --primary: #3B82F6;
  --purple: #8B5CF6;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --border-default: #283658;
  --border-subtle: #1D2846;
  --border-active: #3B82F6;

  /* Aliases & Gradients for backwards compatibility during migration */
  --bg-main: var(--bg-page);
  --bg-secondary: var(--bg-card);
  --bg-input: var(--bg-elevated);
  --border: var(--border-default);
  --border-hover: var(--border-active);
  --primary-dark: #2563EB;
  --primary-light: #60A5FA;
  --secondary: var(--purple);
  --gradient: linear-gradient(135deg, var(--primary), var(--purple));
  --gradient-hover: linear-gradient(135deg, #2563EB, #7C3AED);
  --gradient-text: linear-gradient(135deg, #60A5FA, #A78BFA);
  --gradient-warm: linear-gradient(135deg, var(--warning), var(--danger));
  --gradient-success: linear-gradient(135deg, var(--success), #059669);

  --success-bg: rgba(16, 185, 129, 0.15);
  --warning-bg: rgba(245, 158, 11, 0.15);
  --error-bg: rgba(239, 68, 68, 0.15);
  --info-bg: rgba(59, 130, 246, 0.15);
  --error: var(--danger);
  --info: var(--primary);

  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);

  --border-radius: 10px;
  --radius: 10px;

  --transition: all 150ms ease;
  --transition-fast: all 150ms ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-light);
}

/* ─── TYPOGRAPHY ────────────────────────────────────────────────────────────── */
.section-label, .uppercase-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

body, p, .body-text {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}

.content-text {
  font-size: 14px;
  font-weight: 500;
  color: #E2E8F0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

h1 { font-size: 20px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
h4 { font-size: 15px; }
h5, h6 { font-size: 14px; }

.stat-num, .number-bold, strong, b {
  font-weight: 700;
}

.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-error { color: var(--danger) !important; }
.text-center { text-align: center; }

/* ─── TOP BAR (APPLY TO ALL PAGES) ─────────────────────────────────────────── */
.topbar, .topbar-fixed {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-default);
  z-index: 99999 !important;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-brand {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid #3B82F6;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ─── BOTTOM DOCK (APPLY TO ALL PAGES) ─────────────────────────────────────── */
.dock {
  position: fixed !important;
  bottom: 24px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: rgba(22, 32, 56, 0.95) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 99px !important;
  padding: 8px 16px !important;
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  z-index: 99999 !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
}

.dock-item {
  position: relative;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: all 150ms ease;
  text-decoration: none;
}

.dock-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.dock-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  transform: translateY(-2px);
}

.dock-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}

.dock-item.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
}

.dock-item::before {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--border-default);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
  border: 1px solid #2D3748;
}

.dock-item:hover::before {
  opacity: 1;
}

/* ─── PAGE CONTENT PADDING & LAYOUT ────────────────────────────────────────── */
.app-layout {
  display: block;
  min-height: 100vh;
}

.main-content {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  padding-top: 60px;
  padding-bottom: 80px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── CARDS (APPLY EVERYWHERE) ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 16px 20px;
  transition: border-color 150ms ease;
}

.card:hover {
  border-color: #2D3748;
}

/* ─── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 7px 14px;
}

.btn-primary:hover {
  background: #2563EB;
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  padding: 6px 12px;
}

.btn-ghost:hover {
  color: var(--text-secondary);
  border-color: #2D3748;
  background: var(--bg-card);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  padding: 6px 12px;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: #2D3748;
  color: var(--text-primary);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid #2D1515;
  padding: 6px 12px;
}

.btn-danger:hover {
  background: #2D1515;
  color: var(--danger);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: #2D3748;
}

/* ─── FORMS & UTILITIES ─────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.form-input, .form-textarea, .form-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  transition: border-color 150ms ease;
  width: 100%;
  outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary);
}

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

.form-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

/* ─── BADGES / STATUS CHIPS ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.badge-personal { background: #1A1A3E; color: var(--purple); }
.badge-study { background: #0F2E1E; color: var(--success); }
.badge-work { background: #1E2A0F; color: #84CC16; }
.badge-on_track, .badge-success { background: #0F2E1E; color: var(--success); }
.badge-behind, .badge-error { background: #2E0F0F; color: var(--danger); }
.badge-at_risk, .badge-warning { background: #2E1E0F; color: var(--warning); }
.badge-muted { background: var(--bg-elevated); color: var(--text-muted); }

/* ─── GRID & LAYOUT UTILITIES ───────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

/* ─── PROGRESS BAR ──────────────────────────────────────────────────────────── */
.progress-bar-container {
  width: 100%;
  height: 4px;
  background: var(--border-default);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--primary);
  transition: width 150ms ease;
}

/* ─── TOASTS & MODALS ───────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text-primary);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}

.modal-close:hover { color: var(--text-primary); }

.logo { width: 80px; height: 80px; }
.app-logo-icon { width: 28px; height: 28px; border-radius: 6px; }

/* ─── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding-left: 14px; padding-right: 14px; }
  .topbar { padding: 0 14px; }
}
