/* =========================================
   MOBILE-FORWARD DESIGN SYSTEM
   ========================================= */

:root {
  /* Dark Mode (Default) */
  --bg-app: #020617; /* Deep navy */
  --bg-panel: #0b1120;
  --bg-card: #111827;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;

  --primary: #fbbf24; /* Amber Gold / challenge coin vibe */
  --primary-glow: rgba(251, 191, 36, 0.2);
  --blue-accent: #3b82f6;
  --red-accent: #ef4444;
  --green-accent: #22c55e;
  --purple-accent: #a855f7;

  /* Patriotic accents */
  --patriot-blue: #1d4ed8;
  --patriot-red: #dc2626;
  --patriot-white: #f9fafb;

  --nav-height: 64px;
  --header-height: 60px;
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;

  /* shell width (phone on mobile, wider on desktop) */
  --shell-max-width: 480px;
}

/* Let the shell expand on larger screens */
@media (min-width: 900px) {
  :root {
    --shell-max-width: 960px;
  }
}
@media (min-width: 1200px) {
  :root {
    --shell-max-width: 1440px;
  }
}
@media (min-width: 1600px) {
  :root {
    --shell-max-width: 1920px;
  }
}

/* Light Mode Overrides */
.light-mode {
  --bg-app: #ffffff;
  --bg-panel: #f4f4f5;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #4b5563;
  --primary: #d97706; /* Darker amber for contrast */
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Inter", sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Center Container for Desktop - Keeps App Feel */
.app-container {
  width: 100%;
  max-width: var(--shell-max-width); /* responsive shell width */
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-app);
  /* Flag photo with less opaque overlays so it shows through */
  background-image: linear-gradient(
      to bottom,
      rgba(15, 23, 42, 0.78),
      rgba(15, 23, 42, 0.86)
    ),
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.32), transparent 60%),
    radial-gradient(circle at bottom right, rgba(220, 38, 38, 0.22), transparent 55%),
    url("/assets/bg-flag.jpg");
  background-size: 100% 100%, 80% 80%, 80% 80%, cover;
  background-position: 0 0, top left, bottom right, center;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.65);
}

.light-mode .app-container {
  /* Softer overlays in light mode */
  background-image: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.78),
      rgba(248, 250, 252, 0.9)
    ),
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.25), transparent 60%),
    radial-gradient(circle at bottom right, rgba(220, 38, 38, 0.18), transparent 55%),
    url("/assets/bg-flag.jpg");
  background-size: 100% 100%, 80% 80%, 80% 80%, cover;
  background-position: 0 0, top left, bottom right, center;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  box-shadow: 0 0 40px rgba(15, 23, 42, 0.25);
}

/* ================= HEADER ================= */
.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0.98),
    rgba(15, 23, 42, 0.9)
  );
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
}
.light-mode .app-header {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Patriot logo badge with emoji flag */
.brand-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 0 0, #ffffff 0, #e5e7eb 28%, transparent 42%),
    linear-gradient(135deg, var(--patriot-blue), var(--patriot-red));
  color: var(--patriot-white);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.7),
    0 10px 18px rgba(0, 0, 0, 0.55);
}

.light-mode .brand-logo {
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 8px 16px rgba(30, 64, 175, 0.28);
}

.brand-flag-emoji {
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 0 1px rgba(15, 23, 42, 0.8));
}

.brand-mark {
  font-weight: 900;
}

.brand-text {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 999px;
  transition: 0.2s;
}
.icon-btn:active {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ================= CONTENT ================= */
.app-content {
  padding: 20px;
}

/* Intro */
.dashboard-intro {
  margin-bottom: 24px;
  margin-top: 10px;
}
.greeting {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}
.dashboard-intro h1 {
  margin: 4px 0 0 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.service-tagline {
  margin: 8px 0 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.service-tagline::before {
  content: "🇺🇸";
  font-size: 14px;
}

/* Hero Widget */
.widget-hero {
  display: block;
  background:
    radial-gradient(circle at top left, rgba(248, 250, 252, 0.06), transparent 55%),
    linear-gradient(135deg, #020617 0%, #0b1120 35%, #1d4ed8 72%, #b91c1c 100%);
  border-radius: var(--radius-xl);
  padding: 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  margin-bottom: 30px;
  box-shadow: 0 14px 40px -14px rgba(15, 23, 42, 0.9);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Subtle flag-style overlay */
.widget-hero::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at top left, rgba(248, 250, 252, 0.14), transparent 55%),
    repeating-linear-gradient(
      -45deg,
      rgba(248, 250, 252, 0.18) 0px,
      rgba(248, 250, 252, 0.18) 4px,
      transparent 4px,
      transparent 8px
    );
  opacity: 0.18;
  mix-blend-mode: screen;
  pointer-events: none;
}

.light-mode .widget-hero {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 60%, #dc2626 100%);
  color: white;
  box-shadow: 0 10px 30px -10px rgba(37, 99, 235, 0.4);
  border-color: rgba(15, 23, 42, 0.12);
}
.widget-hero:active {
  transform: scale(0.98);
}

.widget-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: linear-gradient(90deg, #facc15, #f97316);
  color: #000;
  padding: 4px 8px;
  border-radius: 999px;
  margin-bottom: 12px;
  letter-spacing: 0.06em;
}
.light-mode .widget-badge {
  background: #fefce8;
  color: #b91c1c;
}

.widget-content h2 {
  font-size: 22px;
  margin: 0 0 8px 0;
}
.widget-content p {
  font-size: 14px;
  opacity: 0.9;
  margin: 0 0 20px 0;
  max-width: 80%;
  line-height: 1.5;
}

.widget-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: #fef3c7;
}
.light-mode .widget-action {
  color: #fef9c3;
}

.widget-bg-icon {
  position: absolute;
  right: -10px;
  bottom: -20px;
  font-size: 100px;
  opacity: 0.06;
  pointer-events: none;
  filter: grayscale(1);
}
.light-mode .widget-bg-icon {
  opacity: 0.12;
  filter: none;
}

/* Horizontal Scroll Chips */
.scroll-chips {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px; /* Hide scrollbar spacing */
  margin: 0 -20px 30px -20px; /* Bleed out */
  padding-left: 20px;
  padding-right: 20px; /* Inner padding */
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scroll-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 12px 16px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.6);
}
.light-mode .chip {
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}
.chip span {
  font-size: 16px;
}

/* Color classes for chips */
.chip.blue {
  border-bottom: 2px solid var(--patriot-blue);
}
.chip.green {
  border-bottom: 2px solid var(--green-accent);
}
.chip.orange {
  border-bottom: 2px solid var(--primary);
}
.chip.purple {
  border-bottom: 2px solid var(--purple-accent);
}

/* List Cards */
.section-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.tools-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-panel);
  padding: 16px;
  border-radius: var(--radius-lg);
  transition: background 0.2s, transform 0.2s;
  border: 1px solid rgba(15, 23, 42, 0.75);
}
.light-mode .list-card {
  background: white;
  border: 1px solid #e5e7eb;
}
.list-card:active {
  background: var(--bg-card);
  transform: translateY(1px);
}

.icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.05);
}
.light-mode .icon-box {
  background: #f0fdf4;
}

/* Icon box colors */
.blue-box {
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
}
.red-box {
  background: rgba(220, 38, 38, 0.22);
  color: #fecaca;
}
.orange-box {
  background: rgba(251, 191, 36, 0.22);
  color: #fbbf24;
}

.list-card-content {
  flex: 1;
}
.list-card-content h3 {
  font-size: 16px;
  margin: 0 0 4px 0;
  font-weight: 600;
}
.list-card-content p {
  font-size: 13px;
  margin: 0;
  color: var(--text-secondary);
}

.chevron {
  color: var(--text-secondary);
  font-size: 20px;
  font-weight: 300;
}

/* ================= FOOTER & NAV ================= */
.app-footer {
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 40px;
  padding-bottom: 20px;
}
.legal-links {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.spacer-bottom {
  height: 80px;
} /* Clears the fixed nav */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%); /* Center on desktop */
  width: 100%;
  max-width: var(--shell-max-width); /* responsive shell width */
  height: var(--nav-height);
  background: linear-gradient(
    90deg,
    rgba(15, 23, 42, 0.96),
    rgba(15, 23, 42, 0.98)
  );
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(148, 163, 184, 0.45);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.light-mode .bottom-nav {
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-secondary);
  width: 60px;
  transition: 0.2s;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  stroke-width: 2px;
}
.nav-item span {
  font-size: 10px;
  font-weight: 500;
}

.nav-item.active {
  color: var(--patriot-blue);
}
.light-mode .nav-item.active {
  color: var(--patriot-red);
}

/* Animation Utility */
.fade-in {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  transition-delay: var(--delay, 0ms);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
