/* ==========================================================================
   main.css — Global styles for Your Project Hub
   Spatial Connections GIS Consulting
   ========================================================================== */


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


/* ── Base body ────────────────────────────────────────────────────────────── */
body {
  margin: 0;
  padding-top: 60px;          /* offset for the fixed navbar */
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-secondary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}


/* ==========================================================================
   Navbar
   ========================================================================== */

/*
 * .site-nav
 *   └─ .nav-container
 *        ├─ .nav-brand (a)
 *        │    ├─ .nav-logo (img)
 *        │    └─ .nav-title (span)
 *        ├─ .nav-links (ul)
 *        │    └─ li > a
 *        └─ .nav-controls (div)
 *             ├─ .btn-theme-toggle (button)
 *             ├─ .nav-user-name (span)   [optional]
 *             └─ .nav-user-link (a)
 */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 60px;
  background-color: var(--bg-nav);   /* --bg-nav: #1a3668 (light) / #0f1a2e (dark) */
  overflow: hidden;                  /* nothing may burst beyond 60 px */
}

.nav-container {
  display: flex;
  align-items: center;
  height: 100%;                      /* fills the 60 px nav exactly */
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  gap: 1.5rem;
}


/* ── Brand (logo + title) ─────────────────────────────────────────────────── */

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  flex-shrink: 0;                    /* never let the brand squish */
  height: 60px;                      /* aligns children to nav height */
}

.nav-logo {
  height: 40px;                      /* hard cap — can never grow past nav */
  width: auto;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.nav-title {
  font-family: var(--font-secondary);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-nav);            /* --text-nav: #ffffff */
  white-space: nowrap;
  line-height: 1;
}


/* ── Nav links (pill style) ──────────────────────────────────────────────── */

.nav-links {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.375rem;
  height: 60px;
}

.nav-links li {
  display: flex;
  align-items: center;
  height: 100%;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  height: auto;
  padding: 0.4375rem 0.875rem;
  border-radius: 999px;
  font-family: var(--font-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-nav);
  text-decoration: none;
  white-space: nowrap;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nav-links a:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.50);
}

.nav-links a.nav-link--active {
  background-color: var(--color-green);
  border-color: var(--color-green);
  color: #ffffff;
  font-weight: 600;
}

.nav-links a.nav-link--active:hover {
  background-color: #6fa832;
  border-color: #6fa832;
}


/* ── Right-side controls ──────────────────────────────────────────────────── */

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  height: 60px;
}


/* ── Theme toggle button ──────────────────────────────────────────────────── */

.btn-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  transition: background-color 0.15s ease;
  color: inherit;                    /* don't let UA override button color */
}

.btn-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.20);
}

.btn-theme-toggle:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 2px;
}


/* ── Nav user elements ────────────────────────────────────────────────────── */

.nav-user-name {
  font-family: var(--font-secondary);
  font-size: 0.8125rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  line-height: 1;
}

.nav-user-link {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 0.75rem;
  font-family: var(--font-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-nav);            /* white */
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nav-user-link:hover {
  background-color: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.45);
}


/* ==========================================================================
   Preview mode banner
   ========================================================================== */

.preview-banner {
  background: #ea580c;              /* orange-600 */
  color: #ffffff;
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  font-family: var(--font-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.preview-banner__exit {
  background: rgba(255, 255, 255, 0.20);
  color: #ffffff;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.40);
  transition: background-color 0.15s ease;
}

.preview-banner__exit:hover {
  background: rgba(255, 255, 255, 0.32);
}


/* ==========================================================================
   Page layout
   ========================================================================== */

.main-content {
  min-height: calc(100vh - 60px - 68px);  /* nav + footer */
  padding: 2rem 1.5rem;
  max-width: 1280px;
  margin: 0 auto;
}


/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 1.125rem 1.5rem;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-brand,
.footer-copy {
  margin: 0;
  font-family: var(--font-secondary);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}


/* ==========================================================================
   Flash messages (base.html)
   ========================================================================== */

.flash-container {
  max-width: 1280px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
}

.flash {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-family: var(--font-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.flash--error {
  background-color: #fff0f0;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.flash--info {
  background-color: #eff6ff;
  color: var(--color-navy);
  border: 1px solid #bfdbfe;
}

.flash--success {
  background-color: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

[data-theme="dark"] .flash--error {
  background-color: #3b1515;
  color: #fca5a5;
  border-color: #7f1d1d;
}

[data-theme="dark"] .flash--info {
  background-color: #1e3a5f;
  color: #93c5fd;
  border-color: #1d4ed8;
}

[data-theme="dark"] .flash--success {
  background-color: #14532d;
  color: #86efac;
  border-color: #166534;
}
