.gallery {
  max-width: 500px;
  text-align: center;
  margin-top: 40px;
  margin-left: 5%;
  float: left;
  width: 50%;
}

.main-image img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(0,0,0,0.2);
  margin-bottom: 15px;
}

.thumbnails {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.thumbnails img {
  width: 100px;
  height: auto;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.thumbnails img:hover {
  transform: scale(1.05);
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
}


#name {
    float: right;
    margin-top: 40px;
    margin-right: 10%;
}

h3 {
    margin-top: 20px;
    margin-left: 1%;
}


h4 {
    margin-top: 15px;
    margin-left: 1%;
}

/*.mechanism-options {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.mechanism-section h3 {
  margin-bottom: 0px;
}*/

.mechanism-options button,
.size-options button {
  padding: 10px 15px;
  border: 1px solid #999;
  background-color: #f0f0f0;
  cursor: pointer;
  /*border-radius: 5px;*/
  transition: all 0.3s ease;
  margin-top: 5px;
}

.mechanism-options button.active,
.size-options button.active {
  background-color: #132337;
  color: #fff;
  border-color: #132337;
}

.product-options {
  margin-top: 20px;
}

button {
  padding: 10px 20px;
  font-size: 16px;
  margin: 0px;
  cursor: pointer;
}

#openModal {
  margin-top: 15px;
}

.purchase-buttons {
  margin-top: 30px;
}

.buy-button {
  border: 1px solid #999;
  border-radius: 10px;
}

.buy-installment-button {
  margin-left: 60px;
   border: 1px solid #999;
  border-radius: 10px;
}


.buy-button:hover {
background-color: #333;
color: #f0f0f0;
}

.buy-installment-button:hover {
background-color: #333;
color: #f0f0f0;
}

.dost {
  margin-top: 20px;
  color: #333;
  text-decoration: underline;
  font-size: 16px;
  cursor: pointer;
  margin-left: -105px;
}

.dost:hover {
  color:#000;
}

.modal {
  display: none; /* по умолчанию скрыто */
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

/* Центрированное модальное окно */
.modal-content {
  position: relative; /* добавляем это */
  background-color: #fff;
  margin: 50px auto;
  padding: 20px 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 1000px;
  box-shadow: 0 0 20px rgba(0,0,0,0.2);
  box-sizing: border-box;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Кнопка закрытия */
.closee {
  float: right;
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  transition: color 0.2s ease;
  z-index: 1;
}

.closee:hover {
  color: #000;
}
/* ===== Стили фильтра ===== */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: flex-start;
}

.filters select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 16px;
}

/* ===== Галерея ===== */

#fabricGallery {
  display: flex;
  flex-direction: column;
  gap: 30px;
  box-sizing: border-box;
}

/* Название группы */
.material-title {
  font-size: 20px;
  font-weight: bold;
  color: #333;
  margin: 0 0 10px;
}

/* Ряд тканей в группе */
.fabric-group-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  width: 100%;
}

/* Один образец ткани */
.fabric-sample {
  flex: 1 1 calc(25% - 15px);
  max-width: calc(25% - 15px);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  text-align: center;
  padding: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: transform 0.3s ease, border 0.3s;
  cursor: pointer;
  box-sizing: border-box;
}

.fabric-sample:hover {
  transform: scale(1.02);
}

/* Изображение ткани */
.fabric-sample img {
  width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Подпись */
.fabric-sample p {
  margin-top: 8px;
  font-size: 14px;
  color: #333;
}

/* Выделение выбранного образца */
.fabric-sample.selected {
  border: 2px solid #007BFF;
  box-shadow: 0 0 10px rgba(0,123,255,0.3);
}


@media (max-width: 1167px) {
  body, html {
    padding: 0;
    margin: 0;
    font-size: 16px;
  }

  #wrapper {
    width: 100%;
    overflow-x: hidden;
  }

  #contact header span {
    font-size: 20px;
    padding: 10px;
    display: block;
  }

  nav #hidmenu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
  }

  #poisk {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  #numer, #icon {
    display: flex;
    justify-content: space-between;
  }

  .gallery {
    float: none;
    width: 100%;
    margin: 0 auto;
    padding: 0 10px;
  }

  .thumbnails {
    flex-wrap: wrap;
    gap: 5px;
  }

  .thumbnails img {
    width: 22%;
  }

  #name {
    float: none;
    margin: 20px 10px 0;
  }

  .size-options,
  .mechanism-options,
  .purchase-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .buy-installment-button {
    margin-left: 0;
  }

  .modal-content {
    width: 95%;
    padding: 15px;
  }

  #openModal {
    margin-left: 43%;
  }

  .filters {
    flex-direction: column;
  }

  .fabric-group-row {
    flex-direction: column;
  }

  .fabric-sample {
    max-width: 100%;
    flex: 1 1 100%;
  }

  .closee {
    right: 10px;
    top: 10px;
  }

  .dost {
    margin-left: 37%;
  }
}
