/* Базові стилі */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", system-ui, sans-serif;
}

body {
  background: #121212;
  color: #eaeaea;
  line-height: 1.6;
}

/* Контейнер */
.container {
  width: 90%;
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 80px;
}

/* Хедер */
header {
  background: #1c1c1c;
  border-bottom: 1px solid #2a2a2a;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 5%;
}

.logo {
  background: #000000;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: 8px;
  padding: 8px 12px;
  margin-right: 10px;
}

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

.brand h1 {
  font-size: 1.1rem;
  font-weight: 600;
}

.brand p {
  font-size: 0.8rem;
  color: #aaa;
}

.search-wrap {
  flex: 1;
  max-width: 400px;
  margin: 0 20px;
}

.category {
  background: #f2f2f2 !important;
  color: #222 !important;
  border: 1px solid #ccc;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.2s;
  font-size: 0.9rem;
}

.category:hover,
.category.active {
  background: #007bff !important;
  color: #fff !important;
}



#searchInput {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  background: #2a2a2a;
  color: #fff;
  outline: none;
}

#searchInput::placeholder {
  color: #777;
}

/* Бургер */
.burger {
  font-size: 1.4rem;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  display: none;
}

/* Мобільне меню */

#mobileSearchBtn {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
}

#mobileSearchBtn svg {
  display: block;
  width: 24px;
  height: 24px;
}




.mobile-menu {
  display: none;
  background: #1c1c1c;
  border-top: 1px solid #2a2a2a;
}

.mobile-menu ul {
  list-style: none;
}

.mobile-menu li {
  padding: 12px 20px;
  border-bottom: 1px solid #2a2a2a;
}

.mobile-menu a {
  color: #eaeaea;
  text-decoration: none;
  font-size: 0.95rem;
}

.section {
  margin-top: 40px;
}

.section h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
}

/* Картки постачальників */
.supplier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

/* Тільки для ТОП-5 карток */
.supplier-card.top-highlight {
  border: 2px solid #00d672f; /* зелений неон */
  box-shadow: 0 0 1px #00d672;
  transition: box-shadow 0.3s, border 0.3s;
}


.supplier-card.top-highlight:hover {
  box-shadow: 0 0 12px #0f0, 0 0 24px rgba(0,255,0,0.6);
  border-color: #0f0;
}


.supplier-card {
  background: #1c1c1c;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  color: #eaeaea;
}

.supplier-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.supplier-card {
  background: #1c1c1c;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #eaeaea;
  position: relative;
  overflow: hidden;
}

.supplier-card .media {
  position: relative;
  width: 100%;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  background: #222;
}

.supplier-card .media img.supplier-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Галочка Verified */
.supplier-card .media .badge.verified {
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(45deg, #00ff00, #009900);
  color: #fff;
  font-size: 0.8rem;
  padding: 2px 4px;
  border-radius: 50%;
  box-shadow: 0 0 6px #00ff00;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Бейджі TOP / NEW */
.supplier-card .badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  z-index: 5;
}

.supplier-card .badge.top {
  background: red;
  color: #fff;
  font-weight: bold;
  text-shadow: 0 0 4px orange;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.65rem;
  display: inline-block;
  text-align: center;
  min-width: 45px; /* фіксована мінімальна ширина */
  max-width: 45px;
  height: 18px; /* фіксована висота */
  line-height: 18px; /* центрування тексту по вертикалі */
  white-space: nowrap;
}

/* Адаптація для мобільних екранів */
@media (max-width: 480px) {
  .supplier-card .badge.top {
    font-size: 0.6rem; /* трохи менший текст */
    min-width: 40px;
    max-width: 40px;
    height: 16px;
    line-height: 16px;
  }
}


.supplier-card .badge.new {
  background: #00aaff;
  color: #fff;
  font-weight: bold;
  text-shadow: 0 0 4px #00aaff;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.65rem;
  display: inline-block;
  text-align: center;
  min-width: 45px; /* фіксована ширина */
  max-width: 45px;
  height: 18px; /* фіксована висота */
  line-height: 18px; /* центрування тексту по вертикалі */
  white-space: nowrap;
}

/* Адаптація для мобільних екранів */
@media (max-width: 480px) {
  .supplier-card .badge.new {
    font-size: 0.6rem;
    min-width: 40px;
    max-width: 40px;
    height: 16px;
    line-height: 16px;
  }
}

/* Verified */
.supplier-card .badge.verified {
  font-size: 0.7rem; /* зменшено шрифт */
  padding: 2px 4px; 
  border-radius: 50%;
  top: 6px;
  right: 6px;
  text-shadow: 0 0 5px #0f0;
  background: linear-gradient(45deg, #00ff00, #009900);
  color: #fff;
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 6px #00ff00;
}
/* Десктоп: над назвою */
@media (min-width: 601px) {
  .supplier-card .badges {
    position: static;
    margin-bottom: 4px;
  }
}

/* Мобільна версія */
@media (max-width: 600px) {
  .supplier-card {
    flex-direction: row;
    gap: 10px;
    align-items: flex-start;
    padding: 8px;
  }

  .supplier-card .media {
    width: 35%;
    height: 100px;
    min-width: 100px;
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
  }

  /* Verified трохи відсунемо, щоб не перекривав бейджі */
  .supplier-card .media .badge.verified {
    top: 6px;
    right: 6px;
    font-size: 0.65rem;
  }

  .supplier-card .badges {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: 4px;
    z-index: 10; /* зверху поверх фото */
  }

  .supplier-card .badges .badge {
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1.2;
    white-space: nowrap;
  }
}


/* Verified галочка залишаємо як є, маленька, на фото */
.supplier-card .media .badge.verified {
  font-size: 0.6rem;
  top: 6px;
  right: 6px;
  text-shadow: 0 0 5px #0f0;
  overflow: visible; /* щоб нічого не обрізалось */
}



  .supplier-card h3 {
    font-size: 1rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .supplier-card .meta {
    font-size: 0.8rem;
    color: #aaa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .supplier-card .actions button {
    font-size: 0.8rem;
    padding: 4px 8px;
  }
}




/* Мобільна адаптація */
@media (max-width: 600px) {
  .supplier-card .media {
    height: 100px;          /* трохи менше на мобільних */
  }

}

/* Категорії */
.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category {
  background: #2a2a2a;
  color: #000;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.2s;
  font-size: 0.9rem;
}

.category:hover,
.category.active {
  background: #00aaff;
}

/* Пагінація */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  gap: 10px;
}

.pagination button {
  background: #2a2a2a;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}

.pagination button.active,
.pagination button:hover {
  background: #00aaff;
}

/* Модальне вікно */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.open {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: #1c1c1c;
  border-radius: 16px;
  padding: 20px;
  max-width: 700px;
  width: 100%;
  color: #eaeaea;
  position: relative;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-body img {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.modal-info h2 {
  margin: 0 0 8px 0;
}

.modal-info p {
  margin: 4px 0;
}

.modal-info a {
  display: inline-block;
  background: #00aaff;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  margin-top: 10px;
  margin-right: 10px;
  transition: 0.2s;
}

.modal-info a:hover {
  background: #0095dd;
}

/* 🔴 Неоновий хрестик закриття */
.close {
  position: fixed; /* 👈 було absolute — тепер fixed, щоб не зсував контент */
  top: 20px;
  right: 20px;
  cursor: pointer;
  font-size: 1.8rem;
  color: #ff4d4d;
  text-shadow: 0 0 6px #ff4d4d, 0 0 12px #ff0000;
  transition: transform 0.25s ease, color 0.25s ease, text-shadow 0.25s ease;
  z-index: 2000; /* поверх зображення */
}

.close:hover {
  transform: scale(1.15);
  color: #ff1a1a;
  text-shadow: 0 0 10px #ff1a1a, 0 0 20px #ff0000;
}

/* 📱 Адаптація для мобільних */
@media (max-width: 600px) {
  .close {
    top: 14px;
    right: 14px;
    font-size: 1.6rem;
    text-shadow: 0 0 5px #ff3b3b, 0 0 10px #ff0000;
  }
}



/* Мобільна адаптація */
@media (max-width: 768px) {
  #modal .modal-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding: 16px;
  }

  #modalImage {
    max-width: 90%;
    max-height: 30vh;
  }

  #modal .modal-details {
    align-items: center;
  }
}






/* Footer */
footer {
  background: #1c1c1c;
  text-align: center;
  padding: 20px;
  color: #888;
  border-top: 1px solid #2a2a2a;
}

/* Адаптивність */
@media (max-width: 768px) {
  .burger {
    display: block;
  }

  .search-wrap {
    display: none;
  }

  .modal-body {
    flex-direction: column;
  }
}
/* --- ДОДАНІ/ОНОВЛЕНІ СТИЛІ --- */

@media (min-width: 768px) {
  .modal-body img {
    max-width: 320px;
    max-height: 320px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    margin: auto;
    display: block;
  }
}


/* Центрування зображення в модальному вікні */
.modal-body {
  display: flex;
  flex-direction: column;
  align-items: center; /* горизонтальне центрування */
  justify-content: center; /* вертикальне центрування */
  gap: 20px;
  text-align: center;
}

.modal-body img {
  display: block;
  margin: 0 auto; /* центрує по горизонталі */
  max-width: 100%;
  max-height: 70vh; /* щоб не вилазило за екран */
  width: auto;
  height: auto;
  border-radius: 10px;
  object-fit: contain; /* не обрізає, а вписує */
}

/* Для десктопів — більш пропорційно */
@media (min-width: 768px) {
  .modal-body {
    flex-direction: column;
  }

  .modal-body img {
    max-width: 80%;
    max-height: 75vh;
  }
}

:root {
  /* 🔹 Темна тема за замовчуванням */
  --bg: #121212;
  --text: #eaeaea;
  --card: #1c1c1c;
  --accent: #00aaff;
}

/* 🔹 Перевизначення змінних для світлої теми */
body.light {
  --bg: #f5f5f5;
  --text: #222;
  --card: #ffffff;
  --accent: #007bff;
}

/* 🔹 Глобальне застосування змінних */
body {
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

.supplier-card,
.modal-content,
footer,
header {
  background: var(--card);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
}

button, a, .link-btn {
  color: var(--text);
}


/* Перепризначення базових кольорів */
body {
  background: var(--bg);
  color: var(--text);
}

.supplier-card, .modal-content, .supplier-info {
  background: var(--card);
  color: var(--text);
}

a, button {
  color: var(--text);
}

/* === Тумблер теми (десктоп) === */
.theme-toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.theme-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #444;
  transition: 0.4s;
  border-radius: 24px;
}

.theme-toggle .slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.theme-toggle input:checked + .slider {
  background-color: var(--accent);
}

.theme-toggle input:checked + .slider::before {
  transform: translateX(22px);
}

/* Тумблер у мобільному меню */
.theme-toggle-mobile {
  padding: 15px 20px;
  border-top: 1px solid #2a2a2a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}

/* 🎨 Header: адаптація під світлу тему */
body.light header {
  background: #f0f0f0;
  border-bottom: 1px solid #ddd;
}

body.light .header-inner {
  color: #222;
}

body.light .logo {
  background: #007bff;
  color: #fff;
}

body.light .brand p {
  color: #555;
}

body.light #searchInput {
  background: #e8e8e8;
  color: #222;
}

body.light #searchInput::placeholder {
  color: #777;
}

body.light .burger {
  color: #222;
}

body.light #mobileSearchBtn svg {
  stroke: #333;
}



/* Кнопка "Перейти" */
body.light .link-btn {
  background: #007bff;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

body.light .link-btn:hover {
  background: #0056b3;
}

/* Темна тема (для контрасту) */
body:not(.light) .link-btn {
  background: #00aaff;
  color: #fff;
}

body:not(.light) .link-btn:hover {
  background: #0088cc;
}


/* Кнопка "Перейти" */
body:not(.light) .link-btn {
  background: #007bff;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

body:not(.light) .link-btn:hover {
  background: #0056b3;
}

/* 🔆 Світла тема — фон бургер-меню */
body.light .mobile-menu {
  background: #f0f0f0;
  border-top: 1px solid #ddd;
}

body.light .mobile-menu li {
  border-bottom: 1px solid #ddd;
}

body.light .mobile-menu a {
  color: #222;
}


/* 🧠 Локально затіняємо змінні тільки для кнопок категорій */
.category {
  --text: #ffffff;       /* тепер var(--text) всередині .category = білий */
  --card: ##1a1a1a;       /* свій фон для темної */
  color: var(--text);
  background: var(--card);
  border: 1px solid #333;
}

/* Для світлої теми — свої значення тих самих змінних */
body.light .category {
  --text: #222222;
  --card: #e8e8e8;
  color: var(--text);
  background: var(--card);
  border: 1px solid #ccc;
}

/* Ховер/актив для обох тем */
.category:hover,
.category.active {
  background: var(--accent);
  color: #fff;
}

/* 🎯 Остаточне виправлення категорій */
body:not(.light) .category {
  background: #1a1a1a !important; /* темний фон */
  color: #ffffff !important;      /* білий текст */
  border: 1px solid #333 !important;
}

body:not(.light) .category:hover,
body:not(.light) .category.active {
  background: #00aaff !important;
  color: #fff !important;
}

body.light .category {
  background: #e8e8e8 !important;
  color: #222 !important;
  border: 1px solid #ccc !important;
}

body.light .category:hover,
body.light .category.active {
  background: #007bff !important;
  color: #fff !important;
}



