﻿/* TGMhub - Shared web theme foundation
   Tokens are intentionally semantic and map-friendly for .NET MAUI ResourceDictionary values.
   Keep this file as the canonical CSS token source for the Blazor web app.
*/

/* =============================================================================
   Color, spacing, radius, and behavior tokens
   ============================================================================= */
:root {
    /* Page backgrounds (dark navy / blue-toned) */
    --tgm-bg-100: #0B1220; /* page background - darkest */
    --tgm-bg-200: #0F1A2B; /* primary surface / app shell */
    --tgm-bg-300: #132133; /* card/panel surface */
    --tgm-bg-400: #18263A; /* elevated surface */
    /* Card surfaces (semantic) */
    --tgm-card-surface: var(--tgm-bg-300);
    --tgm-card-surface-elevated: var(--tgm-bg-400);
    /* Text colours */
    --tgm-text-primary: #EAF0FF;
    --tgm-text-secondary: #A9B6D9;
    --tgm-text-inverse: #071224;
    /* Muted / subtle text */
    --tgm-muted: rgba(234,240,255,0.24); /* subtle on dark background */
    --tgm-muted-strong: rgba(234,240,255,0.16);
    /* Accent colours */
    --tgm-primary: #2672FF; /* strong blue primary accent */
    --tgm-primary-600: #1E5EDC; /* darker primary for pressed states */
    --tgm-gold: #FFD166; /* gold / insignia accent (premium) */
    --tgm-gold-dark: #E1B33A;
    --tgm-purple: #9B59FF; /* calculator / startup tools */
    --tgm-teal: #20C997; /* future/tool green / teal */
    --tgm-cyan: #35E0FF; /* community / social accent */
    /* Borders and dividers */
    --tgm-border: rgba(255,255,255,0.04);
    --tgm-divider: rgba(255,255,255,0.06);
    /* Shadows & glows (kept simple so they are mappable in MAUI) */
    --tgm-shadow-1: 0 4px 10px rgba(0,0,0,0.45);
    --tgm-shadow-2: 0 8px 24px rgba(0,0,0,0.55);
    --tgm-glow-primary: 0 8px 32px rgba(38,114,255,0.08);
    --tgm-glow-gold: 0 8px 28px rgba(255,209,102,0.06);
    /* Spacing scale (base = 4px) - convenient for mapping to MAUI device-independent units */
    --tgm-space-1: 4px;
    --tgm-space-2: 8px;
    --tgm-space-3: 12px;
    --tgm-space-4: 16px;
    --tgm-space-5: 24px;
    --tgm-space-6: 32px;
    --tgm-space-7: 48px;
    --tgm-space-8: 64px;
    /* Border radius scale */
    --tgm-radius-sm: 6px;
    --tgm-radius-md: 12px;
    --tgm-radius-lg: 20px;
    /* Container width */
    --tgm-container-width: 1200px;
    /* Transition / animation speeds */
    --tgm-transition-fast: 120ms;
    --tgm-transition-base: 200ms;
    --tgm-transition-ease: cubic-bezier(.2,.9,.2,1);
    /* semantic green accent for selected/active states, aligned with GwRewards */
    --tgm-accent-green: #22c55e;
    --tgm-accent-green-soft: rgba(34, 197, 94, 0.15);
    --tgm-accent-green-border: rgba(34, 197, 94, 0.55);
}

/* =============================================================================
   Base element styles (sensible, minimal, and portable to MAUI)
   ============================================================================= */

/* Document base */
html {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  background: var(--tgm-bg-100);
  color-scheme: dark;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* Body */
body {
  margin: 0;
  min-height: 100%;
  background: var(--tgm-bg-100);
  color: var(--tgm-text-primary);
  font-family: "Inter", "Segoe UI", Roboto, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; /* base - mobile-first */
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent; /* improves mobile feel */
  transition: background var(--tgm-transition-base) var(--tgm-transition-ease);
}

/* Links */
a {
  color: var(--tgm-primary);
  text-decoration: none;
  transition: color var(--tgm-transition-fast) var(--tgm-transition-ease);
  cursor: pointer;
}

a:hover,
a:focus {
  color: var(--tgm-primary-600);
  outline: none;
  text-decoration: underline;
}

/* Buttons - minimal base so components can extend */
button {
  font: inherit;
  color: var(--tgm-text-primary);
  background: transparent;
  border: none;
  padding: calc(var(--tgm-space-2)) calc(var(--tgm-space-3));
  border-radius: var(--tgm-radius-sm);
  cursor: pointer;
  transition: background var(--tgm-transition-fast) var(--tgm-transition-ease), transform var(--tgm-transition-fast) var(--tgm-transition-ease);
}

/* Accessible focus ring (not web-only visual mechanism) */
:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(38,114,255,0.14);
}

/* Text selection */
::selection {
  background: rgba(38,114,255,0.18);
  color: var(--tgm-text-primary);
}

/* =============================================================================
   Lightweight semantic helpers (prefixed with tgm- to avoid collisions)
   These are intentionally minimal and portable to MAUI styles.
   ============================================================================= */

/* Container wrapper */
.tgm-container {
  width: 100%;
  max-width: var(--tgm-container-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--tgm-space-4);
  padding-right: var(--tgm-space-4);
}

/* Card surface base */
.tgm-card {
  background: var(--tgm-card-surface);
  border: 1px solid var(--tgm-border);
  border-radius: var(--tgm-radius-md);
  padding: var(--tgm-space-4);
  color: var(--tgm-text-primary);
  box-shadow: var(--tgm-shadow-1), var(--tgm-glow-primary);
  transition: transform var(--tgm-transition-fast) var(--tgm-transition-ease), box-shadow var(--tgm-transition-fast) var(--tgm-transition-ease);
}

/* Developed vs coming-soon visual differences */
.tgm-developed {
  transform: scale(1.02);
  opacity: 1;
}

.tgm-coming-soon {
  opacity: 0.55;
  transform: scale(0.96);
  pointer-events: none;
  filter: grayscale(18%);
}

/* Minimal badge / chip */
.tgm-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tgm-text-inverse);
}

/* Accent badges */
.tgm-badge--gold {
  background: var(--tgm-gold);
  color: var(--tgm-text-inverse);
}

.tgm-badge--purple {
  background: var(--tgm-purple);
  color: var(--tgm-text-primary);
}

.tgm-badge--teal {
  background: var(--tgm-teal);
  color: var(--tgm-text-inverse);
}

/* Primary button (semantic) */
.tgm-btn--primary {
  background: linear-gradient(180deg, var(--tgm-primary), var(--tgm-primary-600));
  color: var(--tgm-text-primary);
  padding: 10px 16px;
  border-radius: var(--tgm-radius-sm);
  min-height: 44px; /* meet touch target */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--tgm-shadow-1);
}

.tgm-btn--primary:active {
  transform: translateY(1px);
  background: var(--tgm-primary-600);
}

/* Ghost / secondary button */
.tgm-btn--ghost {
  background: transparent;
  border: 1px solid var(--tgm-border);
  color: var(--tgm-text-primary);
}

/* Icon utilities (use SVGs with currentColor) */
.tgm-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  fill: currentColor;
  stroke: none;
}

/* Small utility spacing helpers */
.tgm-gap-xs { gap: var(--tgm-space-1); }
.tgm-gap-sm { gap: var(--tgm-space-2); }
.tgm-gap-md { gap: var(--tgm-space-4); }
.tgm-gap-lg { gap: var(--tgm-space-6); }

/* Text utilities */
.tgm-muted { color: var(--tgm-text-secondary); }
.tgm-muted-strong { color: var(--tgm-muted-strong); }

/* =============================================================================
   Theme utility tokens for developer convenience (semantic colors)
   Keep these names consistent with MAUI ResourceDictionary keys when mapping.
   ============================================================================= */
.tgm-color--primary { color: var(--tgm-primary); }
.tgm-bg--primary { background-color: var(--tgm-primary); color: var(--tgm-text-primary); }

.tgm-color--gold { color: var(--tgm-gold); }
.tgm-bg--gold { background-color: var(--tgm-gold); color: var(--tgm-text-inverse); }

.tgm-color--purple { color: var(--tgm-purple); }
.tgm-bg--purple { background-color: var(--tgm-purple); color: var(--tgm-text-primary); }

.tgm-color--teal { color: var(--tgm-teal); }
.tgm-bg--teal { background-color: var(--tgm-teal); color: var(--tgm-text-inverse); }

.tgm-color--cyan { color: var(--tgm-cyan); }
.tgm-bg--cyan { background-color: var(--tgm-cyan); color: var(--tgm-text-inverse); }

/* =============================================================================
   Accessibility & performance notes:
   - Avoid complex CSS filters or backdrop features so MAUI mapping stays straightforward.
   - Prefer semantic tokens (above) instead of hard-coded hex values in components.
   - Use CSS isolation in Blazor components (.razor.css) that reference these variables.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   GwRewards-inspired shared, reusable component classes (Blazor-friendly)
   - Mobile-first
   - Dark navy gradient page, dark panels, green accent for selected/active
   - Uses existing tokens; new semantic variable added only for green accent
   --------------------------------------------------------------------------- */

/* Page shell and tool layout */
.tgm-tool-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: block;
    background: linear-gradient(180deg, var(--tgm-bg-100), var(--tgm-bg-200));
    color: var(--tgm-text-primary);
    padding: var(--tgm-space-4) 0 var(--tgm-space-6);
}

/* Shell around a specific tool - centers content and provides surface */
.tgm-tool-shell {
    margin: 0 auto;
    width: 100%;
    max-width: calc(var(--tgm-container-width) - var(--tgm-space-4));
    padding: var(--tgm-space-3);
    background: transparent;
    display: grid;
    gap: var(--tgm-space-4);
}

/* compact shell: reduced padding for dense UIs (mobile-first) */
.tgm-tool-shell--compact {
  padding: var(--tgm-space-2);
  gap: var(--tgm-space-2);
}

/* wide shell: allow extra horizontal room for desktop */
.tgm-tool-shell--wide {
  max-width: calc(var(--tgm-container-width) + 200px);
  padding-left: var(--tgm-space-5);
  padding-right: var(--tgm-space-5);
}

/* Panels (re-usable surface similar to .tgm-card but more semantic) */
.tgm-panel {
  background: var(--tgm-card-surface);
  border: 1px solid var(--tgm-border);
  border-radius: var(--tgm-radius-md);
  padding: var(--tgm-space-3);
  color: var(--tgm-text-primary);
  box-shadow: var(--tgm-shadow-1);
  transition: box-shadow var(--tgm-transition-fast) var(--tgm-transition-ease), transform var(--tgm-transition-fast);
  overflow: hidden;
}

.tgm-panel:focus-within,
.tgm-panel:hover {
  box-shadow: var(--tgm-shadow-2);
}

.tgm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tgm-space-3);
  padding-bottom: var(--tgm-space-2);
  border-bottom: 1px solid var(--tgm-divider);
  margin-bottom: var(--tgm-space-3);
  color: var(--tgm-text-primary);
  font-weight: 600;
  font-size: 14px;
}

/* Inputs - rounded, compact, portable to MAUI */
.tgm-input {
    width: 100%;
    min-height: 40px;
    padding: 6px 10px;
    border: 1px solid var(--tgm-border);
    border-radius: var(--tgm-radius-lg);
    background: var(--tgm-card-surface-elevated);
    color: var(--tgm-text-primary);
    font: inherit;
    outline: none;
    transition: box-shadow var(--tgm-transition-fast), border-color var(--tgm-transition-fast), background var(--tgm-transition-fast);
}

    .tgm-input::placeholder {
        color: var(--tgm-text-secondary);
        opacity: 0.75;
    }

    .tgm-input:focus,
    .tgm-input:focus-within {
        box-shadow: 0 0 0 4px var(--tgm-accent-green-soft);
        border-color: var(--tgm-accent-green-border);
    }

    .tgm-input input,
    .tgm-input textarea,
    .tgm-input select {
        width: 100%;
        padding: 0;
        border: none;
        background: transparent;
        color: inherit;
        font: inherit;
        outline: none;
    }

/* Chips - rounded selectable tokens */
.tgm-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--tgm-border);
  color: var(--tgm-text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--tgm-transition-fast), transform var(--tgm-transition-fast), box-shadow var(--tgm-transition-fast);
  user-select: none;
}

.tgm-chip:active {
  transform: translateY(1px);
}

.tgm-chip--active {
    background: var(--tgm-accent-green-soft);
    border-color: var(--tgm-accent-green-border);
    color: var(--tgm-text-primary);
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.08);
}

.tgm-chip:disabled,
.tgm-chip[aria-disabled="true"],
.tgm-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* List card and rows */
.tgm-list-card {
  padding: 0;
  overflow: hidden;
  border-radius: var(--tgm-radius-md);
  border: 1px solid var(--tgm-border);
  background: var(--tgm-card-surface);
}

.tgm-list-header {
  padding: var(--tgm-space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tgm-space-3);
  border-bottom: 1px solid var(--tgm-divider);
  font-weight: 700;
  color: var(--tgm-text-primary);
  background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
}

.tgm-list-row {
  display: flex;
  align-items: center;
  gap: var(--tgm-space-3);
  padding: var(--tgm-space-3);
  border-bottom: 1px solid var(--tgm-border);
  transition: background var(--tgm-transition-fast), transform var(--tgm-transition-fast);
  cursor: pointer;
}

.tgm-list-row:last-child { border-bottom: none; }

.tgm-list-row:hover {
  background: rgba(255,255,255,0.02);
}

.tgm-list-row--selected {
    background: linear-gradient(90deg, var(--tgm-accent-green-soft), transparent);
    border-left: 4px solid var(--tgm-accent-green);
    padding-left: calc(var(--tgm-space-3) - 4px);
}

/* Tip banner - subtle, dismissible-looking banner for tips/help */
.tgm-tip-banner {
    display: flex;
    align-items: center;
    gap: var(--tgm-space-3);
    padding: var(--tgm-space-3);
    border-radius: var(--tgm-radius-md);
    background: linear-gradient(180deg, rgba(31, 41, 55, 0.92) 0%, rgba(17, 24, 39, 0.96) 100%);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-left: 4px solid var(--tgm-accent-green);
    color: var(--tgm-text-primary);
    font-size: 13px;
    box-shadow: 0 6px 18px rgba(16,18,24,0.32);
}

/* Sticky summary - mobile-first bottom summary; becomes sticky on desktop */
/* Pages using this fixed bottom summary should include enough bottom padding to avoid content overlap. */
.tgm-sticky-summary {
  position: fixed;
  left: var(--tgm-space-3);
  right: var(--tgm-space-3);
  bottom: var(--tgm-space-3);
  z-index: 60;
  background: var(--tgm-card-surface-elevated);
  border: 1px solid var(--tgm-border);
  border-radius: var(--tgm-radius-lg);
  padding: var(--tgm-space-3);
  display: flex;
  gap: var(--tgm-space-3);
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--tgm-shadow-2);
}

/* On larger screens convert to a sticky side/inline element */
@media (min-width: 900px) {
  .tgm-sticky-summary {
    position: sticky;
    bottom: auto;
    left: auto;
    right: 0;
    margin-left: var(--tgm-space-4);
    width: 340px;
    align-self: flex-start;
  }

  /* make shell wider on larger screens by default */
  .tgm-tool-shell {
    padding: var(--tgm-space-4);
  }

  .tgm-tool-shell--compact {
    padding: var(--tgm-space-3);
  }
}

/* Slight accessibility tweak: ensure hits meet touch target */
.tgm-chip, .tgm-btn--primary, .tgm-input { min-height: 40px; }

/* End of shared GwRewards-inspired utilities */

/* Simple tool page back link */
.tgm-back-to-hub {
    display: inline-flex;
    align-items: center;
    gap: var(--tgm-space-2);
    width: fit-content;
    color: var(--tgm-gold);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity var(--tgm-transition-fast) var(--tgm-transition-ease), color var(--tgm-transition-fast) var(--tgm-transition-ease), transform var(--tgm-transition-fast) var(--tgm-transition-ease);
}

    .tgm-back-to-hub:hover,
    .tgm-back-to-hub:focus {
        color: var(--tgm-gold);
        opacity: 1;
        text-decoration: none;
        transform: translateX(-2px);
    }

.tgm-back-to-hub-icon {
    font-size: 1.1rem;
    line-height: 1;
}