/* ============================================
   META DESIGN SYSTEM CSS
   ============================================ */

:root {
  /* Colors - Brand & Accent */
  --color-primary: #0064e6;
  --color-primary-deep: #0143b5;
  --color-primary-soft: rgba(0, 100, 230, 0.15);
  --color-fb-blue: #0866FF;
  
  /* Colors - Surface */
  --color-canvas: #ffffff;
  --color-surface-soft: #f5f6f7;
  --color-hairline: #ccd0d5;
  --color-hairline-soft: #e4e6eb;

  /* Colors - Text */
  --color-ink-deep: #050505;
  --color-ink: #1c1e21;
  --color-charcoal: #606770;
  --color-slate: #8d949e;
  --color-steel: #bcc0c4;
  --color-stone: #dadde1;
  
  /* Colors - Semantic */
  --color-success: #00a400;
  --color-attention: #f5a623;
  --color-warning: #ffba00;
  --color-critical: #fa383e;
  --color-critical-strong: #e11e24;

  /* Typography */
  --font-family: 'Optimistic VF', 'Montserrat', 'Helvetica', 'Arial', sans-serif;
  --font-feature: "ss01" 1, "ss02" 1;

  /* Spacing */
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 10px;
  --space-md: 12px;
  --space-base: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-xxl: 32px;
  --space-xxxl: 40px;

  /* Radii */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 16px;
  --radius-xxl: 24px;
  --radius-xxxl: 32px;
  --radius-full: 100px;
  --radius-circle: 50%;
}

/* ============================================
   RESET & BASE
   ============================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-family);
  background-color: var(--color-canvas);
  color: var(--color-ink);
  line-height: 1.5;
  letter-spacing: -0.16px;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-feature-settings: var(--font-feature);
  color: var(--color-ink-deep);
  margin-bottom: var(--space-base);
  letter-spacing: 0;
}
.t-hero-display { font-size: 64px; font-weight: 500; line-height: 1.16; }
.t-display-lg { font-size: 48px; font-weight: 500; line-height: 1.17; }
.t-heading-lg { font-size: 36px; font-weight: 500; line-height: 1.28; }
.t-heading-md { font-size: 28px; font-weight: 300; line-height: 1.21; }
.t-heading-sm { font-size: 24px; font-weight: 500; line-height: 1.25; }
.t-subtitle-lg { font-size: 18px; font-weight: 700; line-height: 1.44; }
.t-subtitle-md { font-size: 18px; font-weight: 400; line-height: 1.44; }
.t-body-md { font-size: 16px; font-weight: 400; line-height: 1.5; letter-spacing: -0.16px; }
.t-body-md-bold { font-size: 16px; font-weight: 700; line-height: 1.5; letter-spacing: -0.16px; }
.t-body-sm { font-size: 14px; font-weight: 400; line-height: 1.43; letter-spacing: -0.14px; }
.t-body-sm-bold { font-size: 14px; font-weight: 700; line-height: 1.43; letter-spacing: -0.14px; }
.t-caption-bold { font-size: 12px; font-weight: 700; line-height: 1.33; letter-spacing: 0; }
.t-caption { font-size: 12px; font-weight: 400; line-height: 1.33; letter-spacing: 0; }

.text-muted { color: var(--color-charcoal); }
.text-steel { color: var(--color-steel); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.43;
  letter-spacing: -0.14px;
  border-radius: var(--radius-full);
  padding: 14px 30px;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* button-primary (Black Marketing) */
.btn-primary { background: var(--color-ink-deep); color: var(--color-canvas); }
.btn-primary:active { background: var(--color-charcoal); }

/* button-buy-cta (Cobalt Commerce) */
.btn-buy-cta { background: var(--color-primary); color: var(--color-canvas); }
.btn-buy-cta:active { background: var(--color-primary-deep); }

/* button-secondary (Ghost outline) */
.btn-secondary {
  background: transparent;
  color: var(--color-ink-deep);
  border: 2px solid var(--color-ink-deep);
  padding: 12px 28px; /* adjust for 2px border */
}

/* button-ghost (Quieter outline) */
.btn-ghost {
  background: transparent;
  color: var(--color-ink-deep);
  border: 2px solid rgba(10, 19, 23, 0.12);
  padding: 10px 22px;
}

/* button-sm override */
.btn-sm { padding: 8px 16px; font-size: 12px; }

/* ============================================
   PILL TABS (Top Nav)
   ============================================ */
.pill-tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.14px;
  color: var(--color-ink);
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-full);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.pill-tab.active {
  background: var(--color-ink-deep);
  color: var(--color-canvas);
  border-color: transparent;
}

/* ============================================
   LAYOUT & NAVIGATION
   ============================================ */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Sticky Top Bar */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  background: var(--color-canvas);
  border-bottom: 1px solid var(--color-hairline-soft);
  display: flex;
  align-items: center;
  padding: 0 32px;
  justify-content: space-between;
}

.top-nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-ink-deep);
  font-feature-settings: var(--font-feature);
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav-tabs {
  display: flex;
  gap: 8px;
}

.top-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.main-content {
  flex: 1;
  padding: 48px 32px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================
   CARDS & PANELS
   ============================================ */
/* Flat design, no shadow, hairline border, xxxl or xl radius */
.card {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-xxl);
}

.card-feature {
  border-radius: var(--radius-xxxl);
  padding: var(--space-xxl);
}

.card-sticky {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: 0px 1px 4px 0px rgba(20, 22, 26, 0.3);
}

.card-thumbnail {
  background: var(--color-surface-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-base);
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-title {
  font-size: 24px;
  font-weight: 500;
  font-feature-settings: var(--font-feature);
  margin-bottom: var(--space-xl);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}
.badge-warning { background: var(--color-warning); color: var(--color-ink-deep); }
.badge-attention { background: var(--color-attention); color: var(--color-canvas); }
.badge-success { background: var(--color-success); color: var(--color-canvas); }
.badge-error, .badge-critical { background: var(--color-critical); color: var(--color-canvas); }
.badge-primary { background: var(--color-primary-soft); color: var(--color-primary-deep); }

/* ============================================
   FORMS & INPUTS
   ============================================ */
.form-group { margin-bottom: var(--space-base); }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  font-size: 16px;
  color: var(--color-ink);
  outline: none;
  font-family: var(--font-family);
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border: 2px solid var(--color-fb-blue);
  padding: calc(var(--space-md) - 1px);
}
.search-pill {
  background: var(--color-surface-soft);
  color: var(--color-steel);
  font-size: 14px;
  border-radius: var(--radius-full);
  height: 40px;
  padding: 0 16px;
  border: none;
  outline: none;
  width: 250px;
}

/* ============================================
   TABLES
   ============================================ */
.table-wrapper {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline-soft);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  background: var(--color-surface-soft);
  text-align: left;
  padding: 16px;
  font-weight: 700;
  color: var(--color-ink);
  border-bottom: 1px solid var(--color-hairline-soft);
}
.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--color-hairline-soft);
  color: var(--color-charcoal);
  vertical-align: middle;
}
.data-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* ============================================
   UTILITIES
   ============================================ */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-xl { gap: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-xl { margin-bottom: 32px; }

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

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Empty States */
.empty-state {
  padding: 80px 24px;
  text-align: center;
  background: var(--color-surface-soft);
  border-radius: var(--radius-xxxl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-title { font-size: 24px; font-weight: 500; font-feature-settings: var(--font-feature); margin-bottom: 8px; }
.empty-desc { color: var(--color-charcoal); margin-bottom: 24px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,5,5,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--color-canvas);
  border-radius: var(--radius-xxl);
  width: 100%; max-width: 500px;
  transform: translateY(20px); transition: transform 0.2s;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { padding: 24px 32px; border-bottom: 1px solid var(--color-hairline-soft); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 24px; font-weight: 500; font-feature-settings: var(--font-feature); }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--color-charcoal); }
.modal-body { padding: 32px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 24px 32px; background: var(--color-surface-soft); display: flex; justify-content: flex-end; gap: 16px; }

/* Toast */
.toast-container { position: fixed; bottom: 32px; right: 32px; display: flex; flex-direction: column; gap: 16px; z-index: 1000; }
.toast {
  background: var(--color-ink-deep); color: var(--color-canvas);
  padding: 16px 24px; border-radius: var(--radius-xl);
  display: flex; align-items: center; gap: 12px;
  font-weight: 700; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--color-hairline);
  border-radius: var(--radius-xxxl);
  padding: 64px 32px;
  text-align: center;
  background: var(--color-canvas);
  transition: all 0.2s;
}
.upload-zone.dragover { background: var(--color-surface-soft); border-color: var(--color-fb-blue); }
