/* ================================================================
   ApexGigs — Unified Design System v1.0
   Built on HawkLynx PBC design system
   Dark + Light mode, full component library
   ================================================================ */

/* ================================================================
   1. CSS VARIABLES — DARK MODE (default)
   ================================================================ */
:root {
  /* Brand colors */
  --cyan:          #06b6d4;
  --cyan-light:    #22d3ee;
  --cyan-bright:   #67e8f9;
  --cyan-dark:     #0891b2;
  --cyan-deep:     #0e7490;
  --flag-blue:     #002868;

  /* Dark surface palette */
  --bg-base:       #0c1222;
  --bg-deep:       #080d18;
  --bg-mid:        #111827;
  --bg-surface:    #1a2332;
  --bg-panel:      #1e293b;

  /* Text */
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  /* Semantic tokens */
  --bg:            var(--bg-base);
  --bg-2:          var(--bg-mid);
  --glass-bg:      rgba(15, 23, 42, 0.55);
  --glass-border:  rgba(148, 163, 184, 0.18);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --card-bg:       rgba(255, 255, 255, 0.04);
  --card-hover-bg: rgba(6, 182, 212, 0.08);
  --accent:        var(--cyan);
  --accent-light:  var(--cyan-light);
  --accent-glow:   rgba(6, 182, 212, 0.28);
  --success:       #34d399;
  --warning:       #fbbf24;
  --danger:        #f87171;

  /* Shadows */
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:     0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg:     0 25px 50px -12px rgba(0,0,0,0.55);
  --shadow-cyan:   0 8px 32px -4px rgba(6, 182, 212, 0.35);

  /* Layout */
  --nav-height:    68px;
  --radius-sm:     8px;
  --radius-md:     16px;
  --radius-lg:     24px;
  --transition:    0.25s cubic-bezier(0.4,0,0.2,1);

  /* Background mesh — dark */
  --bg-mesh:
    radial-gradient(ellipse 80% 60% at 12% 8%,  rgba(6,182,212,0.18) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 88% 92%, rgba(56,189,248,0.12) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(99,102,241,0.06) 0%, transparent 60%),
    linear-gradient(165deg, #080d18 0%, #0c1222 35%, #111827 100%);

  /* Nav */
  --nav-glass:     rgba(12, 18, 34, 0.82);
}

/* ================================================================
   2. LIGHT MODE — :root.light-mode
   ================================================================ */
:root.light-mode {
  --bg-base:       #e8f4fc;
  --bg-deep:       #dbeafe;
  --bg-mid:        #eff6ff;
  --bg-surface:    #f8fafc;
  --bg-panel:      #ffffff;

  --text-primary:  #0f172a;
  --text-secondary:#475569;
  --text-muted:    #64748b;

  --bg:            var(--bg-base);
  --bg-2:          var(--bg-mid);
  --glass-bg:      rgba(255, 255, 255, 0.62);
  --glass-border:  rgba(6, 182, 212, 0.22);
  --glass-highlight: rgba(255, 255, 255, 0.85);
  --card-bg:       rgba(255, 255, 255, 0.55);
  --card-hover-bg: rgba(6, 182, 212, 0.08);
  --accent:        #0891b2;
  --accent-light:  #06b6d4;
  --accent-glow:   rgba(6, 182, 212, 0.18);

  --shadow-lg:     0 25px 50px -12px rgba(15,23,42,0.12), 0 0 0 1px rgba(6,182,212,0.1);
  --shadow-cyan:   0 8px 28px -4px rgba(6, 182, 212, 0.28);

  --bg-mesh:
    radial-gradient(ellipse 75% 55% at 10% 12%, rgba(6,182,212,0.22) 0%, transparent 50%),
    radial-gradient(ellipse 65% 45% at 90% 88%, rgba(56,189,248,0.18) 0%, transparent 48%),
    linear-gradient(165deg, #dbeafe 0%, #eff6ff 45%, #e0f2fe 100%);

  --nav-glass:     rgba(255, 255, 255, 0.82);
}

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

html {
  overflow-x: clip;
  width: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-deep);
  background-image: var(--bg-mesh);
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--cyan-light); }
:root.light-mode a:hover { color: var(--cyan-dark); }

/* ================================================================
   4. TYPOGRAPHY
   ================================================================ */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  line-height: 1.2;
  font-weight: 700;
}

p { color: var(--text-secondary); line-height: 1.7; }

/* ================================================================
   5. LAYOUT
   ================================================================ */
.section {
  padding: 80px 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.section--browse {
  text-align: left;
  padding-top: 40px;
  padding-bottom: 60px;
  max-width: 1280px;
}

/* ================================================================
   6. NAV / HEADER
   ================================================================ */
.ag-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  height: var(--nav-height);
  background: var(--nav-glass);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.ag-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.ag-brand__logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: block;
  flex-shrink: 0;
}

.ag-brand__name {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.ag-brand__name span {
  color: var(--cyan);
}

.ag-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ================================================================
   7. BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition);
  font-family: inherit;
  line-height: 1;
}

/* Primary — solid cyan gradient */
.btn-primary {
  background: linear-gradient(135deg, var(--cyan-light) 0%, var(--cyan) 45%, var(--cyan-dark) 100%);
  color: #fff !important;
  border: 1px solid rgba(34, 211, 238, 0.35);
  box-shadow: 0 4px 16px -2px rgba(6,182,212,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -4px rgba(6,182,212,0.5), inset 0 1px 0 rgba(255,255,255,0.25);
  background: linear-gradient(135deg, var(--cyan-bright) 0%, var(--cyan-light) 50%, var(--cyan) 100%);
  color: #fff !important;
  text-decoration: none;
}
.btn-primary:active { transform: translateY(0); }

/* Ghost — transparent with border */
.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--cyan-light);
}

/* Outline — cyan border */
.btn-outline {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.45);
  color: var(--accent-light);
}
.btn-outline:hover {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--cyan-light);
  color: #fff;
}

/* Danger */
.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}

/* Sizes */
.btn-lg { padding: 14px 32px; font-size: 15px; border-radius: var(--radius-md); }
.btn-sm { padding: 8px 16px;  font-size: 13px; }
.btn-xs { padding: 5px 12px;  font-size: 12px; }

/* Active filter state for filter chips */
.btn-filter-active {
  background: linear-gradient(135deg, var(--cyan-light) 0%, var(--cyan) 100%);
  color: #fff !important;
  border-color: transparent;
}

/* Light mode button overrides */
:root.light-mode .btn-ghost {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(6, 182, 212, 0.25);
  color: var(--text-secondary);
}
:root.light-mode .btn-ghost:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.45);
  color: var(--cyan-dark);
}
:root.light-mode .btn-outline {
  border-color: rgba(8, 145, 178, 0.5);
  color: var(--cyan-dark);
}
:root.light-mode .btn-outline:hover {
  background: rgba(6, 182, 212, 0.14);
  color: var(--cyan-deep);
}

/* ================================================================
   8. HERO SECTION
   ================================================================ */
.hero {
  padding: 100px 24px 80px;
  text-align: center;
  position: relative;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: 100px;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  text-transform: uppercase;
  margin-bottom: 28px;
}

/* Title — uses plain color, NOT gradient clip (avoids light mode visibility bug) */
.hero__title {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.hero__title .accent {
  color: var(--cyan);
}

:root.light-mode .hero__eyebrow {
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--accent);
}

.hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.18rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero__actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ================================================================
   9. CARDS
   ================================================================ */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 36px;
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  transition: all var(--transition);
  text-align: center;
  width: 100%;
  min-width: 0;
}

.card:hover {
  border-color: rgba(6, 182, 212, 0.45);
  background: var(--card-hover-bg);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px -4px rgba(6,182,212,0.2), 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 var(--glass-highlight);
}

:root.light-mode .card {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 2px 16px rgba(15,23,42,0.06), inset 0 1px 0 rgba(255,255,255,0.9);
}
:root.light-mode .card:hover {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 12px 40px -4px rgba(6,182,212,0.15), 0 4px 12px rgba(15,23,42,0.08);
}

.card-grid {
  display: grid;
  gap: 24px;
  width: 100%;
}
.card-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.card-grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.card-grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

.card__icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(6, 182, 212, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 24px;
  box-shadow: 0 0 16px rgba(6,182,212,0.12);
}

.card__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.card__body {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Product card variant — left-aligned */
.card--product {
  text-align: left;
  padding: 20px;
}
.card--product .card__title { text-align: left; }
.card--product .card__body  { text-align: left; margin-bottom: 16px; }

/* ================================================================
   10. GLASS UTILITY
   ================================================================ */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

:root.light-mode .glass {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(6, 182, 212, 0.2);
  box-shadow: 0 2px 12px rgba(15,23,42,0.06);
}

/* ================================================================
   11. MARKETPLACE — SEARCH BAR
   ================================================================ */
.ag-search {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.ag-search__input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  padding: 6px 4px;
}

.ag-search__input::placeholder { color: var(--text-muted); }

/* ================================================================
   12. MARKETPLACE — FILTER CHIPS
   ================================================================ */
.ag-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.ag-categories {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.ag-categories::-webkit-scrollbar { display: none; }

/* ================================================================
   13. MARKETPLACE — PRODUCT IMAGE CONTAINER
   ================================================================ */
.ag-product__img {
  height: 180px;
  border-radius: 10px;
  margin-bottom: 14px;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  position: relative;
  overflow: hidden;
}
.ag-product__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ag-product__price {
  font-size: 20px;
  font-weight: 800;
  color: var(--cyan);
}

/* ================================================================
   14. BADGES & PILLS
   ================================================================ */
/* Tier pill (Made in USA, Gold Verified) */
.hl-tier-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-light);
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.hl-tier-pill--usa {
  background: rgba(0, 40, 104, 0.35);
  border-color: rgba(0, 40, 104, 0.5);
  color: #93c5fd;
}

.hl-tier-pill--gold {
  background: linear-gradient(90deg, rgba(245,158,11,0.25), rgba(217,119,6,0.2));
  border-color: rgba(245, 158, 11, 0.5);
  color: #fcd34d;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge--new      { background: rgba(52,211,153,0.15); color: #6ee7b7; }
.badge--pending  { background: rgba(251,191,36,0.15);  color: #fcd34d; }
.badge--active   { background: rgba(6,182,212,0.15);   color: var(--cyan-light); }
.badge--inactive { background: rgba(148,163,184,0.15); color: #cbd5e1; }
.badge--error    { background: rgba(239,68,68,0.15);   color: #fca5a5; }

/* ================================================================
   15. FORMS
   ================================================================ */
.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
  box-sizing: border-box;
}
.form-control:focus {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}
.form-control::placeholder { color: var(--text-muted); }

:root.light-mode .form-control {
  background: rgba(255,255,255,0.75);
  border-color: rgba(6,182,212,0.25);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ================================================================
   16. SECTION LABEL (eyebrow above headings)
   ================================================================ */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 12px;
  display: block;
}
:root.light-mode .section-label { color: var(--cyan-dark); }

/* ================================================================
   17. ADMIN UI STYLES
   ================================================================ */
.admin-app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  width: 100%;
  box-sizing: border-box;
}
.admin-app h1, .admin-app h2 { color: var(--text-primary); }
.admin-app .muted { color: var(--text-secondary); font-size: 14px; }
.admin-app label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }

.admin-app input,
.admin-app select,
.admin-app textarea { width: 100%; max-width: 100%; }

.admin-app table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-app th, .admin-app td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border);
  vertical-align: top;
}
.admin-app th { color: var(--text-secondary); font-weight: 600; }

.admin-app pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  background: rgba(0,0,0,0.15);
  padding: 12px;
  border-radius: var(--radius-sm);
  max-height: 320px;
  overflow: auto;
}

.admin-app .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.admin-app .row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-app .error {
  color: #fca5a5;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

/* Admin buttons — default to primary style */
.admin-app button:not([class]) {
  background: linear-gradient(135deg, var(--cyan-light) 0%, var(--cyan) 45%, var(--cyan-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.admin-app button.secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.admin-app button.danger {
  background: rgba(239,68,68,0.2);
  color: #fecaca;
  border: 1px solid rgba(239,68,68,0.35);
}

/* ================================================================
   18. UTILITY CLASSES
   ================================================================ */
.text-cyan    { color: var(--cyan); }
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-center  { text-align: center; }
.text-left    { text-align: left; }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm       { gap: 8px; }
.gap-md       { gap: 16px; }
.gap-lg       { gap: 24px; }
.flex-wrap    { flex-wrap: wrap; }

.hidden       { display: none !important; }

/* Skeleton loading shimmer */
.skeleton {
  background: linear-gradient(90deg, var(--glass-bg) 0%, rgba(6,182,212,0.06) 50%, var(--glass-bg) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ================================================================
   19. THEME TOGGLE BUTTON
   ================================================================ */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: rgba(6,182,212,0.4);
  color: var(--cyan-light);
  background: rgba(6,182,212,0.1);
}

/* ================================================================
   20. RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  .hero { padding: 64px 20px 52px; }
  .hero__title { font-size: clamp(2rem, 8vw, 3rem); }
  .ag-header { padding: 0 16px; }
  .section { padding: 48px 16px; }
  .section--browse { padding-top: 24px; padding-inline: 16px; }
  .card { padding: 24px; }
  .card-grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
  .card-grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
  .btn-lg { padding: 12px 24px; font-size: 14px; }
  .hero__actions { gap: 10px; }
  .ag-header__actions .btn-sm { padding: 7px 12px; font-size: 12px; }
  .admin-app { padding: 20px 16px 40px; }
  .admin-app .grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .ag-brand__name { font-size: 16px; }
  .hero { padding: 48px 16px 40px; }
}
