/* ==========================================================================
   DAVS FARM EQUIPMENT — GLOBAL STYLESHEET (MAIN.CSS)
   Aesthetic: Rugged, Heavy-Duty, Grounded Earth & Steel Industrial
   ========================================================================== */

:root {
  /* Brand Earth & Ag Tones */
  --forest-950: #081a10;
  --forest-900: #0d2617;
  --forest-800: #143823;
  --forest-700: #1a472a;
  --forest-600: #245e38;
  --forest-100: #e2ede5;
  --forest-50:  #f0f6f2;

  /* Harvest Amber & Industrial Accent */
  --amber-700: #92400e;
  --amber-600: #b45309;
  --amber-500: #d97706;
  --amber-400: #f59e0b;
  --amber-300: #fcd34d;
  --amber-100: #fef3c7;
  --amber-50:  #fffbeb;

  /* Chassis Steel & High-Contrast Neutrals */
  --steel-950: #0b0f19;
  --steel-900: #0f172a;
  --steel-850: #162033;
  --steel-800: #1e293b;
  --steel-700: #334155;
  --steel-600: #475569;
  --steel-500: #64748b;
  --steel-400: #94a3b8;
  --steel-300: #cbd5e1;
  --steel-200: #e2e8f0;
  --steel-100: #f1f5f9;

  /* Parchment Backgrounds */
  --parchment-base: #fbf9f5;
  --parchment-card: #ffffff;
  --parchment-dark: #f3efe6;
  --parchment-border: #e2ddd5;

  /* Typography */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radius & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 8px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 20px -3px rgba(15, 23, 42, 0.12), 0 4px 6px -4px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.16), 0 8px 10px -6px rgba(15, 23, 42, 0.1);

  --container-max: 1240px;
}

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

html {
  font-family: var(--font-body);
  color: var(--steel-900);
  background-color: var(--parchment-base);
  line-height: 1.6;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main {
  flex: 1;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Typography Utility */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--forest-900);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

p {
  margin-bottom: 1rem;
}

p:last-child {
  margin-bottom: 0;
}

.text-mono {
  font-family: var(--font-mono);
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--forest-800);
  background: var(--forest-100);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(20, 56, 35, 0.25);
  margin-bottom: 0.85rem;
}

.section-tag::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--amber-500);
  border-radius: 50%;
}

.section-title {
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  color: var(--forest-900);
}

.section-subtitle {
  font-size: 1.1rem;
  color: var(--steel-700);
  max-width: 650px;
  line-height: 1.6;
}

/* ==========================================================================
   TOP NOTIFICATION BAR & HEADER
   ========================================================================== */

.top-utility-bar {
  background-color: var(--steel-950);
  color: #f1f5f9;
  font-size: 0.8125rem;
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.55rem 0;
}

.top-utility-bar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.top-utility-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #f8fafc;
}

.top-utility-status strong {
  color: #ffffff;
}

.status-indicator {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4);
}

.top-utility-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.top-utility-links a {
  color: #cbd5e1;
  font-weight: 600;
  transition: color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.top-utility-links a:hover {
  color: var(--amber-400);
}

.top-hotline {
  color: #ffffff !important;
  font-weight: 700;
}

.top-hotline span {
  color: #fbbf24;
}

/* Main Navigation Header */
.main-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--steel-200);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 76px;
  transition: height 0.3s ease;
}

.main-header.scrolled .header-container {
  height: 66px;
}

/* Brand Logo */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-emblem {
  width: 44px;
  height: 44px;
  background: var(--forest-800);
  color: var(--amber-400);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(20, 56, 35, 0.3);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.brand-logo:hover .brand-emblem {
  transform: rotate(15deg);
  background: var(--forest-700);
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--forest-900);
  letter-spacing: -0.03em;
  line-height: 1;
}

.brand-tagline {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--amber-600);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* Nav Menu: Short, Straightforward */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 2.25rem;
  list-style: none;
}

.nav-link {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--steel-700);
  transition: color 0.15s ease;
  position: relative;
  padding: 0.5rem 0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--forest-800);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--amber-500);
  border-radius: 2px;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--forest-900);
}

/* Mobile Drawer */
.mobile-drawer {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 290px;
  background-color: #ffffff;
  z-index: 1100;
  box-shadow: var(--shadow-xl);
  padding: 2rem 1.5rem;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1050;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.active {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   INPUT BOXES & FORMS (CLEAN, MODERN, BEAUTIFUL)
   ========================================================================== */

.form-group {
  margin-bottom: 1.35rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--steel-800);
  margin-bottom: 0.45rem;
  letter-spacing: -0.01em;
}

.form-control,
.select-control,
.search-input {
  width: 100%;
  height: 48px;
  padding: 0 1rem;
  background-color: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  appearance: none;
}

.form-control::placeholder,
.search-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.form-control:hover,
.select-control:hover,
.search-input:hover {
  border-color: #94a3b8;
}

.form-control:focus,
.select-control:focus,
.search-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--forest-800);
  box-shadow: 0 0 0 3px rgba(20, 56, 35, 0.15);
}

select.form-control,
.select-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

textarea.form-control {
  height: auto;
  min-height: 110px;
  padding: 0.85rem 1rem;
  line-height: 1.6;
  resize: vertical;
}

/* ==========================================================================
   BUTTONS (CLEAR, VIBRANT, HIGH CONTRAST)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary Harvest Amber Button (High Contrast White on Rich Amber) */
.btn-primary {
  background-color: #d97706;
  color: #ffffff !important;
  border-color: #b45309;
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
  background-color: #b45309;
  border-color: #92400e;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(217, 119, 6, 0.4);
}

/* Forest Industrial Button */
.btn-forest {
  background-color: var(--forest-800);
  color: #ffffff !important;
  border-color: var(--forest-900);
  box-shadow: 0 2px 4px rgba(20, 56, 35, 0.3);
}

.btn-forest:hover {
  background-color: var(--forest-700);
  transform: translateY(-1px);
}

/* Outline Buttons */
.btn-outline-forest {
  background: transparent;
  color: var(--forest-800);
  border-color: var(--forest-800);
}

.btn-outline-forest:hover {
  background-color: var(--forest-800);
  color: #ffffff;
}

.btn-outline-white {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.7);
}

.btn-outline-white:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: #ffffff;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
}

/* ==========================================================================
   STATUS BADGES (HIGH CONTRAST)
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-available {
  background-color: #dcfce7;
  color: #14532d;
  border: 1px solid #86efac;
}

.badge-preowned {
  background-color: #e0f2fe;
  color: #075985;
  border: 1px solid #7dd3fc;
}

.badge-harvest {
  background-color: #fef3c7;
  color: #78350f;
  border: 1px solid #fcd34d;
}

/* ==========================================================================
   CARDS & GRIDS (EQUAL HEIGHT & CLEAN ARRANGEMENT)
   ========================================================================== */

.card {
  background-color: #ffffff;
  border: 1.5px solid var(--steel-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--steel-300);
}

/* Equipment Card (Global Unified Architecture) */
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  align-items: stretch;
}

.equipment-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #ffffff;
  border: 1.5px solid var(--steel-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.equipment-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: #94a3b8;
}

.equipment-image-wrap {
  position: relative;
  width: 100%;
  height: 230px;
  background-color: var(--steel-900);
  overflow: hidden;
  flex-shrink: 0;
}

.equipment-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: block;
}

.equipment-card:hover .equipment-image {
  transform: scale(1.05);
}

.card-badge-strip {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  display: flex;
  gap: 0.5rem;
  z-index: 2;
}

.card-category-tag {
  position: absolute;
  bottom: 0.85rem;
  right: 0.85rem;
  background-color: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.equipment-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.equipment-card-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  line-height: 1.35;
  color: var(--forest-900);
  min-height: 3.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.equipment-card-title a {
  color: var(--forest-900);
  transition: color 0.15s ease;
}

.equipment-card-title a:hover {
  color: var(--amber-600);
}

.equipment-card-price {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--forest-700);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  min-height: 1.8rem;
}

.equipment-card-excerpt {
  font-size: 0.925rem;
  color: var(--steel-700);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.3rem;
}

.equipment-card-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1.5px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.equipment-card-footer .btn {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  justify-content: center;
  padding: 0.65rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Floating Back to Top Button */
.back-to-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--forest-800);
  color: #ffffff;
  border: 2px solid var(--amber-500);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease, background-color 0.2s ease;
  z-index: 999;
}

.back-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top-btn:hover {
  background-color: var(--amber-500);
  border-color: var(--amber-600);
  color: #ffffff;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(217, 119, 6, 0.4);
}

@media (max-width: 1024px) {
  .equipment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .equipment-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .equipment-image-wrap {
    height: 220px;
  }
  .equipment-card-body {
    padding: 1.25rem;
  }
  .equipment-card-title {
    font-size: 1.15rem;
    min-height: auto;
    margin-bottom: 0.35rem;
  }
  .equipment-card-price {
    font-size: 1.35rem;
    min-height: auto;
    margin-bottom: 0.5rem;
  }
  .equipment-card-excerpt {
    min-height: auto;
    margin-bottom: 1rem;
  }
  .equipment-card-footer {
    gap: 0.5rem;
  }
  .equipment-card-footer .btn {
    padding: 0.6rem 0.4rem;
    font-size: 0.825rem;
  }
  .back-to-top-btn {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 420px) {
  .equipment-card-footer {
    flex-direction: column;
    gap: 0.5rem;
  }
  .equipment-card-footer .btn {
    width: 100%;
  }
}

/* Flash Messages */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.alert-success {
  background-color: #f0fdf4;
  color: #14532d;
  border: 1.5px solid #86efac;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.main-footer {
  background-color: var(--steel-950);
  color: #cbd5e1;
  border-top: 4px solid var(--forest-800);
  padding-top: 4rem;
  padding-bottom: 2rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 3rem;
  margin-bottom: 3.5rem;
}

.footer-title {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.footer-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 24px;
  height: 2px;
  background-color: var(--amber-500);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.65rem;
}

.footer-links a {
  color: #cbd5e1;
  font-size: 0.9375rem;
  transition: color 0.15s ease, padding-left 0.15s ease;
  display: inline-block;
}

.footer-links a:hover {
  color: #fbbf24;
  padding-left: 4px;
}

.depot-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.depot-item {
  border-left: 2px solid var(--forest-600);
  padding-left: 0.75rem;
}

.footer-emergency-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(217, 119, 6, 0.2);
  border: 1px solid var(--amber-500);
  color: #fbbf24;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
}

/* ==========================================================================
   RESPONSIVE OVERRIDES
   ========================================================================== */

@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 768px) {
  .top-utility-bar {
    display: none;
  }

  .nav-menu {
    display: none;
  }

  .mobile-nav-toggle {
    display: block;
  }

  .mobile-drawer {
    display: flex;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}
