/* Общие стили для страницы */
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
    color: #333;
}

/* Стили для хедера */
header {
    background-color: #fff;
    padding: 15px 30px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.top-right {
    position: fixed;
    top: 15px;
    right: 30px;
}

.top-right .icon-link {
    margin-left: 15px;
    color: #007BFF;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.top-right .icon-link:hover {
    color: #0056b3;
}

header h1 {
    margin: 0;
    text-align: center;
    font-size: 24px;
}

/* Основное содержимое */
main {
    flex: 1;
    padding: 30px;
    max-width: 1000px;
    width: 70%;
    margin: 40px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

/* Группы элементов формы */
.form-group {
    margin-bottom: 20px;
}

/* Блок ввода товара с кнопкой-иконкой */
.input-with-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.input-with-icon input[type="text"] {
    padding: 10px;
    width: 300px;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.input-with-icon input[type="text"]:focus {
    border-color: #007BFF;
    outline: none;
}

.input-with-icon button[type="submit"] {
    background-color: #007BFF;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.input-with-icon button[type="submit"]:hover:not([disabled]) {
    background-color: #0056b3;
    transform: scale(1.05);
}

.input-with-icon button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Стили для выбора шаблона */
.template-selection p {
    margin-bottom: 15px;
    font-size: 18px;
    text-align: center;
}

.template-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.template-card {
    width: 200px;
    height: 250px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
    background-color: #fafafa;
    padding: 10px;
    box-sizing: border-box;
}

.template-card.selected {
    border-color: #007BFF;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transform: scale(1.02);
}

.template-card:hover {
    transform: scale(1.02);
}

.template-card img {
    max-width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.template-card p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

/* Стили для спиннера */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007BFF;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ссылка для редактирования карточки */
.edit-link {
    display: inline-block;
    margin-top: 20px;
    font-size: 16px;
    color: #007BFF;
    text-decoration: none;
    transition: color 0.3s;
}

.edit-link:hover {
    color: #0056b3;
}

/* Адаптивный дизайн для шаблонов */
@media (max-width: 600px) {
    .template-previews {
        flex-direction: column;
        align-items: center;
    }
    header h1 {
        font-size: 20px;
    }
    .top-right {
        top: 10px;
        right: 15px;
    }
    .input-with-icon {
        flex-direction: column;
    }
    .input-with-icon input[type="text"] {
        width: 90%;
    }
}

/* Общие стили для контейнера результата */
.result-container {
    max-width: 90%;
    width: 90%;
    background: #fff;
    border-radius: 8px;
    padding: 30px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
    margin: auto;
}

.result-container h1 {
    font-size: 28px;
    margin-bottom: 20px;
}

.result-container .description-text {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin: 15px auto;
    max-width: 600px;
    font-size: 16px;
    line-height: 1.5;
}

/* Стили для кнопок внутри контейнера результата */
.result-container .copy-btn,
.result-container .download-btn {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.3s;
}

.result-container .copy-btn {
    background-color: #28a745;
    color: #fff;
}

.result-container .copy-btn:hover {
    background-color: #218838;
}

.result-container .download-btn {
    background-color: #000000;
    color: #fff;
}

.result-container .download-btn:hover {
    background-color: #7f7f7f;
}

.result-container .links-section a {
    display: inline-block;
    margin: 10px;
    color: #007BFF;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s;
}

.result-container .links-section a:hover {
    color: #0056b3;
}

/* Результат: стили для карточек с использованием CSS Grid (применяются только в контейнере результата) */
.result-container .cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 20px 0;
}

.result-container .card-item {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: center;
}

.result-container .card-preview {
    max-width: 100%;
    height: auto;
}

/* Мобильная версия: 1 карточка в ряду */
@media (max-width: 768px) {
    .result-container .cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Адаптивность для контейнера результата на маленьких экранах */
@media (max-width: 600px) {
    .result-container {
        padding: 20px 10px;
    }
    .result-container .description-text {
        max-width: 100%;
    }
}


/* Сброс стилей и базовая настройка */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Arial', sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

/* Верхняя навигация */
.top-nav {
  background-color: #007bff;
  padding: 10px 20px;
  text-align: right;
}

.top-nav .nav-link {
  color: #fff;
  text-decoration: none;
  margin-left: 15px;
  font-size: 14px;
}

/* Основной контейнер */
.container {
  max-width: 800px;
  margin: 30px auto;
  background-color: #fff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Заголовок */
h1 {
  text-align: center;
  font-size: 24px;
  margin-bottom: 20px;
}

/* Форма и группы полей */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-size: 14px;
  margin-bottom: 5px;
  color: #555;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Кнопка генерации */
#generateButton {
  width: 100%;
  background-color: #fc6902;
  border: none;
  color: #fff;
  padding: 10px;
  font-size: 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#generateButton:hover {
  background-color: #ffb200;
}

/* Превью шаблонов */
.template-previews {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.template-label {
  flex: 0 0 30%;
  background-color: #f0f0f0;
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.template-label:hover {
  background-color: #e0e0e0;
}

.template-label input {
  margin-bottom: 8px;
}

.template-label img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 8px;
}

.template-label span {
  display: block;
  font-size: 14px;
  color: #333;
}

/* Ссылка для редактирования карточки */
.edit-link-container {
  text-align: center;
  margin-top: 20px;
}

.edit-link {
  color: #007bff;
  text-decoration: none;
  font-size: 14px;
}

.edit-link:hover {
  text-decoration: underline;
}
