/* Модальное окно: overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Модальное окно: контейнер */
.modal-window {
    background: var(--color-white);
    max-width: 900px;
    width: 90vw;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    position: relative;
}

/* Кнопка закрытия */
.modal-close {
    position: absolute;
    top: 10px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #333;
}

/* Контент модалки */
.modal-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    gap: 30px;
    border-bottom: 1px solid #ddd;
}

.modal-left {
    flex: 0 0 250px;
}

.modal-left img {
    max-width: 250px;
    border-radius: 20px;
    object-fit: contain;
}

.modal-right {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.modal-right h2 {
    margin: 0 0 15px 0;
    font-weight: 700;
    font-size: 28px;
}

/* Цена и количество */
.price-qty {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.price {
    font-size: 32px;
    font-weight: 500;
}

.quantity {
    display: flex;
    align-items: center;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

.qty-btn {
    border: none;
    background: #ddd;
    padding: 6px 12px;
    font-size: 20px;
    user-select: none;
    width: 34px;
    height: 51px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}

.qty-btn:hover {
    background: #ccc;
}

input[type="number"] {
    border: none;
    width: 50px;
    text-align: center;
    font-size: 16px;
    padding: 6px 0;
    background: #f0f0f0;
    -moz-appearance: textfield;
}

input::-webkit-inner-spin-button,
input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Кнопка добавить */
.add-btn {
    border-radius: 10px;
    width: 156px;
    height: 51px;
    background-color: var(--color-button-bg);
    color: var(--color-button-text);
    font-weight: 400;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.add-btn:hover {
    background-color: var(--color-button-hover);
}

/* Опции */
.options {
    border-top: 1px solid #d4d4d4;
    padding-top: 20px;
}

.options h4 {
    margin: 0 0 25px 0;
    font-weight: 400;
    font-size: 20px;
}

.options label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    margin-bottom: 8px;
    user-select: none;
}

/* Описание */
.modal-description {
    padding: 15px 30px 30px;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid #eee;
}

.modal-description::-webkit-scrollbar {
    width: 6px;
}

.modal-description::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-description::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.modal-description::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.modal-description p {
    margin: 8px 0;
}

/* Стили для форматированного текста из CKEditor */
.modal-description ul,
.modal-description ol {
    margin: 10px 0;
    padding-left: 20px;
}

.modal-description ul li,
.modal-description ol li {
    margin-bottom: 5px;
}

.modal-description strong,
.modal-description b {
    font-weight: 700;
}

.modal-description em,
.modal-description i {
    font-style: italic;
}

.modal-description a {
    color: var(--color-primary);
    text-decoration: underline;
}

.modal-description a:hover {
    text-decoration: none;
}

.modal-description h1,
.modal-description h2,
.modal-description h3,
.modal-description h4,
.modal-description h5,
.modal-description h6 {
    margin: 15px 0 10px;
    font-weight: 600;
}

.modal-description h1 {
    font-size: 22px;
}

.modal-description h2 {
    font-size: 20px;
}

.modal-description h3 {
    font-size: 18px;
}

.modal-description h4 {
    font-size: 16px;
}

.modal-description h5 {
    font-size: 14px;
}

.modal-description h6 {
    font-size: 14px;
}

/* Стили для таблиц в форматированном тексте */
.modal-description table {
    border-collapse: collapse;
    margin: 15px 0;
    width: 100%;
}

.modal-description table th,
.modal-description table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.modal-description table th {
    background-color: #f2f2f2;
    font-weight: 600;
}

.modal-description table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.modal-description table tr:hover {
    background-color: #f5f5f5;
}

@media (max-width: 600px) {
    /* Уменьшаем окно, даём ему скролл по высоте */
    .modal-window {
      width: 90vw;
      max-width: 90vw;
      max-height: 95vh;
      border-radius: 8px;
      overflow-y: auto;
    }
  
    /* Перекладываем контент в колонку */
    .modal-content {
      flex-direction: column;
      padding: 20px;
      gap: 20px;
    }
  
    /* Картинка растягивается по ширине, центрируется */
    .modal-left {
      flex: none;
      width: 100%;
      text-align: center;
    }
    .modal-left img {
      max-width: 80%;
      height: auto;
      margin: 0 auto;
    }
  
    /* Правая колонка тоже 100% */
    .modal-right {
      width: 100%;
    }
  
    /* Заголовок чуть меньше шрифт */
    .modal-right h2 {
      font-size: 24px;
      margin-bottom: 15px;
    }
  
    /* Цена и счётчик — тоже столбиком */
    .price-qty {
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 15px;
    }
  
    /* Счётчик убираем «в линию» */
    .quantity {
      margin-top: 0;
    }
  
    /* Кнопка добавления на всю ширину */
    .add-btn {
      width: 100%;
      padding: 12px;
      font-size: 16px;
      margin-top: 10px;
    }
  
    /* Блок опций — под кнопкой, тоже 100% */
    .options {
      padding-top: 15px;
    }
  
    /* Описание чуть уже, чтобы скролл не пересекал экран */
    .modal-description {
      padding: 15px;
      max-height: 200px;
    }
  }
  