/*
 * Salam Y'all — Brand Design System
 * Single source of truth for all web surfaces.
 * Referenced by every HTML template and dynamically-generated page.
 *
 * Structure:
 *   1. Font loading
 *   2. Global reset
 *   3. Design tokens (dark default + light override)
 *   4. Typography base
 *   5. Shared components: nav, login, page header, share page, buttons, footer
 */

/* ─── 1. Fonts ──────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,700;1,600&family=Inter:wght@400;500;600;700&display=swap');

/* ─── 2. Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ─── 3. Design Tokens ──────────────────────────────────────────────── */
/*
 * Colors use a two-layer system:
 *   - Primitive RGB channels (--x-rgb) allow deriving transparent variants
 *     via rgba(var(--x-rgb), alpha) without duplicating hex values.
 *   - Semantic tokens reference the primitives. Overriding a single RGB
 *     channel in light mode automatically updates all its derived variants.
 */
:root {
  /* ── Primitive RGB channels ──────────────────────────────────────── */
  --emerald-rgb:   27, 107, 74;
  --gold-rgb:      212, 168, 67;
  --white-rgb:     255, 255, 255;
  --black-rgb:     0, 0, 0;
  --red-rgb:       248, 113, 113;

  /* ── Solid backgrounds ───────────────────────────────────────────── */
  --bg:            #070F0B;
  --bg-elevated:   #0E1A13;
  --surface:       #111C15;
  --surface-alt:   #162117;
  --surface-hover: #1C2B20;

  /* ── Solid brand colors ──────────────────────────────────────────── */
  --emerald:       #1B6B4A;
  --emerald-hover: #14523A;
  --emerald-light: #2A8C63;
  --gold:          #D4A843;
  --gold-hover:    #B8922E;
  --gold-light:    #E8C97A;
  --text:          #F0F0EC;
  --red:           #F87171;
  --red-bg:        #7F1D1D;

  /* ── Transparent variants — derived via rgba() ───────────────────── */
  --emerald-subtle:    rgba(var(--emerald-rgb), 0.08);
  --emerald-glow:      rgba(var(--emerald-rgb), 0.15);
  --gold-subtle:       rgba(var(--gold-rgb), 0.10);
  --gold-glow:         rgba(var(--gold-rgb), 0.08);
  --text-secondary:    rgba(var(--white-rgb), 0.60);
  --text-muted:        rgba(var(--white-rgb), 0.40);
  --text-tertiary:     rgba(var(--white-rgb), 0.35);
  --card-bg:           rgba(var(--white-rgb), 0.04);
  --card-bg-hover:     rgba(var(--white-rgb), 0.07);
  --card-border:       rgba(var(--white-rgb), 0.08);
  --card-border-hover: rgba(var(--white-rgb), 0.15);
  --border:            rgba(var(--white-rgb), 0.08);
  --border-light:      rgba(var(--white-rgb), 0.14);
  --divider:           rgba(var(--white-rgb), 0.06);
  --input-bg:          rgba(var(--white-rgb), 0.05);
  --input-border:      rgba(var(--white-rgb), 0.10);
  --modal-backdrop:    rgba(var(--black-rgb), 0.75);
  --shadow-sm:         0 1px 2px   rgba(var(--black-rgb), 0.30);
  --shadow-md:         0 4px 16px  rgba(var(--black-rgb), 0.30);
  --shadow-lg:         0 12px 40px rgba(var(--black-rgb), 0.50);

  /* ── Named palette ───────────────────────────────────────────────── */
  --forest:     #0d2b1a;
  --forest-rgb: 13, 43, 26;

  /* ── Radius scale ────────────────────────────────────────────────── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  color-scheme: dark;
}

/* ── Light mode override ─────────────────────────────────────────────
 * Only gold-rgb changes (dark amber vs bright gold) so gold-subtle and
 * gold-glow auto-update. White-derived tokens are explicitly redeclared
 * because they need inverted base colors on a light background.
 */
@media (prefers-color-scheme: light) {
  :root {
    --bg:            #F9F4EB;
    --bg-elevated:   #FFFFFF;
    --surface:       #FFFFFF;
    --surface-alt:   #F3EDE0;
    --surface-hover: #EDE6D6;
    --text:          #1A1A1A;
    --red:           #B91C1C;
    --red-bg:        #FEE2E2;

    --text-secondary:    rgba(0, 0, 0, 0.60);
    --text-muted:        rgba(0, 0, 0, 0.40);
    --text-tertiary:     rgba(0, 0, 0, 0.35);
    --card-bg:           rgba(255, 255, 255, 0.85);
    --card-bg-hover:     rgba(255, 255, 255, 0.95);
    --card-border:       rgba(0, 0, 0, 0.08);
    --card-border-hover: rgba(0, 0, 0, 0.15);
    --border:            rgba(0, 0, 0, 0.08);
    --border-light:      rgba(0, 0, 0, 0.14);
    --divider:           rgba(0, 0, 0, 0.06);
    --input-bg:          #FFFFFF;
    --input-border:      rgba(0, 0, 0, 0.12);
    --modal-backdrop:    rgba(0, 0, 0, 0.45);
    --shadow-sm:         0 1px 2px   rgba(0, 0, 0, 0.10);
    --shadow-md:         0 4px 16px  rgba(0, 0, 0, 0.10);
    --shadow-lg:         0 12px 40px rgba(0, 0, 0, 0.14);

    color-scheme: light;
  }
}

/* ─── 4. Typography Base ─────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ─── 5. Shared Components ───────────────────────────────────────────── */

/* ── Glassmorphic nav (public pages) ─────────────────────────────────── */
.sy-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 15, 11, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--divider);
}
@media (prefers-color-scheme: light) {
  .sy-nav { background: rgba(249, 244, 235, 0.85); }
}
.sy-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
@media (max-width: 640px) {
  .sy-nav-inner { padding: 0 16px; }
}

/* ── Brand identity (nav logo + wordmark) ────────────────────────────── */
.sy-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.sy-brand img { width: 34px; height: 34px; border-radius: 8px; }
.sy-brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.2px;
}

/* ── Login card ──────────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 48px 36px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.login-card-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: block;
  border: 2px solid var(--card-border);
}
.login-card h1 {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}
.login-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.login-card input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 15px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-card input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-subtle);
}
.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--emerald);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.login-btn:hover { background: var(--emerald-hover); }
.login-error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
}

/* ── Glassmorphic top bar (admin panels) ─────────────────────────────── */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(7, 15, 11, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--divider);
  z-index: 10;
}
@media (prefers-color-scheme: light) {
  .top-bar { background: rgba(249, 244, 235, 0.85); }
}

/* ── Page header with emerald gradient (support / privacy) ───────────── */
.sy-page-header {
  background: linear-gradient(135deg, var(--emerald) 0%, #145A3D 100%);
  padding: 48px 24px 40px;
  text-align: center;
}
.sy-page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.sy-page-header p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
}

/* ── Button utilities ────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  background: var(--emerald);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--emerald-hover); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-light);
  color: var(--text);
}

/* ── Share pages (/share/event, /share/restaurant, /share/business) ─── */
.sy-share-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}
.sy-share-page::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; height: 100%;
  background:
    radial-gradient(ellipse at 50% 0%,  rgba(var(--emerald-rgb), 0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(var(--gold-rgb), 0.05)    0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}
.sy-share-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}
.sy-share-brand img { width: 34px; height: 34px; border-radius: 8px; }
.sy-share-brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.3px;
}
.sy-share-card {
  max-width: 420px;
  width: 100%;
  background: rgba(14, 26, 19, 0.9);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 1;
}
@media (prefers-color-scheme: light) {
  .sy-share-card { background: rgba(255, 255, 255, 0.92); }
}
.sy-share-card-image { width: 100%; height: 200px; object-fit: cover; }
.sy-share-card-placeholder {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--emerald) 0%, #0F3D2B 100%);
  font-size: 48px;
}
.sy-share-card-body { padding: 24px; }
.sy-share-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}
.sy-share-badge-event {
  background: rgba(var(--emerald-rgb), 0.15);
  color: #34D399;
  border: 1px solid rgba(var(--emerald-rgb), 0.30);
}
.sy-share-badge-restaurant {
  background: rgba(var(--gold-rgb), 0.10);
  color: var(--gold);
  border: 1px solid rgba(var(--gold-rgb), 0.25);
}
.sy-share-badge-business {
  background: rgba(99, 102, 241, 0.10);
  color: #A5B4FC;
  border: 1px solid rgba(99, 102, 241, 0.20);
}
.sy-share-badge-halal {
  background: rgba(34, 197, 94, 0.10);
  color: #4ADE80;
  border: 1px solid rgba(34, 197, 94, 0.20);
  margin-left: 6px;
}
.sy-share-card-body h1 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  margin-top: 8px;
  color: var(--text);
}
.sy-share-meta { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.sy-share-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.sy-share-meta-row svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.5; }
.sy-share-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 20px;
}
.sy-share-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 12px;
}
.sy-share-cta {
  display: block;
  text-align: center;
  background: var(--emerald);
  color: #fff;
  text-decoration: none;
  padding: 14px 32px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 16px;
  transition: background 0.15s, transform 0.15s;
  letter-spacing: 0.01em;
}
.sy-share-cta:hover { background: var(--emerald-light); }
.sy-share-cta:active { transform: scale(0.98); }
.sy-share-web-cta {
  display: block;
  text-align: center;
  margin-top: 10px;
  background: var(--card-bg);
  color: var(--text-secondary);
  text-decoration: none;
  padding: 12px 32px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 15px;
  border: 1px solid var(--card-border);
  transition: background 0.15s, border-color 0.15s;
}
.sy-share-web-cta:hover { background: var(--card-bg-hover); border-color: var(--card-border-hover); }
.sy-share-get-app {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}
.sy-share-get-app:hover { color: var(--text-secondary); }
.sy-share-footer {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
  position: relative;
  z-index: 1;
  letter-spacing: 0.02em;
}

/* ── Unified site footer ─────────────────────────────────────────────── */
.sy-footer {
  width: 100%;
  padding: 40px 24px;
  text-align: center;
  border-top: 1px solid rgba(var(--emerald-rgb), 0.15);
  position: relative;
}
.sy-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 200px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--gold-rgb), 0.30), transparent);
  pointer-events: none;
}
.sy-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 16px;
}
.sy-footer-brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.sy-footer-brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.2px;
}
.sy-footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 16px;
}
.sy-footer-links a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s;
}
.sy-footer-links a:hover { color: var(--text-secondary); }
.sy-footer-copy {
  font-size: 12px;
  color: var(--text-tertiary);
}
@media (max-width: 640px) {
  .sy-footer-links { gap: 14px; }
}
