/* ─── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-900: #1a2e1a;
  --green-800: #1e3a1e;
  --green-700: #2d5a27;
  --green-600: #3a7232;
  --green-500: #4a8c3f;
  --green-400: #62a853;
  --green-300: #82c46e;
  --green-100: #d4edcc;
  --green-50:  #edf7ea;

  --brown-700: #5c3d1e;
  --brown-500: #8b6240;
  --brown-300: #c9a07a;
  --brown-100: #f0e4d4;

  --sky-600: #0284c7;
  --sky-400: #38bdf8;

  --gray-900: #111827;
  --gray-700: #374151;
  --gray-500: #6b7280;
  --gray-300: #d1d5db;
  --gray-100: #f3f4f6;
  --gray-50:  #f9fafb;

  --white: #ffffff;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #16a34a;
  --info: #0284c7;

  --font-body: 'Inter', system-ui, sans-serif;
  --font-display: 'Outfit', system-ui, sans-serif;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 2px 8px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.08);
}

html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--green-600); text-decoration: none; }
a:hover { color: var(--green-400); }

/* ─── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--green-900);
  border-bottom: 2px solid var(--green-700);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: -.5px;
}
.nav-brand:hover { color: var(--green-300); }
.nav-icon { font-size: 1.3rem; }

.nav-links { display: flex; gap: .25rem; }
.nav-link {
  color: var(--green-100);
  font-size: .9rem;
  font-weight: 500;
  padding: .4rem .9rem;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active {
  background: var(--green-700);
  color: var(--white);
}

/* ─── Main Content ──────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem;
}

/* ─── Flash messages ────────────────────────────────────────────────────── */
.flash-container { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: .5rem; }
.flash {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
}
.flash-success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.flash-danger  { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }
.flash-info    { background: #dbeafe; color: #1e3a8a; border: 1px solid #bfdbfe; }
.flash-warning { background: #fef9c3; color: #713f12; border: 1px solid #fde68a; }

/* ─── Footer ────────────────────────────────────────────────────────────── */
.footer {
  background: var(--green-900);
  color: var(--green-300);
  text-align: center;
  font-size: .8rem;
  padding: 1rem;
  margin-top: auto;
}

/* ─── Hero / Landing ────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-700) 50%, var(--green-600) 100%);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  color: var(--white);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: .5rem;
  position: relative;
}
.hero-subtitle {
  font-size: 1.1rem;
  opacity: .85;
  margin-bottom: 2rem;
  position: relative;
}
.hero-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  position: relative;
}
.hero-stat { display: flex; flex-direction: column; gap: .15rem; }
.hero-stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}
.hero-stat-label { font-size: .8rem; opacity: .75; text-transform: uppercase; letter-spacing: .05em; }

/* ─── Stat cards row ────────────────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--green-600);
}
.stat-card-label { font-size: .8rem; color: var(--gray-500); margin-top: .25rem; }

/* ─── Hike cards grid ───────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gray-900);
}

.hikes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.hike-card {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}
.hike-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.hike-card-map {
  height: 160px;
  background: var(--green-50);
  position: relative;
}
.hike-card-map .leaflet-container {
  height: 100%;
  width: 100%;
  border-radius: 0;
  pointer-events: none;
}
.hike-map-placeholder {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--green-300);
  background: linear-gradient(135deg, var(--green-50), var(--green-100));
}

.hike-card-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.hike-card-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--gray-900);
  line-height: 1.3;
}
.hike-card-date { font-size: .8rem; color: var(--gray-500); }

.hike-card-stats { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .25rem; }
.hike-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: .3rem .6rem;
  min-width: 60px;
}
.hike-stat-val { font-size: .85rem; font-weight: 600; color: var(--green-700); }
.hike-stat-lbl { font-size: .65rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; }

.hike-card-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 9999px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: .03em;
}
.badge-easy    { background: #dcfce7; color: #14532d; }
.badge-moderate{ background: #fef9c3; color: #713f12; }
.badge-hard    { background: #fee2e2; color: #7f1d1d; }
.badge-expert  { background: #ede9fe; color: #3b0764; }
.badge-loop    { background: #dbeafe; color: #1e3a8a; }
.badge-out_and_back { background: #f3e8ff; color: #4a044e; }
.badge-point_to_point { background: #fce7f3; color: #831843; }

.stars { color: #f59e0b; font-size: .9rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn-primary { background: var(--green-600); color: var(--white); }
.btn-primary:hover { background: var(--green-500); color: var(--white); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-300); color: var(--gray-900); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { opacity: .85; color: var(--white); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gray-500);
}
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-title { font-size: 1.2rem; font-weight: 600; margin-bottom: .5rem; color: var(--gray-700); }
.empty-text  { font-size: .95rem; margin-bottom: 1.5rem; }

/* ─── Detail page ───────────────────────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.detail-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gray-900);
}
.detail-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.detail-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
}

#hike-map { height: 500px; border-radius: var(--radius); box-shadow: var(--shadow-md); }

.detail-sidebar { display: flex; flex-direction: column; gap: 1rem; }

.info-card {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.info-card-header {
  padding: .75rem 1rem;
  background: var(--green-900);
  color: var(--white);
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.info-card-body { padding: 1rem; }

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: .9rem;
}
.stat-row:last-child { border-bottom: none; }
.stat-row-label { color: var(--gray-500); }
.stat-row-value { font-weight: 600; color: var(--gray-900); }

.tags-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.tag {
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid var(--green-200, #bbf7d0);
  border-radius: 9999px;
  font-size: .75rem;
  padding: .2rem .6rem;
}

/* ─── Elevation chart ───────────────────────────────────────────────────── */
#elevation-chart-wrapper {
  margin-top: .75rem;
  overflow: hidden;
}

/* ─── Forms ─────────────────────────────────────────────────────────────── */
.form-page { max-width: 680px; margin: 0 auto; }
.form-card {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.form-card-header {
  background: var(--green-800);
  color: var(--white);
  padding: 1.25rem 1.5rem;
}
.form-card-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}
.form-card-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }

.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-label { font-size: .875rem; font-weight: 500; color: var(--gray-700); }
.form-control {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font-body);
  background: var(--white);
  color: var(--gray-900);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(74,140,63,.15);
}
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }

.file-input-wrapper {
  border: 2px dashed var(--green-400);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  background: var(--green-50);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.file-input-wrapper:hover { border-color: var(--green-600); background: var(--green-100); }
.file-input-wrapper input { display: none; }
.file-input-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.file-input-text { font-size: .9rem; color: var(--gray-600, #4b5563); }
.file-name { font-size: .85rem; color: var(--green-700); font-weight: 500; margin-top: .5rem; display: none; }

.form-actions {
  display: flex;
  gap: .75rem;
  padding-top: .5rem;
  flex-wrap: wrap;
}

/* ─── Login ──────────────────────────────────────────────────────────────── */
.login-page { max-width: 380px; margin: 3rem auto; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero-title { font-size: 1.8rem; }
  .hero-stats { gap: 1.25rem; }
  .hero-stat-value { font-size: 1.5rem; }
  .main-content { padding: 1rem; }
  .detail-title { font-size: 1.4rem; }
}
