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

:root {
  --bg: #050815;
  --bg-alt: #0a1020;
  --card: #10172f;
  --card-soft: #141b34;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --text-main: #e5ecff;
  --text-muted: #9ca3c7;
  --border-subtle: rgba(148, 163, 184, 0.35);
  --radius-xl: 18px;
  --radius-xxl: 24px;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1d2a5c 0, #050815 55%);
  color: var(--text-main);
  position: relative;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Patriotic Border - Red, White, Blue frame around viewport */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
  box-shadow:
    inset 0 0 0 1px #dc2626,        /* Red outer line */
    inset 0 0 0 2px #ffffff,        /* White middle line */
    inset 0 0 0 3px #1d4ed8;        /* Blue inner line */
}

.page {
  max-width: 1100px;
  margin: 180px auto 0;
  padding: 0 16px 40px;
  width: 100%;
  box-sizing: border-box;
}

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(18px);
  background: linear-gradient(to bottom, rgba(5, 8, 21, 0.95), rgba(5, 8, 21, 0.85));
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  z-index: 20;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  width: 100%;
  box-sizing: border-box;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 12px 20px 10px;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, #60a5fa, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-weight: 600;
  letter-spacing: 0.05em;
  font-size: 0.95rem;
  line-height: 1.2;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  justify-content: center;
  padding: 0 20px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.nav-links::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.nav-links a {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text-main);
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.9);
}

.nav-cta {
  background: var(--accent);
  color: #0b1120 !important;
  border-color: transparent !important;
  font-weight: 600;
}

.nav-cta:hover {
  filter: brightness(1.05);
}

/* AI Assistant Button - Professional styling matching site palette */
.ai-button-row {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 20px 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.ai-assistant-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, #2563eb 100%);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.ai-assistant-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  filter: brightness(1.08);
}

.ai-assistant-btn:active {
  transform: translateY(0);
}

.ai-icon {
  flex-shrink: 0;
}

/* Proudly Serving Strip - Military Branch Insignia */
.serving-strip {
  position: relative;
  width: 100%;
  background: linear-gradient(to bottom, rgba(10, 16, 32, 0.98), rgba(5, 8, 21, 0.95));
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.serving-strip-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.serving-flag {
  width: 32px;
  height: 24px;
  flex-shrink: 0;
  opacity: 0.9;
}

.serving-insignia-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: nowrap;
}

.serving-insignia {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  opacity: 0.92;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.serving-insignia:hover {
  opacity: 1;
  transform: scale(1.08);
}

.hero {
  background: linear-gradient(145deg, var(--card), var(--card-soft));
  padding: 28px 24px 24px;
  border-radius: var(--radius-xxl);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  margin-bottom: 24px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  line-height: 1.2;
  margin: 0 0 12px;
}

.hero-body {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 10px 0;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.primary-cta,
.ghost-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-cta {
  background: var(--accent);
  color: #0b1120;
}

.primary-cta.full {
  width: 100%;
  margin-top: 12px;
}

.primary-cta:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.ghost-cta {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.5);
  color: var(--text-main);
}

.ghost-cta:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(148, 163, 184, 0.7);
}

.hero-tagline {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.panel {
  background: rgba(10, 16, 32, 0.97);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.32);
  padding: 24px 20px;
  margin-top: 20px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.7);
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 1.6rem;
}

.section-lead {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.section-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: 10px;
}

/* Info sections styling */
.info-section {
  background: linear-gradient(145deg, rgba(10, 16, 32, 0.98), rgba(16, 23, 47, 0.95));
}

.info-section h3 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-top: 18px;
  margin-bottom: 8px;
}

.info-section h3:first-of-type {
  margin-top: 0;
}

/* Feature list for What We Do */
.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.feature-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 14px;
}

.feature-item h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.05rem;
  color: var(--text-main);
}

.feature-item p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}

/* Disclaimer content */
.disclaimer-content {
  margin-top: 14px;
}

.disclaimer-content h3 {
  color: var(--accent);
  font-size: 1rem;
  margin-top: 20px;
  margin-bottom: 8px;
}

.disclaimer-content h3:first-of-type {
  margin-top: 0;
}

.disclaimer-content p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-top: 8px;
  margin-bottom: 12px;
}

/* CTA section styling */
.cta-section {
  text-align: center;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.08), rgba(10, 16, 32, 0.98));
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.cta-section .primary-cta {
  margin-top: 12px;
  display: inline-flex;
}

.tiny-note {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.tool-card {
  border-radius: 16px;
  background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.15), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
}

.tool-card h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.1rem;
  color: var(--text-main);
}

.tool-card p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.cta-note {
  margin-top: 6px;
  font-size: 0.82rem;
  color: #a5b4fc;
  font-style: italic;
}

.table-wrapper {
  overflow-x: auto;
  margin-top: 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  width: 100%;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: auto;
  min-width: 0;
}

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.5;
}

th {
  background: rgba(15, 23, 42, 0.95);
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.9rem;
}

td {
  color: var(--text-muted);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

/* Desktop column width optimization for Military Discounts table */
th:nth-child(1), td:nth-child(1) {
  width: 18%;
}

th:nth-child(2), td:nth-child(2) {
  width: 27%;
}

th:nth-child(3), td:nth-child(3) {
  width: 25%;
}

th:nth-child(4), td:nth-child(4) {
  width: 30%;
}

/* Affiliate link styling */
.affiliate-link {
  color: #60a5fa;           /* bright blue accent, stands out on dark background */
  font-weight: 600;
  text-decoration: underline;
}

.affiliate-link:hover {
  text-decoration: none;
}

.site-footer {
  max-width: 1100px;
  margin: 32px auto 24px;
  padding: 20px 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.footer-main {
  margin-bottom: 8px;
  line-height: 1.6;
}

.footer-links {
  margin-top: 6px;
  margin-bottom: 6px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-meta {
  margin-top: 6px;
  font-size: 0.78rem;
  opacity: 0.8;
}

/* Chat page */

.chat-body {
  background: radial-gradient(circle at top, #111827 0, #020617 60%);
  overflow: hidden;
  height: 100vh;
  height: 100dvh; /* Use dynamic viewport height for mobile keyboard support */
  margin: 0;
  padding: 0;
  position: relative;
}

/* Patriotic Border for chat page */
.chat-body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
  box-shadow:
    inset 0 0 0 1px #dc2626,        /* Red outer line */
    inset 0 0 0 2px #ffffff,        /* White middle line */
    inset 0 0 0 3px #1d4ed8;        /* Blue inner line */
}

/* Chat page serving strip - fixed at top since there's no header */
.chat-body .serving-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
}

/* Full-height container for AI chat */
.ai-chat-page {
  height: 100vh;
  height: 100dvh; /* Use dynamic viewport height for mobile keyboard support */
  display: flex;
  flex-direction: column;
  padding-top: 54px; /* Height of serving strip */
  overflow: hidden;
}

.chat-intro-wrapper {
  flex-shrink: 0;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 16px 0;
  transition: all 0.3s ease-out;
  max-height: 500px;
  overflow: hidden;
}

/* Hide intro when collapsed */
.chat-intro-wrapper.collapsed {
  max-height: 0;
  padding: 0 16px;
  margin: 0 auto;
}

.chat-intro {
  margin-top: 4px;
  padding: 16px 16px 12px;
}

.chat-intro h1 {
  margin-top: 0;
  font-size: 1.4rem;
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 0; /* Critical for flex children */
  padding-top: 12px;
  padding-bottom: 12px;
  overflow: hidden;
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  border-radius: 14px;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.35);
  min-height: 0;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  overscroll-behavior: contain; /* Prevent pull-to-refresh on mobile */
}

.msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
  max-width: 92%;
}

.msg-user {
  margin-left: auto;
  align-items: flex-end;
}

.msg-ai {
  margin-right: auto;
  align-items: flex-start;
}

.msg-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.msg-bubble {
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.msg-user .msg-bubble {
  background: var(--accent);
  color: #020617;
  border-bottom-right-radius: 4px;
}

.msg-ai .msg-bubble {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-bottom-left-radius: 4px;
}

.chat-form {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(10, 16, 32, 0.97);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.32);
  padding: 12px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 10;
}

.chat-form textarea {
  min-height: 70px;
  max-height: 120px;
  resize: vertical;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: #020617;
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  -webkit-appearance: none; /* Remove iOS styling */
}

.chat-form button {
  align-self: flex-end;
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #020617;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.chat-form button:hover {
  filter: brightness(1.06);
}

.chat-footer {
  flex-shrink: 0;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 16px 16px;
  text-align: center;
}

/* Tablet breakpoint for better medium-screen handling */
@media (max-width: 900px) and (min-width: 701px) {
  .nav-links a {
    font-size: 0.84rem;
    padding: 6px 10px;
  }

  .ai-assistant-btn {
    padding: 8px 14px;
    font-size: 0.88rem;
  }
}

@media (max-width: 700px) {
  .site-header {
    padding: 0;
  }

  .logo-block {
    gap: 10px;
    padding: 10px 14px 8px;
  }

  .logo-mark {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }

  .logo-title {
    font-size: 0.88rem;
  }

  .logo-subtitle {
    font-size: 0.72rem;
  }

  .nav-links {
    gap: 6px;
    padding: 0 14px 8px;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .nav-links a {
    font-size: 0.78rem;
    padding: 6px 10px;
  }

  /* Serving strip mobile layout - inside header */
  .serving-strip {
    padding: 8px 14px;
  }

  .serving-strip-inner {
    gap: 10px;
  }

  .serving-flag {
    width: 24px;
    height: 18px;
  }

  .serving-insignia-container {
    gap: 8px;
  }

  .serving-insignia {
    width: 26px;
    height: 26px;
  }

  /* AI Assistant button mobile layout */
  .ai-button-row {
    padding: 8px 14px 10px;
  }

  .ai-assistant-btn {
    width: 100%;
    padding: 9px 16px;
    font-size: 0.86rem;
    justify-content: center;
  }

  /* Adjust page margin for new header structure on mobile */
  .page {
    margin-top: 180px;
  }

  /* Mobile-specific chat layout adjustments */
  .chat-body .serving-strip {
    padding: 6px 12px;
  }

  .ai-chat-page {
    padding-top: 48px;
    height: 100vh;
    height: 100dvh;
  }

  .chat-intro-wrapper {
    padding: 8px 12px 0;
  }

  .chat-intro {
    padding: 12px 14px 10px;
    margin-top: 2px;
  }

  .chat-intro h1 {
    font-size: 1.25rem;
    margin-bottom: 8px;
  }

  .chat-intro .section-lead {
    font-size: 0.88rem;
    margin-bottom: 10px;
  }

  .chat-intro .tiny-note {
    font-size: 0.75rem;
    margin-top: 8px;
  }

  .chat-panel {
    flex: 1;
    min-height: 0;
    padding: 8px 12px;
  }

  .chat-window {
    flex: 1;
    min-height: 0;
    padding: 8px;
    margin-bottom: 8px;
  }

  .chat-form {
    padding: 10px;
  }

  .chat-form textarea {
    min-height: 60px;
    max-height: 90px;
    font-size: 0.88rem;
  }

  .chat-form button {
    padding: 7px 16px;
    font-size: 0.85rem;
  }

  .chat-footer {
    padding: 6px 12px 10px;
    font-size: 0.75rem;
  }

  /* Mobile table adjustments for Military Discounts section */
  .table-wrapper {
    border-radius: 8px;
    overflow-x: visible;
  }

  table {
    font-size: 0.8rem;
    display: table;
    table-layout: fixed;
  }

  th, td {
    padding: 10px 8px;
    font-size: 0.8rem;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.6;
  }

  th {
    font-size: 0.82rem;
    line-height: 1.3;
  }

  /* Adjust column widths for better mobile display */
  th:nth-child(1), td:nth-child(1) {
    width: 18%;
  }

  th:nth-child(2), td:nth-child(2) {
    width: 28%;
  }

  th:nth-child(3), td:nth-child(3) {
    width: 26%;
  }

  th:nth-child(4), td:nth-child(4) {
    width: 28%;
  }
}
