/* ============================================================
   DM Foods — Modern catalog UI with LEFT product sidebar
   Color: Teal-green modern palette
   ============================================================ */
:root {
  /* Premium emerald + warm gold */
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #10b981;
  --primary-soft: #ecfdf5;
  --accent: #d97706;
  --accent-soft: #fffbeb;
  --text: #1c1917;
  --text-muted: #78716c;
  --bg: #fafaf9;
  --surface: #ffffff;
  --border: #e7e5e4;
  --sidebar-w: 280px;
  --header-h: 72px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(28,25,23,0.06);
  --shadow-md: 0 8px 24px rgba(28,25,23,0.08);
  --transition: 0.25s ease;
  --font-sans: 'Plus Jakarta Sans', var(--font-sans), system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font-sans), system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  margin: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

/* ========== HEADER ========== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: var(--shadow);
}

.logo-badge {
  width: 42px; height: 42px;
  background: linear-gradient(145deg, var(--primary), var(--primary-light));
  color: #fff;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.logo-name {
  font-family: var(--font-display);
  font-weight: 750;
  font-size: 1.15rem;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.logo-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.header-search .form-control {
  border-radius: 8px 0 0 8px;
  border-color: var(--border);
  border-right: 0;
  padding: 0.55rem 1rem;
}

.header-search .form-control:focus {
  border-color: var(--primary);
  box-shadow: none;
}

.btn-search {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: 0 8px 8px 0;
  padding: 0 1rem;
}

.btn-search:hover { background: var(--primary-dark); color: #fff; }

.btn-header-call {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
}

.btn-header-call:hover { background: #d1fae5; color: var(--primary-dark); }

.btn-header-email {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
}

.btn-header-email:hover { background: var(--primary-dark); color: #fff; }

/* ========== LAYOUT ========== */
.site-layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

/* ========== LEFT PRODUCT SIDEBAR ========== */
.product-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  z-index: 1020;
}

.sidebar-inner {
  padding: 16px 12px 24px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.sidebar-head {
  padding: 4px 8px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.side-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 16px 12px 8px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.side-link i {
  font-size: 1.05rem;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.side-link:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.side-link:hover i { color: var(--primary); }

.side-link.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}

.side-link.active i { color: var(--primary); }

.side-count {
  font-size: 0.72rem;
  background: var(--bg);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}

.side-link.active .side-count {
  background: var(--primary);
  color: #fff;
}

.sidebar-footer-info {
  margin-top: 20px;
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

.sidebar-footer-info a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

/* Mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  z-index: 1040;
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* ========== MAIN CONTENT ========== */
.site-main {
  flex: 1;
  min-width: 0;
  padding: 24px 20px 40px;
}

@media (min-width: 1200px) {
  .site-main { padding: 28px 32px 48px; }
}

/* ========== HERO ========== */
.hero {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 60%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  margin-bottom: 28px;
}

.hero h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  margin-bottom: 0.75rem;
  color: var(--text);
}

.hero h1 span { color: var(--primary); }

.hero p {
  color: var(--text-muted);
  max-width: 520px;
  font-size: 1rem;
}

.hero-stats {
  display: flex;
  gap: 1.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.hero-stat strong {
  display: block;
  font-size: 1.4rem;
  font-weight: 750;
  color: var(--primary-dark);
}

.hero-stat span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ========== BUTTONS ========== */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  border-radius: 8px;
  font-weight: 600;
  padding: 0.5rem 1.2rem;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(5,150,105,0.3);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
  border-radius: 8px;
  font-weight: 600;
}

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ========== SECTIONS ========== */
.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ========== CATEGORY CARDS ========== */
.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
  transition: all var(--transition);
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #a7f3d0;
}

.category-card .card-img-wrap {
  height: 120px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
}

.category-card .card-body { padding: 1rem; }

.category-card h5 {
  font-size: 0.92rem;
  font-weight: 650;
  margin-bottom: 0.2rem;
}

.category-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

/* ========== PRODUCT CARDS ========== */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #a7f3d0;
}

.product-card .img-wrap {
  height: 170px;
  background: #fafbfc;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.product-card .img-wrap img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  padding: 0.6rem;
}

.product-card .img-placeholder {
  font-size: 3rem;
  color: #a7f3d0;
}

.product-card .badge-featured {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--accent);
  color: #1a1a1a;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

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

.product-card .category-label {
  font-size: 0.68rem;
  color: var(--primary);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.product-card h5 {
  font-size: 0.92rem;
  font-weight: 650;
  margin-bottom: 0.3rem;
  line-height: 1.35;
}

.product-card .short-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
  margin-bottom: 0.75rem;
}

.product-card .price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.product-card .unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Product detail */
.product-detail-img {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-detail-img img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
}

/* About */
.about-feature { text-align: center; padding: 1.25rem; }

.about-feature .icon {
  width: 56px; height: 56px;
  background: var(--primary-soft);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 0.85rem;
}

/* Contact */
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  height: 100%;
}

.contact-card .icon {
  width: 44px; height: 44px;
  background: var(--primary-soft);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.15rem;
  margin-bottom: 0.85rem;
}

/* CTA */
.cta-band {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  border-radius: 16px;
  margin-top: 8px;
}

/* Footer */
.footer {
  background: #1c1917;
  color: #fff;
}

.footer-heading {
  font-size: 0.88rem;
  font-weight: 650;
  margin-bottom: 1rem;
}

.footer-links a,
.footer-contact li {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.88rem;
  display: block;
  margin-bottom: 0.4rem;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--primary-light); }

.footer-contact li {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.footer-contact i { color: var(--primary-light); margin-top: 2px; }

.text-muted-footer { color: rgba(255,255,255,0.4); }
.footer-divider { border-color: rgba(255,255,255,0.08); }

.social-link {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  transition: all 0.2s;
}

.social-link:hover { background: var(--primary); color: #fff; }

/* Forms */
.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--border);
  padding: 0.55rem 0.9rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5,150,105,0.15);
}

.form-label { font-weight: 550; font-size: 0.88rem; }

.page-link {
  border-radius: 6px !important;
  margin: 0 2px;
  color: var(--primary);
  border-color: var(--border);
}

.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

.breadcrumb { background: transparent; padding: 0; margin-bottom: 1rem; }
.breadcrumb-item a { color: var(--primary); text-decoration: none; }

/* ========== RESPONSIVE ========== */
@media (max-width: 991.98px) {
  .product-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    width: min(300px, 85vw);
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 1050;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  }
  .product-sidebar.open {
    transform: translateX(0);
  }
  .site-main {
    padding: 16px 14px 32px;
  }
  .hero {
    padding: 1.75rem 1.25rem;
    text-align: center;
  }
  .hero p { margin-left: auto; margin-right: auto; }
  .hero-stats { justify-content: center; }
}

@media (max-width: 575.98px) {
  .product-card .img-wrap { height: 140px; }
}

/* ============================================================
   MOBILE OPTIMIZATION — phones & small tablets
   ============================================================ */

/* Prevent horizontal scroll everywhere */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

img, video, iframe, table {
  max-width: 100%;
  height: auto;
}

/* Touch-friendly targets */
.side-link {
  min-height: 44px;
}

.btn {
  min-height: 40px;
}

.btn-sm {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
}

/* Sticky header safe on mobile */
.site-header {
  padding-top: env(safe-area-inset-top, 0);
}

@media (max-width: 991.98px) {
  :root {
    --header-h: 60px;
  }

  .site-header .py-2,
  .site-header .py-md-3 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  .logo-badge {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }

  /* Sidebar full height over everything */
  .product-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    bottom: 0;
    height: 100% !important;
    height: 100dvh !important;
    width: min(300px, 88vw) !important;
    max-width: 320px;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1060;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .product-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    z-index: 1055;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .site-layout {
    display: block;
    min-height: auto;
  }

  .site-main {
    width: 100%;
    padding: 12px 12px 28px;
  }

  /* Hero mobile */
  .hero {
    padding: 1.5rem 1rem;
    border-radius: 12px;
    margin-bottom: 16px;
  }

  .hero h1 {
    font-size: 1.45rem;
  }

  .hero .btn-lg {
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
  }

  .hero-stats {
    gap: 1rem;
  }

  .hero-stat strong {
    font-size: 1.2rem;
  }

  /* Product grid tighter */
  .product-card .card-body {
    padding: 0.75rem;
  }

  .product-card h5 {
    font-size: 0.85rem;
  }

  .product-card .short-desc {
    font-size: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .product-card .price {
    font-size: 0.95rem;
  }

  /* Stack filter form */
  .page-wrap .row.g-3 .col-md-5,
  .page-wrap .row.g-3 .col-md-4,
  .page-wrap .row.g-3 .col-md-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Tables scroll horizontally if needed */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }

  /* Modal full-ish on small screens */
  .modal-dialog {
    margin: 0.75rem;
  }

  /* Footer */
  .footer {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .footer .col-6 {
    margin-bottom: 0.5rem;
  }

  /* Section titles */
  .section-title {
    font-size: 1.2rem;
  }

  /* Category cards */
  .category-card .card-img-wrap {
    height: 100px;
    font-size: 2rem;
  }

  /* Buttons in product card — full width feel on tiny screens */
  .product-card .btn-sm {
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
  }

  /* Breadcrumb wrap */
  .breadcrumb {
    font-size: 0.8rem;
    flex-wrap: wrap;
  }

  /* CTA */
  .cta-band {
    border-radius: 12px;
    padding: 1.5rem 1rem !important;
  }

  .cta-band .btn-lg {
    width: 100%;
    max-width: 280px;
  }
}

@media (max-width: 575.98px) {
  .product-card .img-wrap {
    height: 130px;
  }

  /* 2-column product grid stays, but tighter */
  .row.g-4 {
    --bs-gutter-x: 0.65rem;
    --bs-gutter-y: 0.65rem;
  }

  .row.g-3 {
    --bs-gutter-x: 0.65rem;
    --bs-gutter-y: 0.65rem;
  }

  /* Header actions compact */
  .btn-header-email {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
  }

  #openSidebar {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .site-main {
    padding: 10px 10px 24px;
  }

  /* Product detail stack */
  .product-detail-img {
    min-height: 220px;
  }

  /* Contact form */
  .card .card-body.p-4,
  .card .card-body.p-md-5 {
    padding: 1.25rem !important;
  }

  /* Hide long unit text if needed */
  .product-card .unit {
    display: none;
  }
}

/* Landscape phones */
@media (max-width: 991.98px) and (orientation: landscape) {
  .product-sidebar {
    width: min(260px, 70vw) !important;
  }
  .hero {
    padding: 1.25rem 1rem;
  }
}

/* Very small devices */
@media (max-width: 360px) {
  .col-6 .product-card .btn-sm {
    font-size: 0.7rem;
    padding: 0.25rem 0.4rem;
  }
  .logo-name {
    font-size: 1rem;
  }
}
