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

:root {
  --color-bg: #f8f7f4;
  --color-surface: #ffffff;
  --color-primary: #4a7c59;
  --color-primary-light: #6ba368;
  --color-primary-dark: #3a6147;
  --color-text: #2d2d2d;
  --color-text-light: #6b6b6b;
  --color-border: #e8e5e0;
  --color-accent: #d4a574;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 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);
  --transition: 0.2s ease;
  --container: 1200px;
}

html {
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-dark);
}

/* ===== Header ===== */
.header {
  background: var(--color-primary);
  color: white;
  padding: 48px 0 40px;
  text-align: center;
}

.header__icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}

.header__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header__subtitle {
  margin-top: 8px;
  font-size: 1rem;
  opacity: 0.85;
  font-weight: 400;
}

/* ===== Filters ===== */
.filters {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.filters__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filters__search {
  flex: 1;
  min-width: 200px;
}

.filters__input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--color-bg);
  transition: border-color var(--transition);
}

.filters__input:focus {
  outline: none;
  border-color: var(--color-primary);
}

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

.filter-tag {
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-light);
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-tag:hover {
  border-color: var(--color-primary-light);
  color: var(--color-primary);
}

.filter-tag.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.filters__select {
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--color-bg);
  cursor: pointer;
}

.filters__select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ===== Catalog ===== */
.catalog {
  padding: 32px 0 48px;
}

.catalog__count {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 20px;
}

.catalog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.catalog__empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--color-text-light);
}

.catalog__empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

/* ===== Product Card ===== */
.product-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.product-card__image-wrap {
  position: relative;
  padding-top: 75%;
  overflow: hidden;
  background: #f0ede8;
}

.product-card__image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-card__image {
  transform: scale(1.05);
}

.product-card__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--color-primary);
  color: white;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.product-card__body {
  padding: 16px 20px 20px;
}

.product-card__species {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.product-card__name {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 6px;
  color: var(--color-text);
}

.product-card__description {
  font-size: 0.85rem;
  color: var(--color-text-light);
  line-height: 1.5;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__care {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.care-tag {
  font-size: 0.72rem;
  padding: 3px 8px;
  background: #f0f7f1;
  color: var(--color-primary-dark);
  border-radius: 12px;
  white-space: nowrap;
}

.product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-card__price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}

.product-card__price span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--color-text-light);
}

.product-card__color {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.product-card__color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
}

/* ===== Contacts ===== */
.contacts {
  background: var(--color-surface);
  padding: 56px 0;
  border-top: 1px solid var(--color-border);
}

.contacts__title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 32px;
}

.contacts__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.contacts__card {
  text-align: center;
  padding: 24px 16px;
  background: var(--color-bg);
  border-radius: var(--radius);
}

.contacts__icon {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 8px;
}

.contacts__card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.contacts__card a,
.contacts__card p {
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.contacts__card a:hover {
  color: var(--color-primary);
}

.contacts__note {
  text-align: center;
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--color-text-light);
}

/* ===== Footer ===== */
.footer {
  padding: 24px 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-light);
  border-top: 1px solid var(--color-border);
}

.footer__admin {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--color-text-light);
}

/* ===== Admin ===== */
.admin-header {
  background: var(--color-primary);
  color: white;
  padding: 28px 0;
}

.admin-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-header__eyebrow {
  font-size: 0.8rem;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-header__title {
  font-size: 1.8rem;
  line-height: 1.2;
}

.admin-header__link {
  flex-shrink: 0;
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.9rem;
}

.admin-header__button {
  font: inherit;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
}

.admin-header__link:hover {
  color: white;
  background: rgba(255,255,255,0.12);
}

.admin-page {
  padding: 32px 0 56px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.4fr);
  gap: 24px;
  align-items: start;
}

.admin-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}

.admin-panel__header {
  margin-bottom: 18px;
}

.admin-panel__header--row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.admin-panel__header h2 {
  font-size: 1.2rem;
  line-height: 1.25;
}

.admin-panel__header p {
  margin-top: 6px;
  color: var(--color-text-light);
  font-size: 0.88rem;
}

.admin-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.admin-form__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-field {
  display: grid;
  gap: 6px;
}

.admin-field--wide {
  grid-column: 1 / -1;
}

.admin-field span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-light);
}

.admin-field input,
.admin-field select,
.admin-field textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font: inherit;
  background: var(--color-bg);
  color: var(--color-text);
}

.admin-field textarea {
  resize: vertical;
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-button,
.admin-delete {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 10px 13px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.admin-button:hover,
.admin-delete:hover {
  border-color: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.admin-button--primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.admin-button--primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: white;
}

.admin-button--danger,
.admin-delete {
  color: #a33a3a;
}

.admin-notice {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.admin-notice--success {
  background: #edf7ef;
  color: var(--color-primary-dark);
}

.admin-notice--error {
  background: #fff0f0;
  color: #a33a3a;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-product {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--color-bg);
}

.admin-product__image {
  width: 92px;
  height: 74px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--color-border);
}

.admin-product__body {
  min-width: 0;
}

/* ===== Login ===== */
.login-page {
  min-height: 100vh;
  background: var(--color-primary);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 420px);
  background: var(--color-surface);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 26px;
}

.login-card__back {
  display: inline-flex;
  margin-bottom: 24px;
  font-size: 0.88rem;
  color: var(--color-text-light);
}

.login-card__brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-card__icon {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.login-card__brand p {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.login-card__brand h1 {
  margin-top: 6px;
  font-size: 1.55rem;
  line-height: 1.2;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form__button {
  width: 100%;
}

.admin-product__actions {
  display: grid;
  gap: 8px;
}

.admin-product__meta {
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-product h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.admin-product p {
  margin: 4px 0 6px;
  color: var(--color-text-light);
  font-size: 0.84rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .header {
    padding: 32px 0 28px;
  }

  .header__title {
    font-size: 1.7rem;
  }

  .header__subtitle {
    max-width: 20ch;
    margin: 8px auto 0;
  }

  .filters {
    position: static;
    padding: 12px 0 0;
    background: transparent;
    border-bottom: none;
    box-shadow: none;
  }

  .filters__inner {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
  }

  .filters__search,
  .filters__tags,
  .filters__sort {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .filters__input {
    font-size: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
  }

  .filters__tags {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 2px 0 6px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .filters__tags::-webkit-scrollbar {
    display: none;
  }

  .filter-tag {
    flex: 0 0 auto;
    padding: 10px 18px;
    font-size: 0.95rem;
    border-radius: 22px;
  }

  .filters__select {
    width: 100%;
    font-size: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
  }

  .catalog {
    padding: 24px 0 40px;
  }

  .catalog__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .catalog__count {
    margin-bottom: 16px;
  }

  .product-card__body {
    padding: 16px;
  }

  .product-card__footer {
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .admin-header__inner,
  .admin-panel__header--row {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-header__actions {
    justify-content: stretch;
  }

  .admin-header__link {
    text-align: center;
  }

  .admin-header__actions .admin-header__link {
    flex: 1;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .admin-form__actions {
    flex-direction: column;
  }

  .admin-product {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .admin-product__image {
    width: 76px;
    height: 68px;
  }

  .admin-product__actions,
  .admin-delete,
  .admin-form__actions .admin-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .header__title {
    font-size: 1.55rem;
  }

  .header__subtitle {
    font-size: 0.95rem;
  }

  .filter-tag {
    padding: 9px 16px;
    font-size: 0.92rem;
  }

  .product-card__name {
    font-size: 1rem;
  }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card {
  animation: fadeInUp 0.4s ease both;
}

.product-card:nth-child(1) { animation-delay: 0.02s; }
.product-card:nth-child(2) { animation-delay: 0.04s; }
.product-card:nth-child(3) { animation-delay: 0.06s; }
.product-card:nth-child(4) { animation-delay: 0.08s; }
.product-card:nth-child(5) { animation-delay: 0.10s; }
.product-card:nth-child(6) { animation-delay: 0.12s; }
.product-card:nth-child(7) { animation-delay: 0.14s; }
.product-card:nth-child(8) { animation-delay: 0.16s; }
.product-card:nth-child(9) { animation-delay: 0.18s; }
.product-card:nth-child(10) { animation-delay: 0.20s; }
.product-card:nth-child(11) { animation-delay: 0.22s; }
.product-card:nth-child(12) { animation-delay: 0.24s; }
.product-card:nth-child(13) { animation-delay: 0.26s; }
.product-card:nth-child(14) { animation-delay: 0.28s; }
.product-card:nth-child(15) { animation-delay: 0.30s; }
