/* =============================================================================
   public/assets/css/global.css
   Shared stylesheet — loaded by ALL business sites as:
       <link rel="stylesheet" href="/assets/css/global.css">

   In local dev  → served from public/assets/css/global.css  by router.php
   On remote     → served from public/assets/css/global.css  by Apache
   ============================================================================= */

/* ── Reset & Box model ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  /* Brand colours */
  --color-primary:       #7c3aed;
  --color-primary-light: #a78bfa;
  --color-primary-dark:  #5b21b6;
  --color-accent:        #818cf8;

  /* Surfaces */
  --color-bg:         #07070e;
  --color-surface:    #111118;
  --color-surface-2:  #1a1a26;
  --color-border:     rgba(255, 255, 255, 0.08);

  /* Text */
  --color-text:       #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-text-faint: #475569;

  /* Typography */
  --font-base:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  /* Spacing scale */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows */
  --shadow-sm: 0 2px  8px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.55);

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html {
  font-family:      var(--font-base);
  font-size:        16px;
  line-height:      1.6;
  scroll-behavior:  smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--color-bg);
  color:            var(--color-text);
  min-height:       100vh;
}

/* ── Typography ──────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight:    700;
  line-height:    1.25;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.875rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p { max-width: 70ch; }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size:   0.875em;
}

code {
  background:    rgba(255, 255, 255, 0.08);
  border:        1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding:       0.15em 0.45em;
}

/* ── Links ───────────────────────────────────────────────────────────────── */
a {
  color:              var(--color-accent);
  text-decoration:    none;
  transition:         color var(--transition-fast);
}

a:hover  { color: var(--color-primary-light); text-decoration: underline; }
a:focus-visible {
  outline:        2px solid var(--color-primary-light);
  outline-offset: 3px;
  border-radius:  2px;
}

/* ── Media ───────────────────────────────────────────────────────────────── */
img, video, svg {
  max-width:  100%;
  height:     auto;
  display:    block;
}

/* ── Layout helpers ──────────────────────────────────────────────────────── */
.container {
  width:           100%;
  max-width:       1200px;
  margin-inline:   auto;
  padding-inline:  var(--space-6);
}

.container--narrow  { max-width: 720px; }
.container--wide    { max-width: 1400px; }

/* ── Utility classes ─────────────────────────────────────────────────────── */

/* Flex */
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-col      { display: flex; flex-direction: column; }
.gap-2         { gap: var(--space-2); }
.gap-4         { gap: var(--space-4); }
.gap-6         { gap: var(--space-6); }

/* Grid */
.grid          { display: grid; }
.grid-auto-fill {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap:                   var(--space-6);
}

/* Text */
.text-muted   { color: var(--color-text-muted); }
.text-faint   { color: var(--color-text-faint); }
.text-primary { color: var(--color-primary-light); }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem; }
.text-lg      { font-size: 1.125rem; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Spacing */
.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.py-4  { padding-block: var(--space-4); }
.py-8  { padding-block: var(--space-8); }
.px-4  { padding-inline: var(--space-4); }
.p-4   { padding: var(--space-4); }
.p-6   { padding: var(--space-6); }

/* Borders */
.border       { border: 1px solid var(--color-border); }
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }

/* Surfaces */
.surface      { background: var(--color-surface);   border: 1px solid var(--color-border); }
.surface-2    { background: var(--color-surface-2); border: 1px solid var(--color-border); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display:          inline-flex;
  align-items:      center;
  gap:              var(--space-2);
  padding:          0.6rem 1.2rem;
  border:           none;
  border-radius:    var(--radius-md);
  font-family:      var(--font-base);
  font-size:        0.9rem;
  font-weight:      600;
  cursor:           pointer;
  text-decoration:  none;
  transition:       background var(--transition-fast),
                    transform  var(--transition-fast),
                    box-shadow var(--transition-fast);
  white-space:      nowrap;
}

.btn:hover  { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary {
  background:   var(--color-primary);
  color:        #fff;
  box-shadow:   0 4px 14px rgba(124, 58, 237, 0.4);
}
.btn-primary:hover {
  background:   var(--color-primary-dark);
  box-shadow:   0 6px 20px rgba(124, 58, 237, 0.5);
  color:        #fff;
}

.btn-outline {
  background:   transparent;
  color:        var(--color-accent);
  border:       1px solid var(--color-border);
}
.btn-outline:hover {
  background:  rgba(255, 255, 255, 0.05);
  border-color: var(--color-accent);
  color:        var(--color-accent);
}

/* ── Form elements ───────────────────────────────────────────────────────── */
input, textarea, select {
  font-family:      var(--font-base);
  font-size:        1rem;
  background:       var(--color-surface-2);
  border:           1px solid var(--color-border);
  border-radius:    var(--radius-md);
  color:            var(--color-text);
  padding:          0.6rem 1rem;
  width:            100%;
  transition:       border-color var(--transition-fast);
  outline:          none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-primary-light);
  box-shadow:   0 0 0 3px rgba(124, 58, 237, 0.2);
}

label {
  display:       block;
  font-size:     0.875rem;
  font-weight:   500;
  color:         var(--color-text-muted);
  margin-bottom: var(--space-1);
}

/* ── Navigation helper ───────────────────────────────────────────────────── */
.nav {
  display:         flex;
  align-items:     center;
  gap:             var(--space-6);
  padding:         var(--space-4) var(--space-6);
  border-bottom:   1px solid var(--color-border);
  background:      rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
}

.nav-brand {
  font-weight: 700;
  font-size:   1.1rem;
  color:       var(--color-text);
}

.nav-link {
  font-size:  0.9rem;
  color:      var(--color-text-muted);
  transition: color var(--transition-fast);
}
.nav-link:hover,
.nav-link.active { color: var(--color-text); text-decoration: none; }

/* ── Back-to-dashboard link ──────────────────────────────────────────────── */
/*
   Business sites can include a "back" link using:
   <a class="back-link" href="/">← Workspace</a>
*/
.back-link {
  display:       inline-flex;
  align-items:   center;
  gap:           var(--space-2);
  font-size:     0.8rem;
  color:         var(--color-text-faint);
  padding:       var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition:    color var(--transition-fast), background var(--transition-fast);
}
.back-link:hover {
  color:         var(--color-text-muted);
  background:    rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding-inline: var(--space-4); }
  .nav       { gap: var(--space-4); }
}
