/* ===================== */
/* VARIABLES */
/* ===================== */
:root {
  --bg-1: #06142a;
  --bg-2: #0b2a55;
  --bg-3: #eaf2ff;

  --card: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.12);

  --blue: #2f6fed;
  --blue-light: #6ea8ff;

  --text: #ffffff;
  --muted: rgba(255,255,255,0.7);
}

/* ===================== */
/* RESET */
/* ===================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===================== */
/* BODY */
/* ===================== */
body {
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3));
  color: var(--text);
}

/* ===================== */
/* HEADER */
/* ===================== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 15px;
  background: rgba(6,20,42,0.85);
  backdrop-filter: blur(10px);

  position: sticky;
  top: 0;
  z-index: 1000;
}

.burger {
  font-size: 26px;
  color: var(--blue-light);
  cursor: pointer;
}

.logo {
  font-size: 18px;
  font-weight: bold;
  color: var(--blue-light);
}

.cart {
  cursor: pointer;
  font-size: 18px;
}

#cartCount {
  background: #ff3b3b;
  border-radius: 50%;
  padding: 3px 7px;
  font-size: 12px;
  margin-left: 5px;
}

/* ===================== */
/* SIDEBAR */
/* ===================== */
.sidebar {
  position: fixed;
  left: -260px;
  top: 0;
  width: 260px;
  height: 100%;

  background: #06142a;
  padding: 20px;

  transition: 0.3s;
  z-index: 999;
}

.sidebar.active {
  left: 0;
}

.sidebar a {
  display: block;
  margin: 15px 0;
  color: var(--blue-light);
  text-decoration: none;
  font-size: 18px;
}

/* ===================== */
/* BUTTONS */
/* ===================== */
.home-btn,
.back-btn {
  display: inline-block;
  margin: 10px;
  padding: 8px 12px;

  background: #0b2a55;
  color: #fff;

  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);

  cursor: pointer;
}

.home-btn:hover,
.back-btn:hover {
  background: #123a73;
}

/* ===================== */
/* TITLES */
/* ===================== */
h1 {
  text-align: center;
  margin: 20px 0;
}


/* ===================== */
/* products */
/* ===================== */
/* сетка */
.products {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 220px));
  justify-content: center;
  gap: 15px;

  align-items: stretch; /* 🔥 важно */
}

/* карточка */
.product {
  display: flex;
  flex-direction: column;

  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);

  padding: 15px;
  border-radius: 14px;
  text-align: center;

  transition: all 0.3s ease;
}

/* hover */
.product:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.35);
}

/* картинка */
.product img {
  width: 100%;
  aspect-ratio: 1 / 1;   /* 🔥 квадрат как в маркетплейсах */
  object-fit: contain;   /* ничего не режет */

  background: #fff;
  padding: 8px;
  border-radius: 10px;

  margin-bottom: 10px;
}

/* название */
.product h3 {
  flex-grow: 1;           /* 🔥 главный фикс */
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 10px;
}

/* кнопки */
.view-btn {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
}

.product button {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--blue), var(--blue-light));
  color: #fff;
}

@media (max-width: 600px) {
  .product img {
    aspect-ratio: 1 / 1;   /* квадрат */
    object-fit: cover;     /* 🔥 на мобилке заполняет полностью */
    padding: 0;            /* убираем “мелкость” */
  }

  .product {
    padding: 12px;
  }
}

/* ===================== */
/* CATEGORIES */
/* ===================== */
.categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;

  max-width: 600px;
  margin: 30px auto;
  padding: 0 15px;
}

.category-btn {
  position: relative;
  display: block;
  height: 80px;

  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;

  font-weight: 600;
}

.category-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;      /* обрезает и заполняет */
  object-position: center; /* центрирует картинку */
}

/* затемнение поверх картинки */
.category-btn::after {
  content: "";
  position: absolute;
  inset: 0;

  background: linear-gradient(
    to top,
    rgba(0,0,0,0.75) 0%,   /* 🔥 сильнее снизу */
    rgba(0,0,0,0.3) 40%,
    transparent 100%
  );
}

/* текст */
.category-btn span {
  position: absolute;
  bottom: 10px;          /* 🔥 перенос вниз */
  left: 10px;
  right: 10px;

  transform: none;

  font-size: 14px;
  font-weight: 600;

  text-align: left;

  color: #fff;

  z-index: 2;
}

.category-btn:hover {
  transform: translateY(-3px);
}

.category-btn span {
  letter-spacing: 0.3px;
  line-height: 1.3;

  /* 🔥 читаемость */
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

/* ===================== */
/* CART */
/* ===================== */
.cart-modal {
  position: fixed;
  right: -380px;
  top: 0;

  width: 350px;
  height: 100%;

  background: #06142a;
  padding: 15px;

  transition: 0.3s;
  z-index: 1000;

  overflow-y: auto;
}

.cart-modal.active {
  right: 0;
}

.cart-close {
  position: absolute;
  top: 8px;
  right: 8px;

  width: 22px;
  height: 22px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: none;
  border-radius: 6px;

  background: rgba(255,255,255,0.1);
  color: var(--blue-light);

  cursor: pointer;
}

/* ITEMS */
.cart-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* TOTAL */
.cart-total {
  margin-top: 10px;
  font-weight: bold;
}

/* ===================== */
/* OVERLAY */
/* ===================== */
#overlay {
  position: fixed;
  top: 0;
  left: 0;

  width: 100%;
  height: 100%;

  background: rgba(0,0,0,0.5);

  opacity: 0;
  visibility: hidden;

  transition: 0.3s;
}

#overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===================== */
/* SAFE CHECKOUT (FIX ALL CONFLICTS) */
/* ===================== */

.checkout-container {
  max-width: 520px;
  margin: 50px auto;
  padding: 25px;

  background: #f6f7f2;

  border-radius: 16px;
  border: 1px solid #d6dbc7;

  box-shadow: 0 15px 40px rgba(0,0,0,0.12);

  color: #2f3a1f;
  font-family: Arial, sans-serif;
}

/* title */
.checkout-container h1 {
  text-align: center;
  font-size: 24px;
  margin-bottom: 15px;
  color: #2f3a1f;
}

/* items block */
#checkoutItems {
  background: #e9ecdff2;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 15px;
}

#checkoutItems div {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}

/* total */
#totalPrice {
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  margin: 10px 0 20px;
  color: #2f3a1f;
}

/* INPUTS (ВАЖНО: УБИРАЕМ КОНФЛИКТЫ) */
.checkout-container input,
.checkout-container select {
  width: 100% !important;

  padding: 12px;
  margin-bottom: 10px;

  border-radius: 10px;
  border: 1px solid #c9cfb8;

  background: #fff;

  font-size: 14px;

  outline: none;
}

/* focus */
.checkout-container input:focus,
.checkout-container select:focus {
  border-color: #6b7a3a;
  box-shadow: 0 0 0 3px rgba(107,122,58,0.15);
}

/* BUTTON (фикс конфликта с другими кнопками сайта) */
.checkout-container button {
  width: 100% !important;

  padding: 14px;

  border: none;
  border-radius: 12px;

  background: linear-gradient(135deg, #6b7a3a, #8fa94a);
  color: #fff;

  font-weight: 700;

  cursor: pointer;

  transition: 0.2s ease;
}

/* hover */
.checkout-container button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(107,122,58,0.25);
}

/* mobile */
@media (max-width: 600px) {
  .checkout-container {
    margin: 20px;
    padding: 20px;
  }
}

/* ===================== */
/* MOBILE */
/* ===================== */
@media (max-width: 768px) {
  .products {
    grid-template-columns: repeat(2, 1fr);
  }

  .cart-modal {
    width: 100%;
    right: -100%;
  }

  .categories {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===================== */
/* PAGINATION FIX */
/* ===================== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;

  gap: 8px;

  margin: 25px auto;
  padding: 10px;

  width: 100%;
}

/* кнопки страниц */
.pagination button {
  min-width: 38px;
  height: 38px;

  padding: 0 12px;

  border: 1px solid #e5e5e5;
  border-radius: 10px;

  cursor: pointer;

  font-weight: 600;
  font-size: 14px;

  color: #1f2937;

  background: #ffffff;

  box-shadow: 0 2px 8px rgba(0,0,0,0.06);

  transition: 0.2s ease;
}

/* hover */
.pagination button:hover {
  transform: translateY(-1px);
  border-color: #1f3b2c;
  color: #1f3b2c;
  box-shadow: 0 6px 14px rgba(0,0,0,0.10);
}

/* активная страница */
.pagination button.active {
  background: #1f3b2c; /* дорогой оливковый */
  color: #fff;
  border-color: #1f3b2c;

  box-shadow: 0 8px 18px rgba(31, 59, 44, 0.25);
}

/* ===================== */
/* PRODUCT IMAGE ZOOM */
/* ===================== */

.product-img {
  width: 100%;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.product-img:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

/* LIGHTBOX */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
  z-index: 9999;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  transform: scale(0.9);
  transition: 0.2s;
}

.lightbox.active img {
  transform: scale(1);
}

.view-btn {
  display: block;
  margin-top: 10px;
  padding: 10px;

  text-align: center;
  text-decoration: none;

  border-radius: 8px;

  background: linear-gradient(135deg, #d4af37, #f1d592);
  color: #1a1a1a;

  font-weight: 600;

  transition: 0.25s;
}

.view-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(212,175,55,0.4);
}

.site-footer {
  margin-top: 40px;
  padding: 25px 15px;

  background: #0f172a;
  color: #ffffff;

  text-align: center;
}

.footer-logo {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;

  margin-bottom: 15px;
}

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;

  transition: 0.2s;
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-copy {
  font-size: 12px;
  color: #94a3b8;
}

.checkout-container button {
  width: 100%;
  padding: 16px;

  border: none;
  border-radius: 14px;

  background: linear-gradient(135deg, #0f2a1d, #1f3b2c, #2e5a3e);
  color: #fff;

  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;

  cursor: pointer;

  box-shadow: 0 10px 25px rgba(0,0,0,0.15);

  transition: all 0.25s ease;
}

.checkout-container button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.25);
  background: linear-gradient(135deg, #1f3b2c, #2e5a3e, #3c7a52);
}

.checkout-container button:active {
  transform: scale(0.98);
}

.back-btn {
  display: inline-block;
  margin: 10px 0 15px;
  padding: 10px 14px;

  background: #0b2a55;
  color: #fff;

  border-radius: 10px;
  border: none;

  font-weight: 600;

  cursor: pointer;

  transition: 0.2s ease;
}

.back-btn:hover {
  background: #123a73;
  transform: translateY(-1px);
}

.pagination {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 8px !important;

  margin: 25px 0 !important;
  padding: 10px !important;
}

/* КНОПКИ */
.pagination a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 38px !important;
  height: 38px !important;

  text-decoration: none !important;

  border: 1px solid #444 !important;
  border-radius: 10px !important;

  color: #fff !important;
  font-size: 14px !important;
  font-weight: 600 !important;

  background: #111 !important;

  line-height: 1 !important;

  transition: 0.2s ease !important;
}

/* hover */
.pagination a:hover {
  border-color: #FFD700 !important;
  color: #FFD700 !important;
  transform: translateY(-2px) !important;
}

/* active */
.pagination a.active {
  border: 2px solid #FFD700 !important;
  color: #FFD700 !important;
  border-radius: 50% !important;
  background: transparent !important;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
}

.tags button {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #444;

  background: transparent;
  color: #ccc;

  cursor: pointer;
  font-size: 13px;

  transition: 0.2s;
}

.tags button:hover {
  border-color: #FFD700;
  color: #FFD700;
}

.tags button.active {
  background: #FFD700;
  color: #000;
  border-color: #FFD700;
}