/* ============================================================
   Freelancer Dashboard — Brand v1.1 — App Global CSS
   Generated: 2026-05-08
   Apply to: global CSS file (globals.css, index.css, etc.)
   ============================================================ */

/* --- CSS Custom Properties (Brand Tokens) ------------------ */
:root {
  /* Fonts */
  --fd-font-sans:    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fd-font-display: "Plus Jakarta Sans", Inter, -apple-system, sans-serif;
  --fd-font-mono:    "JetBrains Mono", "Fira Code", "Courier New", monospace;

  /* Brand Purple */
  --fd-purple-50:  #F5F3FF;
  --fd-purple-100: #EDE9FE;
  --fd-purple-200: #DDD6FE;
  --fd-purple-400: #A78BFA;
  --fd-purple-500: #8B5CF6;
  --fd-purple-600: #7C3AED;
  --fd-purple-700: #6D28D9;
  --fd-purple-800: #5B21B6;
  --fd-purple-900: #4C1D95;

  /* Brand Green (Emerald) */
  --fd-green-100: #D1FAE5;
  --fd-green-300: #6EE7B7;
  --fd-green-400: #34D399;
  --fd-green-500: #10B981;
  --fd-green-600: #059669;
  --fd-green-700: #047857;
  --fd-green-800: #065F46;

  /* Neutrals */
  --fd-white:    #FFFFFF;
  --fd-gray-50:  #F9FAFB;
  --fd-gray-100: #F3F4F6;
  --fd-gray-200: #E5E7EB;
  --fd-gray-300: #D1D5DB;
  --fd-gray-400: #9CA3AF;
  --fd-gray-500: #6B7280;
  --fd-gray-600: #4B5563;
  --fd-gray-700: #374151;
  --fd-gray-800: #1F2937;
  --fd-gray-900: #111827;

  /* Semantic */
  --fd-success:     #059669;
  --fd-success-bg:  #D1FAE5;
  --fd-error:       #DC2626;
  --fd-error-bg:    #FEE2E2;
  --fd-warning:     #D97706;
  --fd-warning-bg:  #FEF3C7;
  --fd-info:        #2563EB;
  --fd-info-bg:     #DBEAFE;

  /* Semantic aliases */
  --fd-brand-primary:    var(--fd-purple-700);
  --fd-brand-secondary:  var(--fd-green-600);
  --fd-text-primary:     var(--fd-gray-900);
  --fd-text-secondary:   var(--fd-gray-700);
  --fd-text-muted:       var(--fd-gray-500);
  --fd-bg-page:          var(--fd-gray-50);
  --fd-bg-surface:       var(--fd-white);
  --fd-border:           var(--fd-gray-200);

  /* Spacing scale (base unit: 4px) */
  --fd-space-1: 4px;
  --fd-space-2: 8px;
  --fd-space-3: 12px;
  --fd-space-4: 16px;
  --fd-space-6: 24px;
  --fd-space-8: 32px;
  --fd-space-12: 48px;
  --fd-space-16: 64px;
  --fd-space-24: 96px;

  /* Radii */
  --fd-radius-sm: 4px;
  --fd-radius-md: 8px;
  --fd-radius-lg: 12px;
  --fd-radius-xl: 16px;
  --fd-radius-full: 9999px;

  /* Shadows */
  --fd-shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --fd-shadow:    0 1px 3px 0 rgba(0,0,0,0.10), 0 1px 2px -1px rgba(0,0,0,0.10);
  --fd-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.10), 0 2px 4px -2px rgba(0,0,0,0.10);
  --fd-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.10), 0 4px 6px -4px rgba(0,0,0,0.10);
}

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

html {
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--fd-font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fd-text-primary);
  background-color: var(--fd-bg-page);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Headings --------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--fd-font-display);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--fd-gray-900);
  margin-top: 0;
}

h1 { font-size: 2.25rem;  }   /* 36px  heading-xl */
h2 { font-size: 1.875rem; }   /* 30px  heading-lg */
h3 { font-size: 1.5rem;   }   /* 24px  heading-md */
h4 { font-size: 1.25rem;  }   /* 20px  heading-sm */
h5 { font-size: 1.125rem; }   /* 18px  body-xl    */
h6 { font-size: 1rem;     }   /* 16px  body-lg    */

p {
  font-family: var(--fd-font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fd-text-primary);
}

/* --- Links ------------------------------------------------- */
a {
  color: var(--fd-brand-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--fd-purple-800);
}

a:focus-visible {
  outline: 2px solid var(--fd-brand-primary);
  outline-offset: 2px;
  border-radius: var(--fd-radius-sm);
}

/* --- Buttons (class-based) --------------------------------- */

/* Primary */
.btn,
.btn-primary,
button.primary,
[data-variant="primary"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--fd-brand-primary);
  color: var(--fd-white);
  font-family: var(--fd-font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.2;
  padding: 10px 20px;
  border-radius: var(--fd-radius-md);
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-decoration: none;
}

.btn:hover,
.btn-primary:hover,
button.primary:hover {
  background-color: var(--fd-purple-800);
  color: var(--fd-white);
}

.btn:disabled,
.btn-primary:disabled {
  background-color: var(--fd-purple-100);
  color: var(--fd-purple-500);
  cursor: not-allowed;
}

/* Secondary */
.btn-secondary,
button.secondary,
[data-variant="secondary"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--fd-white);
  color: var(--fd-brand-primary);
  font-family: var(--fd-font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.2;
  padding: 10px 20px;
  border-radius: var(--fd-radius-md);
  border: 1.5px solid var(--fd-brand-primary);
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-decoration: none;
}

.btn-secondary:hover,
button.secondary:hover {
  background-color: var(--fd-purple-50);
}

/* Ghost / Text */
.btn-ghost,
button.ghost {
  background: transparent;
  color: var(--fd-brand-primary);
  border: none;
  font-family: var(--fd-font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 10px 12px;
  border-radius: var(--fd-radius-md);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-ghost:hover,
button.ghost:hover {
  background-color: var(--fd-purple-50);
}

/* Danger */
.btn-danger,
button.danger {
  background-color: var(--fd-error);
  color: var(--fd-white);
  font-family: var(--fd-font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 10px 20px;
  border-radius: var(--fd-radius-md);
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-danger:hover {
  background-color: #B91C1C;
}

/* --- Form Elements ----------------------------------------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
textarea,
select {
  font-family: var(--fd-font-sans);
  font-size: 0.9375rem;
  color: var(--fd-text-primary);
  background-color: var(--fd-white);
  border: 1px solid var(--fd-gray-300);
  border-radius: var(--fd-radius-md);
  padding: 10px 12px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
  outline: none;
}

/* Selects inside table cells should size to their content, not stretch the column */
td select,
th select {
  width: auto;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--fd-brand-primary);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.15);
}

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

label {
  font-family: var(--fd-font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--fd-gray-700);
  display: block;
  margin-bottom: var(--fd-space-1);
}

.field-error,
.form-error,
[data-error="true"] input,
input.error,
input[aria-invalid="true"] {
  border-color: var(--fd-error);
}

.field-error-message,
.form-error-text {
  color: var(--fd-error);
  font-size: 0.8125rem;
  margin-top: var(--fd-space-1);
}

/* --- Cards ------------------------------------------------- */
/* The [class*="card"] wildcard catches Bootstrap card sub-elements
   (.card-title, .card-body, .card-header, .card-footer, .card-text)
   and stamps them as nested cards. Reset those sub-elements after the
   surface style is applied so only the outer .card / .panel renders as
   a surface. */
.card,
[class*="card"],
.panel,
[class*="panel"] {
  background-color: var(--fd-bg-surface);
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius-lg);
  padding: var(--fd-space-6);
  box-shadow: var(--fd-shadow-sm);
}

.card-title,
.card-body,
.card-text,
.card-footer,
.card-img-top,
.card-img-bottom {
  background-color: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.card > .card-body {
  padding: var(--fd-space-6);
}

.card-header,
[class*="card-header"] {
  font-family: var(--fd-font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--fd-gray-900);
  margin-bottom: var(--fd-space-4);
}

/* --- Badges / Status Pills --------------------------------- */
/* Scope wildcard away from <tr> rows and <select> elements so it only hits real pills */
.badge,
.status,
.pill,
[class*="badge"],
:not(tr):not(select)[class*="status-"] {
  display: inline-flex;
  align-items: center;
  font-family: var(--fd-font-sans);
  font-weight: 500;
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 2px 8px;
  border-radius: var(--fd-radius-full);
}

.badge-success,
.status-paid,
.status-active,
.status-complete {
  background-color: var(--fd-success-bg);
  color: var(--fd-green-700);
}

.badge-warning,
.status-overdue,
.status-pending,
.status-late {
  background-color: var(--fd-warning-bg);
  color: #92400E;
}

.badge-error,
.status-failed,
.status-cancelled,
.status-rejected {
  background-color: var(--fd-error-bg);
  color: var(--fd-error);
}

.badge-info,
.status-draft,
.status-review {
  background-color: var(--fd-info-bg);
  color: var(--fd-info);
}

.badge-neutral,
.status-archived {
  background-color: var(--fd-gray-100);
  color: var(--fd-gray-600);
}

/* --- Data / Financial Numbers ------------------------------ */
.amount,
.money,
.invoice-total,
.balance,
.price,
[class*="amount"],
[class*="invoice-number"],
[class*="invoice-id"] {
  font-family: var(--fd-font-mono);
  font-weight: 500;
}

.amount-positive,
.amount-paid,
.revenue {
  color: var(--fd-success);
  font-family: var(--fd-font-mono);
  font-weight: 500;
}

.amount-negative,
.amount-overdue,
.expense {
  color: var(--fd-error);
  font-family: var(--fd-font-mono);
  font-weight: 500;
}

/* --- Tables ----------------------------------------------- */
table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--fd-font-sans);
}

thead th {
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fd-text-muted);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--fd-border);
  background-color: var(--fd-gray-50);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--fd-gray-100);
  font-size: 0.9375rem;
  color: var(--fd-text-primary);
}

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

tbody tr:hover {
  background-color: var(--fd-gray-50);
}

/* --- Navigation / Sidebar ---------------------------------- */
.nav,
.sidebar,
.sidenav,
[role="navigation"] {
  background-color: var(--fd-white);
  border-right: 1px solid var(--fd-border);
}

.nav-item,
.nav-link,
[class*="nav-item"] {
  font-family: var(--fd-font-sans);
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--fd-gray-700);
  transition: color 0.15s ease, background-color 0.15s ease;
  border-radius: var(--fd-radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.nav-item:hover,
.nav-link:hover {
  color: var(--fd-brand-primary);
  background-color: var(--fd-purple-50);
}

.nav-item.active,
.nav-link.active,
[aria-current="page"] {
  color: var(--fd-brand-primary);
  background-color: var(--fd-purple-100);
  font-weight: 600;
}

/* --- Header Bar ------------------------------------------- */
.header,
.topbar,
.app-header,
[role="banner"] {
  background-color: var(--fd-white);
  border-bottom: 1px solid var(--fd-border);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

/* --- Alerts / Toasts -------------------------------------- */
.alert,
.toast,
.notification,
[class*="alert-"] {
  border-radius: var(--fd-radius-md);
  padding: 12px 16px;
  font-family: var(--fd-font-sans);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-success { background-color: var(--fd-success-bg); color: var(--fd-green-800); }
.alert-error,
.alert-danger   { background-color: var(--fd-error-bg);   color: var(--fd-error); }
.alert-warning  { background-color: var(--fd-warning-bg); color: #92400E; }
.alert-info     { background-color: var(--fd-info-bg);    color: var(--fd-info); }

/* --- Modals ----------------------------------------------- */
.modal,
[role="dialog"],
.dialog {
  background-color: var(--fd-white);
  border-radius: var(--fd-radius-lg);
  padding: var(--fd-space-8);
  box-shadow: var(--fd-shadow-lg);
}

.modal-overlay,
.dialog-overlay {
  background-color: rgba(17, 24, 39, 0.5);
}

.modal-title,
.dialog-title {
  font-family: var(--fd-font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--fd-gray-900);
  margin-bottom: var(--fd-space-4);
}

/* --- Empty States ------------------------------------------ */
.empty-state,
[class*="empty-state"] {
  text-align: center;
  padding: var(--fd-space-12) var(--fd-space-6);
  color: var(--fd-text-muted);
}

.empty-state-title {
  font-family: var(--fd-font-display);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--fd-gray-700);
  margin-bottom: var(--fd-space-2);
}

/* --- Loading / Skeleton ------------------------------------ */
.skeleton,
[class*="skeleton"],
[class*="loading"] {
  background: linear-gradient(90deg, var(--fd-gray-100) 25%, var(--fd-gray-50) 50%, var(--fd-gray-100) 75%);
  background-size: 200% 100%;
  animation: fd-skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--fd-radius-md);
}

@keyframes fd-skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Tooltips --------------------------------------------- */
.tooltip,
[data-tooltip],
[class*="tooltip"] {
  background-color: var(--fd-gray-900);
  color: var(--fd-white);
  font-family: var(--fd-font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--fd-radius-sm);
}

/* --- Dividers --------------------------------------------- */
hr {
  border: none;
  border-top: 1px solid var(--fd-border);
  margin: var(--fd-space-8) 0;
}

/* --- Scrollbar (WebKit) ------------------------------------ */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: var(--fd-gray-100); }
::-webkit-scrollbar-thumb  { background: var(--fd-gray-300); border-radius: var(--fd-radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--fd-gray-400); }

/* --- Focus Ring (accessibility) ---------------------------- */
:focus-visible {
  outline: 2px solid var(--fd-brand-primary);
  outline-offset: 2px;
}

/* --- Selection color --------------------------------------- */
::selection {
  background-color: var(--fd-purple-200);
  color: var(--fd-purple-900);
}

/* --- Assignment table row status colors ------------------- */
tr.status-green     { background-color: rgba(209, 250, 229, 0.35); }
tr.status-blue      { background-color: rgba(219, 234, 254, 0.35); }
tr.status-red       { background-color: rgba(254, 226, 226, 0.55); }
tr.status-light-red { background-color: rgba(254, 243, 199, 0.35); }
