/* ============================================================
   FCS — Freelancer Control System
   Design: Industrial-modern, dark-first, high contrast
   Fonts: Syne (headings) + DM Sans (body)
   ============================================================ */

:root {
  --bg:          #0e0f13;
  --bg-2:        #14161d;
  --bg-3:        #1c1f2a;
  --border:      rgba(255,255,255,0.07);
  --border-2:    rgba(255,255,255,0.12);
  --text:        #e8eaf0;
  --text-2:      #9298a8;
  --text-3:      #5c6070;
  --accent:      #5b6ef5;
  --accent-2:    #7c8fff;
  --accent-glow: rgba(91,110,245,0.25);
  --success:     #22c55e;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --info:        #06b6d4;
  --sidebar-w:   240px;
  --topbar-h:    60px;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:   0 2px 12px rgba(0,0,0,0.3);
  --transition:  0.2s ease;
}

[data-theme="light"] {
  --bg:       #f4f5f9;
  --bg-2:     #ffffff;
  --bg-3:     #eef0f5;
  --border:   rgba(0,0,0,0.07);
  --border-2: rgba(0,0,0,0.12);
  --text:     #1a1d26;
  --text-2:   #5c6070;
  --text-3:   #9298a8;
  --shadow:   0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm:0 2px 12px rgba(0,0,0,0.06);
}

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

html { font-size: 15px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

h1, h2, h3, h4, h5, h6,
.syne { font-family: 'Syne', sans-serif; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }

/* ── Sidebar ───────────────────────────────────────────────── */
.fcs-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.fcs-sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}
.brand-icon svg { width: 18px; height: 18px; }
.brand-text {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  margin: 10px 12px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
}
.user-avatar {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.user-role { font-size: 0.72rem; color: var(--text-3); }

.sidebar-nav {
  list-style: none;
  padding: 8px 0;
  margin: 0;
  flex: 1;
}
.nav-section {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 14px 20px 4px;
}
.nav-item { position: relative; }
.nav-item .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-item .nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item .nav-link:hover { background: var(--bg-3); color: var(--text); }
.nav-item .nav-link.active {
  background: var(--accent-glow);
  color: var(--accent-2);
  font-weight: 600;
}
.nav-link-danger:hover { color: var(--danger) !important; }

.badge-streak {
  margin-left: auto;
  background: linear-gradient(135deg, #ff6b35, #f7c59f);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  font-family: 'Syne', sans-serif;
}

/* ── Main layout ───────────────────────────────────────────── */
.fcs-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.fcs-topbar {
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}
.topbar-menu { display: none; color: var(--text-2); padding: 4px; }
.topbar-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.fcs-content {
  padding: 24px;
  flex: 1;
}

/* ── Cards ─────────────────────────────────────────────────── */
.fcs-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.fcs-card:hover { border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.fcs-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.fcs-card-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Stat cards */
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.income::before  { background: linear-gradient(90deg,var(--success),#4ade80); }
.stat-card.expense::before { background: linear-gradient(90deg,var(--danger),#f87171); }
.stat-card.net::before     { background: linear-gradient(90deg,var(--accent),var(--accent-2)); }
.stat-card.streak::before  { background: linear-gradient(90deg,#ff6b35,#f7c59f); }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  margin-bottom: 12px;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.green  { background: rgba(34,197,94,0.15);  color: var(--success); }
.stat-icon.red    { background: rgba(239,68,68,0.15);  color: var(--danger); }
.stat-icon.blue   { background: rgba(91,110,245,0.15); color: var(--accent-2); }
.stat-icon.orange { background: rgba(255,107,53,0.15); color: #ff6b35; }
.stat-icon.yellow { background: rgba(245,158,11,0.15); color: var(--warning); }

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 4px;
}
.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-sub {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 4px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.fcs-btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 16px;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fcs-btn-primary:hover { background: var(--accent-2); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.fcs-btn-primary svg { width: 15px; height: 15px; }

.fcs-btn-ghost {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 14px;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fcs-btn-ghost:hover { background: var(--bg-3); color: var(--text); }

/* ── Forms ─────────────────────────────────────────────────── */
.fcs-form-group { margin-bottom: 16px; }
.fcs-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.fcs-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.fcs-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.fcs-input::placeholder { color: var(--text-3); }
.fcs-input option { background: var(--bg-2); }

/* ── Tables ────────────────────────────────────────────────── */
.fcs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}
.fcs-table th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.fcs-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}
.fcs-table tr:last-child td { border-bottom: none; }
.fcs-table tr:hover td { background: var(--bg-3); }
.fcs-table .amount { font-family: 'Syne', sans-serif; font-weight: 700; }

/* ── Progress bars ─────────────────────────────────────────── */
.fcs-progress {
  height: 6px;
  background: var(--bg-3);
  border-radius: 99px;
  overflow: hidden;
}
.fcs-progress-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

/* ── Streak elements ───────────────────────────────────────── */
.streak-flame {
  font-size: 3rem;
  line-height: 1;
  display: block;
  animation: flicker 2s ease-in-out infinite;
}
@keyframes flicker {
  0%,100% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.08) rotate(2deg); }
}
.streak-number {
  font-family: 'Syne', sans-serif;
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ff6b35, #f7c59f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.streak-label { font-size: 0.8rem; color: var(--text-3); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }

/* Heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--bg-3);
  transition: transform var(--transition);
  cursor: default;
  position: relative;
}
.heatmap-cell:hover { transform: scale(1.3); z-index: 2; }
.heatmap-cell[data-count="0"]  { background: var(--bg-3); }
.heatmap-cell[data-count="1"]  { background: rgba(91,110,245,0.3); }
.heatmap-cell[data-count="2"]  { background: rgba(91,110,245,0.55); }
.heatmap-cell[data-count="3"]  { background: rgba(91,110,245,0.75); }
.heatmap-cell[data-count="4"]  { background: rgba(91,110,245,0.9); }
.heatmap-cell[data-count="5+"] { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }

/* ── Badges & tags ─────────────────────────────────────────── */
.fcs-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-success { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-info    { background: rgba(6,182,212,0.15);  color: var(--info); }
.badge-accent  { background: var(--accent-glow);    color: var(--accent-2); }

/* Priority badges */
.priority-low    { background: rgba(148,163,184,.15); color: #94a3b8; }
.priority-medium { background: rgba(6,182,212,.15);   color: var(--info); }
.priority-high   { background: rgba(245,158,11,.15);  color: var(--warning); }
.priority-urgent { background: rgba(239,68,68,.15);   color: var(--danger); }

/* ── Insights ──────────────────────────────────────────────── */
.insight-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-2);
}
.insight-item:last-child { border-bottom: none; }
.insight-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.insight-icon svg { width: 14px; height: 14px; }
.insight-success { background: rgba(34,197,94,.15); color: var(--success); }
.insight-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.insight-danger  { background: rgba(239,68,68,.15); color: var(--danger); }
.insight-info    { background: rgba(6,182,212,.15); color: var(--info); }

/* ── Savings progress card ─────────────────────────────────── */
.goal-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all var(--transition);
}
.goal-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.goal-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.goal-name { font-weight: 600; font-size: 0.9rem; color: var(--text); margin-bottom: 2px; }
.goal-amounts { font-size: 0.78rem; color: var(--text-3); }

/* ── Task items ────────────────────────────────────────────── */
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 20px; height: 20px;
  border: 2px solid var(--border-2);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
  background: transparent;
  display: grid; place-items: center;
}
.task-check:hover { border-color: var(--success); }
.task-check.done { background: var(--success); border-color: var(--success); }
.task-check.done::after { content: '✓'; color: #fff; font-size: 0.65rem; font-weight: 700; }
.task-title-text { color: var(--text); font-weight: 500; }
.task-due { font-size: 0.75rem; color: var(--text-3); }
.task-due.overdue { color: var(--danger); }

/* ── Notifications ─────────────────────────────────────────── */
.notif-btn {
  position: relative;
  color: var(--text-2);
  padding: 6px;
  line-height: 1;
}
.notif-btn svg { width: 20px; height: 20px; }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-2);
}
.notif-dropdown {
  width: 320px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
}
.notif-header {
  padding: 12px 16px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background var(--transition);
}
.notif-item:hover { background: var(--bg-3); }
.notif-item:last-child { border-bottom: none; }
.notif-empty { padding: 20px 16px; color: var(--text-3); font-size: 0.85rem; text-align: center; }

/* ── Auth pages ────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo-icon {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: 14px;
  display: grid; place-items: center;
  margin: 0 auto 12px;
  box-shadow: 0 0 32px var(--accent-glow);
}
.auth-logo-icon svg { width: 26px; height: 26px; color: #fff; }
.auth-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}
.auth-sub { font-size: 0.85rem; color: var(--text-3); margin-top: 4px; }

/* ── Alerts ────────────────────────────────────────────────── */
.fcs-alert {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}
.fcs-alert svg { width: 16px; height: 16px; }

/* ── Mood tracker ──────────────────────────────────────────── */
.mood-btn {
  font-size: 1.5rem;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  background: var(--bg-3);
  line-height: 1;
}
.mood-btn:hover { transform: scale(1.15); border-color: var(--border-2); }
.mood-btn.selected { border-color: var(--accent); transform: scale(1.15); }

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.page-header-sub { font-size: 0.82rem; color: var(--text-3); margin-top: 2px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 991px) {
  .fcs-sidebar {
    transform: translateX(-100%);
    z-index: 1050;
  }
  .fcs-sidebar.open { transform: translateX(0); }
  .fcs-main { margin-left: 0; }
  .topbar-menu { display: flex; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
  }
  .sidebar-overlay.show { display: block; }
  .fcs-content { padding: 16px; }
}

/* ── Charts override ───────────────────────────────────────── */
canvas { max-width: 100%; }

/* ── Utility ───────────────────────────────────────────────── */
.text-success-fcs { color: var(--success); }
.text-danger-fcs  { color: var(--danger); }
.text-warning-fcs { color: var(--warning); }
.text-info-fcs    { color: var(--info); }
.text-accent      { color: var(--accent-2); }
.text-muted-fcs   { color: var(--text-3); }
.fw-800 { font-weight: 800; }
.font-syne { font-family: 'Syne', sans-serif; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; margin: 0; }

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }
.fade-in-1 { animation-delay: 0.05s; opacity: 0; }
.fade-in-2 { animation-delay: 0.10s; opacity: 0; }
.fade-in-3 { animation-delay: 0.15s; opacity: 0; }
.fade-in-4 { animation-delay: 0.20s; opacity: 0; }
