:root {
  --bg: #f5f7f2;
  --card: #ffffff;
  --text: #0f2137;
  --muted: #5f6f7f;
  --line: #dce6d6;
  --green: #1f6b3d;
  --green-2: #57a54b;
  --soft: #edf6e9;
  --shadow: 0 10px 28px rgba(19, 34, 22, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

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

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

.wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e8eee4;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}


.brand h1 {
  margin: 0;
  font-size: 1.1rem;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav a {
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  color: var(--muted);
}

.nav a:hover,
.nav a.is-active {
  background: var(--soft);
  color: var(--green);
}

.hero {
  margin: 22px 0 18px;
  padding: 30px 24px;
  border-radius: 28px;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--green-2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  font-weight: 700;
  margin-bottom: 10px;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 3rem);
  line-height: 1.08;
}

.hero p {
  margin: 0;
  max-width: 760px;
  color: rgba(255,255,255,0.92);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: #fff;
  color: var(--green);
}

.btn-outline {
  background: var(--soft);
  color: var(--green);
  width: 100%;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  background: #fff;
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.field {
  flex: 1;
}

.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
}

.toolbar-info {
  min-width: 140px;
  text-align: center;
  background: var(--soft);
  border-radius: 16px;
  padding: 12px;
}

.toolbar-info strong {
  display: block;
  font-size: 1.8rem;
  color: var(--green);
}

.toolbar-info span {
  color: var(--muted);
}

.section-head {
  margin: 18px 0 14px;
}

.section-head h3 {
  margin: 0;
  font-size: 1.8rem;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.fruit-card {
  background: #fff;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fruit-photo {
  background: #eef2eb;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fruit-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-photo {
  color: #7b8794;
  font-size: 1.1rem;
}

.fruit-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
}

.fruit-name {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.1;
}

.fruit-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.2em;
}

.fruit-category {
  margin: 0;
  font-weight: 700;
}

.fruit-category span {
  font-weight: 500;
  color: var(--muted);
}

.fruit-footer {
  margin-top: auto;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.fruit-price {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--green);
}

.per-kilo {
  color: var(--muted);
  font-size: 0.92rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card,
.chart-card,
.ranking-card {
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.stat-card {
  text-align: center;
}

.stat-card span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--green);
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 90px;
  gap: 12px;
  align-items: center;
}

.bar-label {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 14px;
  background: #eef2eb;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--green), var(--green-2));
  border-radius: 999px;
}

.bar-value {
  text-align: right;
  font-weight: 700;
  color: var(--green);
}

.ranking-list {
  display: grid;
  gap: 10px;
}

.ranking-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eef2eb;
}

.rank-badge {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  background: #eef2eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7b8794;
  font-size: 0.9rem;
}

.rank-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ranking-item h4 {
  margin: 0 0 4px;
}

.ranking-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.ranking-item strong {
  color: var(--green);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 20, 0.62);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: calc(100% - 24px);
  max-width: 980px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  margin: 20px auto;
  background: #fff;
  border-radius: 24px;
}

.modal-close {
  position: sticky;
  top: 12px;
  margin: 12px 12px 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: #eef2eb;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-content {
  padding: 0 20px 20px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
}

.modal-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 18px;
  background: #eef2eb;
}

.detail-title {
  margin: 0 0 6px;
  font-size: 2rem;
}

.detail-category {
  margin: 0 0 12px;
  color: var(--muted);
}

.detail-text {
  margin: 0 0 16px;
  line-height: 1.5;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-box {
  background: #f7faf5;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
}

.stat-box small {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--soft);
  color: var(--green);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
}

.detail-block {
  margin-top: 18px;
}

.detail-block h4 {
  margin: 0 0 10px;
}

.detail-block ul {
  margin: 0;
  padding-left: 18px;
}

.detail-block li {
  margin-bottom: 8px;
}

.empty {
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  text-align: center;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 20px 0 10px;
  flex-wrap: wrap;
}

.btn-page {
  border: 0;
  background: #1f6b3d;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.btn-page:disabled {
  background: #b7c4b5;
  cursor: not-allowed;
}

#pageInfo {
  font-weight: 700;
  color: #1f2937;
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  outline: none;
  font: inherit;
}

.field input:focus,
.field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 107, 61, 0.12);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-refresh {
  border: 0;
  background: #1f6b3d;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  
}

.btn-refresh:hover {
  background: #17522f;
}

.btn-refresh:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: #1f6b3d;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  z-index: 1200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s ease;
}

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

.btn-top:hover {
  background: #17522f;
}

@media (max-width: 700px) {
  .btn-top {
    right: 14px;
    bottom: 14px;
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
}


@media (min-width: 768px) {
  .catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .catalog-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-photo {
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 700px) {

  .header-actions {
    width: 100%;
  }

  .btn-refresh {
    width: 100%;
  }

  .wrapper {
    padding-left: 18px;
    padding-right: 18px;
  }
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav {
    width: 100%;
  }

  .nav a {
    flex: 1;
    text-align: center;
  }

  .hero {
    padding: 24px 18px;
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .fruit-photo {
    aspect-ratio: 1 / 1;
  }

  .fruit-body {
    padding: 12px;
    min-height: 200px;
  }

  .fruit-name {
    font-size: 1.05rem;
  }

  .fruit-price {
    font-size: 1.2rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .bar-value {
    text-align: left;
  }

  .detail-stats {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    width: calc(100% - 12px);
    margin: 12px auto;
    max-height: calc(100vh - 24px);
  }
}


