/* ════════════════════════════════════════════════════════════════════════
   TRUSTIFY QR — GOOGLE-STYLE DESIGN SYSTEM
   Tokens + base components inspired by Google Material 3 + the Google Maps
   review UX. Single source of truth: include this CSS BEFORE any page-
   specific stylesheet so its custom properties cascade down.
   ════════════════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ────────────────────────────────────────────────────── */
:root {
  /* Google primary palette */
  --g-blue:        #1A73E8;
  --g-blue-hover:  #1765CC;
  --g-blue-press:  #0F4FA0;
  --g-blue-soft:   #E8F0FE;   /* tonal/hover surface */
  --g-blue-text:   #174EA6;

  --g-red:         #EA4335;
  --g-red-hover:   #C5221F;
  --g-red-soft:    #FCE8E6;
  --g-red-text:    #B31412;

  --g-yellow:      #FBBC04;   /* used for stars */
  --g-yellow-soft: #FEF7E0;
  --g-yellow-text: #8A6D02;

  --g-green:       #34A853;
  --g-green-hover: #1E8E3E;
  --g-green-soft:  #E6F4EA;
  --g-green-text:  #137333;

  /* Neutrals (Google Sans + Material 3 surface scale) */
  --g-white:       #FFFFFF;
  --g-bg:          #F8F9FA;    /* page background */
  --g-surface:     #FFFFFF;    /* cards */
  --g-surface-2:   #F1F3F4;    /* inset / hovered surface */
  --g-divider:     #DADCE0;    /* borders, dividers */
  --g-outline:     #E8EAED;    /* lighter divider */
  --g-text:        #202124;    /* primary text */
  --g-text-2:      #3C4043;    /* secondary text */
  --g-text-3:      #5F6368;    /* tertiary / labels */
  --g-text-mute:   #80868B;    /* placeholder, captions */

  /* Type */
  --g-font-display: 'Google Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --g-font-body:    'Google Sans Text', 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Spacing scale (4px base) */
  --sp-1:  4px;  --sp-2:  8px;  --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-7: 32px;  --sp-8: 40px;
  --sp-9: 48px;  --sp-10: 64px;

  /* Radii */
  --r-sm:  4px;   --r-md:  8px;   --r-lg: 12px;
  --r-xl: 16px;   --r-2xl: 24px;  --r-pill: 999px;

  /* Elevation (Material 3 shadows) */
  --shadow-1: 0 1px 2px rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);
  --shadow-2: 0 1px 2px rgba(60,64,67,.30), 0 2px 6px 2px rgba(60,64,67,.15);
  --shadow-3: 0 1px 3px rgba(60,64,67,.30), 0 4px 8px 3px rgba(60,64,67,.15);
  --shadow-4: 0 2px 3px rgba(60,64,67,.30), 0 6px 10px 4px rgba(60,64,67,.15);

  /* Motion */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --t-fast:    120ms;
  --t-default: 200ms;
}

/* ── BASE ─────────────────────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--g-font-body);
  color: var(--g-text);
  background: var(--g-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--g-font-display);
  color: var(--g-text);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-3);
  line-height: 1.25;
}
h1 { font-size: 28px; font-weight: 500; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }

p { margin: 0 0 var(--sp-3); }

a { color: var(--g-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

small, .g-caption {
  font-size: 12px;
  color: var(--g-text-3);
  line-height: 1.45;
}

code, kbd {
  font-family: 'Roboto Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
  background: var(--g-surface-2);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  color: var(--g-text-2);
}

/* ── CARD (Google's outlined card pattern) ──────────────────────────── */
.g-card {
  background: var(--g-surface);
  border: 1px solid var(--g-divider);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}
.g-card.is-elevated {
  border-color: transparent;
  box-shadow: var(--shadow-1);
}
.g-card-title {
  font-family: var(--g-font-display);
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 var(--sp-2);
}
.g-card-sub {
  font-size: 13px;
  color: var(--g-text-3);
  margin: 0 0 var(--sp-4);
}

/* ── BUTTONS (Material 3 variants) ──────────────────────────────────── */
.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--g-font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  line-height: 20px;
  padding: 10px 24px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  background: transparent;
  color: var(--g-blue);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease-standard),
              box-shadow var(--t-fast) var(--ease-standard),
              color var(--t-fast) var(--ease-standard),
              border-color var(--t-fast) var(--ease-standard);
  white-space: nowrap;
  user-select: none;
}
.g-btn:disabled,
.g-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Filled (primary action) */
.g-btn-filled {
  background: var(--g-blue);
  color: var(--g-white);
  box-shadow: var(--shadow-1);
}
.g-btn-filled:hover { background: var(--g-blue-hover); box-shadow: var(--shadow-2); text-decoration: none; }
.g-btn-filled:active { background: var(--g-blue-press); }

/* Tonal (secondary emphasis) */
.g-btn-tonal {
  background: var(--g-blue-soft);
  color: var(--g-blue-text);
}
.g-btn-tonal:hover { background: #D7E5FB; text-decoration: none; }

/* Outlined */
.g-btn-outlined {
  border-color: var(--g-divider);
  color: var(--g-blue);
  background: var(--g-surface);
}
.g-btn-outlined:hover { background: var(--g-blue-soft); border-color: var(--g-blue); text-decoration: none; }

/* Text (lowest emphasis) */
.g-btn-text {
  color: var(--g-blue);
  padding: 10px 12px;
}
.g-btn-text:hover { background: var(--g-blue-soft); text-decoration: none; }

/* Destructive */
.g-btn-danger {
  background: var(--g-red);
  color: var(--g-white);
  box-shadow: var(--shadow-1);
}
.g-btn-danger:hover { background: var(--g-red-hover); box-shadow: var(--shadow-2); text-decoration: none; }

.g-btn-danger-soft {
  background: var(--g-red-soft);
  color: var(--g-red-text);
}
.g-btn-danger-soft:hover { background: #F9D7D4; text-decoration: none; }

/* Sizes */
.g-btn-sm { padding: 6px 16px; font-size: 13px; }
.g-btn-lg { padding: 14px 32px; font-size: 15px; }
.g-btn-block { width: 100%; }

/* ── OUTLINED TEXT FIELD (Google form input pattern) ───────────────── */
.g-field {
  position: relative;
  margin-bottom: var(--sp-4);
}
.g-field-label {
  display: block;
  font-size: 13px;
  color: var(--g-text-3);
  font-weight: 500;
  margin-bottom: var(--sp-2);
}
.g-input,
.g-textarea,
.g-select {
  width: 100%;
  font-family: var(--g-font-body);
  font-size: 14px;
  line-height: 20px;
  color: var(--g-text);
  background: var(--g-surface);
  padding: 12px 14px;
  border: 1px solid var(--g-divider);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color var(--t-fast) var(--ease-standard),
              box-shadow var(--t-fast) var(--ease-standard);
}
.g-input::placeholder,
.g-textarea::placeholder { color: var(--g-text-mute); }
.g-input:hover,
.g-textarea:hover,
.g-select:hover { border-color: var(--g-text-3); }
.g-input:focus,
.g-textarea:focus,
.g-select:focus {
  border-color: var(--g-blue);
  box-shadow: 0 0 0 1px var(--g-blue);
}
.g-textarea { min-height: 96px; resize: vertical; }
.g-input.is-invalid,
.g-textarea.is-invalid { border-color: var(--g-red); box-shadow: 0 0 0 1px var(--g-red); }
.g-field-error {
  color: var(--g-red-text);
  font-size: 12px;
  margin-top: var(--sp-1);
  display: none;
}
.g-field.has-error .g-field-error { display: block; }
.g-field-help {
  color: var(--g-text-3);
  font-size: 12px;
  margin-top: var(--sp-1);
}

/* ── CHIP / BADGE ──────────────────────────────────────────────────── */
.g-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  background: var(--g-surface-2);
  color: var(--g-text-2);
  border: 1px solid var(--g-divider);
}
.g-chip-blue   { background: var(--g-blue-soft);   color: var(--g-blue-text);   border-color: transparent; }
.g-chip-green  { background: var(--g-green-soft);  color: var(--g-green-text);  border-color: transparent; }
.g-chip-red    { background: var(--g-red-soft);    color: var(--g-red-text);    border-color: transparent; }
.g-chip-yellow { background: var(--g-yellow-soft); color: var(--g-yellow-text); border-color: transparent; }

/* ── NAV BAR (Google-style top app bar) ────────────────────────────── */
.g-appbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--g-surface);
  border-bottom: 1px solid var(--g-divider);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-5);
}
.g-appbar-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--g-font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--g-text);
  text-decoration: none;
}
.g-appbar-brand:hover { text-decoration: none; }
.g-appbar-brand-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--g-blue), var(--g-green));
  border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--g-white); font-weight: 700; font-size: 18px;
}
.g-appbar-nav {
  display: flex; gap: var(--sp-1); align-items: center;
  flex: 1; min-width: 0;
}
.g-appbar-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--g-text-2);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease-standard);
}
.g-appbar-nav a:hover { background: var(--g-surface-2); text-decoration: none; }
.g-appbar-nav a.active { background: var(--g-blue-soft); color: var(--g-blue-text); }
.g-appbar-right { display: flex; align-items: center; gap: var(--sp-3); }
.g-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--g-blue);
  color: var(--g-white);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
  user-select: none;
}
.g-appbar-toggle {
  display: none;
  background: transparent; border: 0;
  width: 40px; height: 40px; border-radius: 50%;
  align-items: center; justify-content: center;
  cursor: pointer;
}
.g-appbar-toggle:hover { background: var(--g-surface-2); }

/* ── LAYOUT ────────────────────────────────────────────────────────── */
.g-container { max-width: 1200px; margin: 0 auto; padding: var(--sp-6); }
.g-stack-2 > * + * { margin-top: var(--sp-2); }
.g-stack-3 > * + * { margin-top: var(--sp-3); }
.g-stack-4 > * + * { margin-top: var(--sp-4); }
.g-stack-6 > * + * { margin-top: var(--sp-6); }

.g-page-head { margin-bottom: var(--sp-6); }
.g-page-title {
  font-family: var(--g-font-display);
  font-size: 28px;
  font-weight: 400;
  color: var(--g-text);
  margin: 0 0 var(--sp-1);
  letter-spacing: -0.01em;
}
.g-page-sub {
  font-size: 14px;
  color: var(--g-text-3);
  margin: 0;
}

/* ── STAR ROW (Google Maps style) ───────────────────────────────────── */
.g-stars { display: inline-flex; gap: 6px; }
.g-stars button {
  width: 44px; height: 44px;
  border: 0; background: transparent; padding: 0;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background var(--t-fast) var(--ease-standard),
              transform var(--t-fast) var(--ease-standard);
}
.g-stars button:hover { background: var(--g-yellow-soft); transform: scale(1.1); }
.g-stars button svg { width: 36px; height: 36px; }
.g-stars button .star-outline { fill: var(--g-divider); }
.g-stars button .star-fill    { fill: var(--g-yellow); display: none; }
.g-stars button.is-on .star-outline { display: none; }
.g-stars button.is-on .star-fill    { display: inline; }

/* ── TABLES (light, Google admin style) ────────────────────────────── */
.g-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.g-table th {
  text-align: left;
  font-weight: 500;
  color: var(--g-text-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--g-divider);
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
}
.g-table td { padding: 14px 16px; border-bottom: 1px solid var(--g-outline); color: var(--g-text-2); }
.g-table tr:hover td { background: var(--g-surface-2); }

/* ── BANNERS (status messages) ─────────────────────────────────────── */
.g-banner {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: var(--sp-4);
}
.g-banner-info    { background: var(--g-blue-soft);   color: var(--g-blue-text); }
.g-banner-success { background: var(--g-green-soft);  color: var(--g-green-text); }
.g-banner-warn    { background: var(--g-yellow-soft); color: var(--g-yellow-text); }
.g-banner-error   { background: var(--g-red-soft);    color: var(--g-red-text); }

/* ── UTIL ──────────────────────────────────────────────────────────── */
.g-divider     { height: 1px; background: var(--g-outline); margin: var(--sp-5) 0; border: 0; }
.g-mute        { color: var(--g-text-3); }
.g-text-center { text-align: center; }
.g-flex        { display: flex; }
.g-flex-wrap   { flex-wrap: wrap; }
.g-flex-center { display: flex; align-items: center; justify-content: center; }
.g-gap-2       { gap: var(--sp-2); }
.g-gap-3       { gap: var(--sp-3); }
.g-gap-4       { gap: var(--sp-4); }
.g-grow        { flex: 1; min-width: 0; }
.g-mt-4        { margin-top: var(--sp-4); }
.g-mb-4        { margin-bottom: var(--sp-4); }

/* ── STAT CARDS (KPI tiles, Google Analytics style) ─────────────────── */
.g-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.g-stat {
  background: var(--g-surface);
  border: 1px solid var(--g-divider);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.g-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--g-text-3);
  text-transform: none;
  letter-spacing: 0.1px;
  margin-bottom: var(--sp-2);
}
.g-stat-num {
  font-family: var(--g-font-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--g-text);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.g-stat-num--blue   { color: var(--g-blue); }
.g-stat-num--red    { color: var(--g-red); }
.g-stat-num--green  { color: var(--g-green); }
.g-stat-num--yellow { color: var(--g-yellow-text); }
.g-stat-foot {
  font-size: 12px;
  color: var(--g-text-3);
  margin-top: var(--sp-2);
}

/* ── BUSINESS CARDS (used on dashboard + businesses list) ───────────── */
.g-biz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}
.g-biz-card {
  background: var(--g-surface);
  border: 1px solid var(--g-divider);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  transition: box-shadow var(--t-fast) var(--ease-standard),
              border-color var(--t-fast) var(--ease-standard);
}
.g-biz-card:hover { box-shadow: var(--shadow-1); border-color: var(--g-divider); }
.g-biz-head { display: flex; align-items: center; gap: var(--sp-3); }
.g-biz-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--g-surface-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
  overflow: hidden;
  flex-shrink: 0;
}
.g-biz-icon img { width: 100%; height: 100%; object-fit: cover; }
.g-biz-name {
  font-family: var(--g-font-display);
  font-size: 16px; font-weight: 500;
  color: var(--g-text);
  line-height: 1.25;
  margin: 0 0 2px;
}
.g-biz-cat { font-size: 12px; color: var(--g-text-3); }
.g-biz-mini { display: flex; gap: var(--sp-3); }
.g-biz-mini-cell { flex: 1; text-align: center; padding: var(--sp-2) 0; background: var(--g-surface-2); border-radius: var(--r-md); }
.g-biz-mini-num { font-family: var(--g-font-display); font-size: 18px; font-weight: 500; color: var(--g-text); line-height: 1.1; }
.g-biz-mini-num--red   { color: var(--g-red); }
.g-biz-mini-num--blue  { color: var(--g-blue); }
.g-biz-mini-num--green { color: var(--g-green); }
.g-biz-mini-lbl { font-size: 11px; color: var(--g-text-3); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.3px; }
.g-biz-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.g-biz-actions .g-btn { flex: 1; min-width: 0; }

/* ── EMPTY STATE ──────────────────────────────────────────────────── */
.g-empty {
  text-align: center;
  padding: var(--sp-9) var(--sp-4);
  color: var(--g-text-3);
}
.g-empty-icon { font-size: 48px; margin-bottom: var(--sp-3); display: block; }
.g-empty-title {
  font-family: var(--g-font-display);
  font-size: 18px; font-weight: 500;
  color: var(--g-text);
  margin: 0 0 var(--sp-2);
}
.g-empty p { color: var(--g-text-3); margin-bottom: var(--sp-4); }

/* ── PROGRESS (linear, Material 3) ─────────────────────────────────── */
.g-progress {
  height: 6px;
  background: var(--g-blue-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.g-progress-bar {
  height: 100%;
  background: var(--g-blue);
  border-radius: var(--r-pill);
  transition: width 400ms var(--ease-standard);
}

/* ── ROW (responsive grid helper) ──────────────────────────────────── */
.g-row { display: grid; gap: var(--sp-4); }
.g-row-2 { grid-template-columns: 1fr; }
.g-row-3 { grid-template-columns: 1fr; }
@media (min-width: 760px) {
  .g-row-2 { grid-template-columns: 1fr 1fr; }
  .g-row-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ── SUBSCRIPTION BANNER (full-width strip beneath app bar) ────────── */
.g-sub-banner {
  display: block;
  padding: 10px var(--sp-6);
  font-size: 13px;
  text-align: center;
  border-bottom: 1px solid var(--g-divider);
}
.g-sub-banner a { font-weight: 500; }
.g-sub-banner--info    { background: var(--g-blue-soft);   color: var(--g-blue-text); }
.g-sub-banner--success { background: var(--g-green-soft);  color: var(--g-green-text); }
.g-sub-banner--warn    { background: var(--g-yellow-soft); color: var(--g-yellow-text); }
.g-sub-banner--danger  { background: var(--g-red-soft);    color: var(--g-red-text); }

/* ── HEADER ACTIONS ROW (page title + CTA on the right) ─────────────── */
.g-page-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}

/* ── INLINE LIST ROWS (recent items inside a card) ──────────────────── */
.g-list { display: flex; flex-direction: column; }
.g-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--g-outline);
}
.g-list-item:last-child { border-bottom: 0; }
.g-list-item-title { font-size: 14px; color: var(--g-text); font-weight: 500; }
.g-list-item-meta  { font-size: 12px; color: var(--g-text-3); }

/* ── MODAL (replaces Bootstrap modal where needed) ──────────────────── */
.g-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(32, 33, 36, 0.5);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.g-modal-backdrop.is-open { display: flex; }
.g-modal {
  background: var(--g-surface);
  border-radius: var(--r-xl);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-4);
  padding: var(--sp-7);
}
.g-modal-title {
  font-family: var(--g-font-display);
  font-size: 20px; font-weight: 500;
  color: var(--g-text);
  margin: 0 0 var(--sp-2);
}

/* ── BODY UNDER APP BAR ─────────────────────────────────────────────── */
.g-body { padding: var(--sp-6) var(--sp-6) var(--sp-9); max-width: 1200px; margin: 0 auto; }

/* ── RESPONSIVE ────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .g-container { padding: var(--sp-4); }
  .g-body { padding: var(--sp-4) var(--sp-4) var(--sp-7); }
  .g-appbar { padding: 0 var(--sp-4); gap: var(--sp-3); }
  .g-appbar-nav { display: none; position: absolute; top: 64px; left: 0; right: 0;
                  flex-direction: column; gap: 0; background: var(--g-surface);
                  border-bottom: 1px solid var(--g-divider); padding: var(--sp-3); }
  .g-appbar-nav.is-open { display: flex; }
  .g-appbar-nav a { border-radius: var(--r-md); padding: 12px 16px; width: 100%; }
  .g-appbar-toggle { display: inline-flex; }
  .g-sub-banner { padding: 10px var(--sp-4); }
  h1 { font-size: 24px; }
  .g-page-title { font-size: 22px; }
  .g-stat-num { font-size: 24px; }
}
