/* JMG Eesti — Clean, minimal, green accent */
:root {
  --color-primary: #1a1a1a;
  --color-accent: #2d6a4f;
  --color-accent-hover: #1b4332;
  --color-accent-light: #d8f3dc;
  --color-text: #111;
  --color-text-secondary: #555;
  --color-text-muted: #888;
  --color-bg: #fff;
  --color-bg-alt: #f8f9fa;
  --color-surface: #f1f3f4;
  --color-border: #e8eaed;
  --color-border-light: #f0f1f2;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --content-width: 1200px;
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition: all 0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-base);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* Header */
.site-header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}
.brand {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

/* Cart toggle */
.cart-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}
.cart-toggle:hover {
  background: var(--color-accent-hover);
}
.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: #fff;
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 50%;
}

/* Hero */
.hero {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
  text-align: center;
}
.hero h1 {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}
.hero p {
  font-size: 1rem;
  color: var(--color-text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

/* Main */
main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* Category tabs */
.category-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-light);
}
.category-tab {
  padding: 0.5rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.category-tab:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.category-tab.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* Products header */
.products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.product-count {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* Product card */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}
.card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-md);
}
.card-image {
  aspect-ratio: 3 / 4;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 2rem;
  font-weight: 600;
}
.card-body {
  padding: 1rem 1.25rem 1.25rem;
}
.card-category {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: 0.375rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}
.card-price {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}
.card-price small {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* Length toggle */
.length-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0;
  border-top: 1px solid var(--color-border-light);
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.length-toggle:hover {
  color: var(--color-accent);
}
.length-toggle-arrow {
  margin-left: auto;
  transition: transform 0.2s;
}
.length-toggle.open .length-toggle-arrow {
  transform: rotate(180deg);
}

/* Length overlay */
.length-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  z-index: 10;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.length-overlay.open {
  max-height: 240px;
}
.length-overlay-inner {
  padding: 1rem 1.25rem;
  max-height: 240px;
  overflow-y: auto;
}
.length-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.length-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: var(--transition);
}
.length-option:last-child {
  border-bottom: none;
}
.length-option:hover {
  background: var(--color-bg-alt);
  margin: 0 -1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
.length-option.selected {
  background: var(--color-accent-light);
  margin: 0 -1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
.length-option-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.length-option-length {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}
.length-option-price {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}
.length-option-add {
  padding: 0.375rem 0.75rem;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}
.length-option-add:hover {
  background: var(--color-accent-hover);
}

/* Add button */
.btn-add {
  width: 100%;
  padding: 0.75rem;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 0.75rem;
}
.btn-add:hover {
  background: var(--color-accent-hover);
}
.btn-add.added {
  background: var(--color-text-muted);
}

/* Floating pill */
.pill {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.5rem;
}
.pill-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}
.pill-toggle:hover {
  background: var(--color-accent-hover);
  transform: scale(1.05);
}
.pill-bar {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  margin-bottom: 0.5rem;
}
.pill-bar.open {
  display: flex;
}
.pill-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: none;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.pill-btn:hover {
  background: var(--color-surface);
}
.pill-cart {
  color: var(--color-accent);
  font-weight: 500;
}

/* Cart dropdown */
.cart-dropdown {
  position: fixed;
  top: 60px;
  right: 1.5rem;
  width: 320px;
  max-width: calc(100vw - 2rem);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 90;
  display: none;
  flex-direction: column;
  max-height: 400px;
}
.cart-dropdown.open {
  display: flex !important;
}
.cart-dropdown-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-dropdown-header h3 {
  font-size: 1rem;
  font-weight: 600;
}
.cart-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--color-text-secondary);
}
.cart-dropdown-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.cart-dropdown-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border-light);
}
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--color-border-light);
}
.cart-item:last-child {
  border-bottom: none;
}
.cart-item-info {
  flex: 1;
}
.cart-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.125rem;
}
.cart-item-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.cart-item-remove {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
}
.cart-item-remove:hover {
  color: #c00;
}
.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.375rem;
}
.qty-btn {
  width: 22px;
  height: 22px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.qty-btn:hover {
  background: var(--color-surface);
}
.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  padding: 2rem 0;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
  padding: 1rem 0;
}
.pagination-btn {
  padding: 0.5rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
  transition: var(--transition);
}
.pagination-btn:hover:not(:disabled) {
  background: var(--color-surface);
  border-color: var(--color-accent);
}
.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination-btn.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.pagination-info {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

/* Filter drawer */
.filter-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 100%;
  height: 100vh;
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
  z-index: 110;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.filter-drawer.open {
  transform: translateX(0) !important;
}
.filter-drawer-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.filter-drawer-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}
.filter-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-secondary);
}
.filter-drawer-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.filter-drawer-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--color-border-light);
  display: flex;
  gap: 0.75rem;
}
.filter-group {
  margin-bottom: 1.5rem;
}
.filter-group-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}
.filter-list {
  list-style: none;
}
.filter-list li {
  margin-bottom: 0.25rem;
}
.filter-btn {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: none;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover {
  background: var(--color-surface);
  color: var(--color-text);
}
.filter-btn.active {
  background: var(--color-accent);
  color: #fff;
}
.price-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.price-range input {
  width: 80px;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
}
.price-range input:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* Dimension filters */
.dimension-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.dimension-filter label {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
}
.dimension-filter select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--color-bg);
  cursor: pointer;
}
.dimension-filter select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* Sort dropdown */
.sort-dropdown {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 95;
  display: none;
  flex-direction: column;
  min-width: 180px;
  padding: 0.5rem;
}
.sort-dropdown.open {
  display: flex !important;
}
.sort-option {
  padding: 0.625rem 1rem;
  background: none;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.sort-option:hover {
  background: var(--color-surface);
}
.sort-option.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 500;
}

/* Search overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.97);
  z-index: 120;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
}
.search-overlay.open {
  display: flex !important;
}
.search-overlay-inner {
  width: 100%;
  max-width: 600px;
  padding: 0 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}
.search-overlay input {
  flex: 1;
  padding: 1rem 0;
  border: none;
  border-bottom: 2px solid var(--color-border);
  font-size: 1.5rem;
  background: none;
  color: var(--color-text);
}
.search-overlay input:focus {
  outline: none;
  border-bottom-color: var(--color-accent);
}
.search-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--color-text-secondary);
}

/* Overlay backdrop */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: 80;
  display: none;
}
.overlay-backdrop.open {
  display: block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}
.btn-accent {
  background: var(--color-accent);
  color: #fff;
  flex: 1;
}
.btn-accent:hover {
  background: var(--color-accent-hover);
}
.btn-outline {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  flex: 1;
}
.btn-outline:hover {
  background: var(--color-surface);
}
.w-full {
  width: 100%;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.875rem 1.5rem;
  background: var(--color-text);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.875rem;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success {
  background: var(--color-accent);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border-light);
  padding: 3rem 1.5rem 2rem;
  margin-top: 2rem;
  background: var(--color-bg-alt);
}
.footer-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-inner h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text);
}
.footer-inner p {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}
.footer-inner a {
  color: var(--color-accent);
}
.footer-inner a:hover {
  text-decoration: underline;
}
.footer-bottom {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}
.footer-badge {
  padding: 0.5rem 1rem;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fbbf24;
  border-radius: var(--radius);
  font-size: 0.75rem;
}

/* Mobile */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .category-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.5rem;
  }
  .category-tab {
    flex-shrink: 0;
  }
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
  .hero h1 {
    font-size: 1.375rem;
  }
  .pill {
    bottom: 1rem;
    right: 1rem;
  }
  .filter-drawer {
    width: 100%;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
