:root {
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --fg: #e2e8f0;
  --muted: #94a3b8;
  --primary: #10b981;
  /* Emerald 500 */
  --primary-hover: #059669;
  --card: rgba(30, 41, 59, 0.7);
  /* Glass effect */
  --card-border: rgba(148, 163, 184, 0.1);
  --input-bg: rgba(15, 23, 42, 0.6);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 1rem;
}

/* =========================================
   Base & Typography
   ========================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(56, 189, 248, 0.1) 0px, transparent 50%);
  color: var(--fg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4 {
  color: #fff;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 1rem;
}

p {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

/* =========================================
   Components (Premium Cards & Buttons)
   ========================================= */
.card,
.recipe-meta-bar,
.ingredients-card,
.step-card,
.faq-item,
.form {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Buttons */
.btn-primary,
.btn-print,
.btn-cook-mode {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  font-weight: 600;
  letter-spacing: 0.025em;
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  text-decoration: none;
}

.btn-primary:hover,
.btn-print:hover,
.btn-cook-mode:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
  filter: brightness(1.1);
}

.btn-outline {
  display: inline-block;
  border: 1px solid var(--card-border);
  padding: 0.7rem 1.2rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s;
  color: var(--muted);
}

.btn-outline:hover {
  border-color: var(--fg);
  color: var(--fg);
  background: rgba(255, 255, 255, 0.03);
}

/* =========================================
   Layout & Navigation
   ========================================= */
section {
  padding: 5rem 1.5rem;
  max-width: 1200px;
  margin: auto;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.nav:hover {
  border-bottom-color: var(--card-border);
}

.logo {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  color: #fff;
}

.hero {
  padding: 2rem 1.5rem 5rem;
  max-width: 1240px;
  margin: auto;
}

/* =========================================
   Recipe Page Specifics
   ========================================= */
.recipe-header {
  text-align: center;
  margin: 4rem 0 3rem;
  padding: 0 1rem;
}

.recipe-header h1 {
  font-size: 3.5rem;
  line-height: 1.1;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 2rem;
}

.meta-tags {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  font-size: 0.85rem;
  color: var(--muted);
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.meta-tag {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 50px;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 0.4rem 1.2rem;
  text-transform: uppercase;
  font-weight: 600;
}

.recipe-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* Hero Image */
.recipe-image-hero {
  width: 100%;
  height: 60vh;
  min-height: 400px;
  object-fit: cover;
  border-radius: 1.5rem;
  box-shadow: var(--shadow-lg);
  margin-top: -2rem;
  position: relative;
  z-index: 10;
}

/* Meta Bar */
.recipe-meta-bar {
  display: flex;
  justify-content: space-around;
  padding: 2rem;
  margin-top: -3rem;
  /* Overlap effect */
  margin-bottom: 4rem;
  position: relative;
  z-index: 20;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  flex-wrap: wrap;
  gap: 1rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.meta-value {
  color: #fff;
  font-size: 1.5rem;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.meta-label {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* =========================================
   Recipe Layout (Grid & Sidebar)
   ========================================= */
.recipe-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  position: relative;
}

.sidebar {
  position: relative;
}

.ingredients-card {
  position: sticky;
  top: 2rem;
  z-index: 10;
  padding: 2rem;
}

.ingredients-card h3 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: var(--primary);
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 1rem;
}

.ingredients-list {
  list-style: none;
}

.ingredients-list li {
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: 0.75rem;
  transition: all 0.2s;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
}

.ingredients-list li:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--card-border);
  transform: translateX(4px);
}

.ingredients-list li.checked {
  opacity: 0.5;
  text-decoration: line-through;
}

.ingredient-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  margin-right: 12px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
  position: relative;
  margin-top: 4px;
}

.ingredients-list li.checked .ingredient-check {
  background: var(--primary);
}

/* Steps */
.steps-container h3 {
  font-size: 2rem;
  margin-bottom: 2rem;
}

.step-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 3rem;
  display: flex;
  flex-direction: column;
}

.step-card img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-bottom: 1px solid var(--card-border);
}

.step-content {
  padding: 2rem;
}

.step-content h3 {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-content p {
  font-size: 1.1rem;
  color: var(--fg);
  line-height: 1.7;
  margin-bottom: 0;
}

/* Footer */
.footer {
  border-top: 1px solid var(--card-border);
  margin-top: 6rem;
  padding-top: 4rem;
  text-align: center;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
}

.recipe-footer {
  text-align: center;
  margin-top: 4rem;
  font-style: italic;
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--primary);
}

/* =========================================
   Cook Mode (Distraction Free)
   ========================================= */
body.cook-mode {
  background: #000;
  background-image: none;
  overflow: auto;
}

body.cook-mode .sidebar,
body.cook-mode .hero,
body.cook-mode .recipe-meta-bar,
body.cook-mode .footer,
body.cook-mode .recipe-image-hero,
body.cook-mode .meta-tags,
body.cook-mode .nav {
  display: none !important;
}

body.cook-mode .article-content {
  max-width: 800px;
  margin: 0 auto;
}

body.cook-mode .recipe-header {
  margin: 1rem 0;
}

body.cook-mode .recipe-header h1 {
  font-size: 2rem;
}

body.cook-mode .step-card {
  border: none;
  background: transparent;
  box-shadow: none;
  margin-bottom: 5rem;
}

body.cook-mode .step-content h3 {
  font-size: 3rem;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 2rem;
}

body.cook-mode .step-content {
  max-width: 800px;
  margin: 0 auto;
}

body.cook-mode .step-content p {
  font-size: 2.2rem;
  text-align: center;
  color: #fff !important;
  /* Force visibility */
  line-height: 1.5;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

body.cook-mode .ingredients-card {
  position: static;
  background: transparent;
  border: none;
  box-shadow: none;
}

body.cook-mode .ingredients-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

body.cook-mode .ingredients-list li {
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

body.cook-mode .recipe-actions {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
}

body.cook-mode .btn-print {
  display: none;
}

/* =========================================
   Responsive Breakpoints
   ========================================= */
@media (min-width: 900px) {
  .recipe-grid {
    grid-template-columns: 350px 1fr;
    align-items: start;
    gap: 4rem;
  }

  .hero-container {
    flex-direction: row;
    gap: 4rem;
    text-align: left;
  }
}

/* =========================================
   Print Styles
   ========================================= */
@media print {
  body {
    background: white !important;
    color: black !important;
    background-image: none !important;
  }

  .card,
  .ingredients-card,
  .step-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: white !important;
    color: black !important;
    backdrop-filter: none !important;
  }

  h1,
  h2,
  h3,
  p,
  li {
    color: black !important;
    text-shadow: none !important;
  }

  .btn-print,
  .btn-cook-mode,
  .nav,
  .footer {
    display: none !important;
  }

  .recipe-image-hero {
    height: 300px;
    margin-top: 0;
    box-shadow: none;
  }
}

/* =========================================
   Map & Hike Specifics
   ========================================= */
.km-marker {
  background: white;
  border: 2px solid var(--primary);
  border-radius: 50%;
  color: var(--bg-secondary);
  font-weight: 800;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  width: 20px !important;
  height: 20px !important;
  margin-left: -10px !important;
  margin-top: -10px !important;
}

.pro-stats div {
  transition: all 0.2s;
}

.pro-stats:hover {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

/* Map Controls */
.leaflet-control-custom {
  background: white;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  /* Matches default Leaflet rounded corners */
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: none !important;
  transition: all 0.2s;
  color: #1e293b;
}

.leaflet-control-custom:hover {
  background: #f8fafc;
  color: #000;
}

.leaflet-control-custom.active-geo {
  color: #2563eb;
  background: #eff6ff;
  border: 2px solid #2563eb !important;
}

.sim-control {
  background: white;
  padding: 6px 12px;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
  font-weight: 700;
  font-size: 0.85rem;
  color: #0f172a;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.sim-control:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.sim-control.active {
  background: #fee2e2;
  color: #ef4444;
}

/* Sunset Toast Notification */
.sunset-toast {
  position: fixed;
  bottom: 80px;
  /* Above bottom tabs/controls */
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: 90%;
  max-width: 400px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-family: var(--font-body);
}

.sunset-toast.danger {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #991b1b;
}

.sunset-toast.warning {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  color: #92400e;
}

.sunset-toast-icon {
  font-size: 1.5rem;
}

.sunset-toast-content {
  flex: 1;
}

.sunset-toast-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sunset-toast-msg {
  font-size: 0.85rem;
  line-height: 1.3;
}

.sunset-toast-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.6;
  padding: 4px;
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 100%);
    opacity: 0;
  }

  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* Compass Control */
.compass-control {
  font-size: 1.5rem;
  line-height: 30px;
  text-align: center;
  transition: all 0.3s ease;
}

.compass-control.active {
  background: #3b82f6;
  color: white;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* User Heading Marker (Field of View) */
.user-heading-marker {
  transition: transform 0.2s linear;
  /* Smooth rotation */
  pointer-events: none;
  /* Let clicks pass through */
  z-index: 400;
  /* Below popups but above tiles */
}

/* Compass HUD (Optional floating widget) */
/* We will use the button icon rotation itself as the mini-HUD */
.compass-icon-inner {
  display: inline-block;
  transition: transform 0.1s ease-out;
}