/* ===== Базовые стили ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Tahoma, Arial, sans-serif;
    background: #f5f7fa;
    color: #1e2a3a;
    line-height: 1.5;
    font-size: 16px;
}

a {
    text-decoration: none;
    color: #2c6e9e;
    transition: color 0.2s;
}
a:hover {
    color: #e67e22;
    text-decoration: underline;
}

/* ===== Шапка ===== */
header {
    background: #1e2a3a;
    color: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.logo a {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
}
.logo a:hover {
    color: #e67e22;
    text-decoration: none;
}
.top-nav {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.top-nav a {
    color: #ddd;
    font-size: 0.9rem;
}
.top-nav a:hover {
    color: #e67e22;
}
.search form {
    display: flex;
    gap: 5px;
}
.search input {
    padding: 8px 12px;
    border: none;
    border-radius: 30px;
    width: 220px;
    font-size: 0.9rem;
}
.search button {
    padding: 8px 16px;
    background: #e67e22;
    border: none;
    border-radius: 30px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}
.search button:hover {
    background: #cf711f;
}
.user-links {
    display: flex;
    gap: 20px;
}
.user-links a {
    color: #fff;
    font-size: 0.9rem;
}

/* ===== Основное содержимое ===== */
main {
    min-height: 70vh;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== Сетка товаров ===== */
.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

/* ===== Карточка товара ===== */
.product-card {
    background: #fff;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}
.product-card img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    margin-bottom: 12px;
    background: #f8f8f8;
    border-radius: 8px;
}
.product-card h3 {
    font-size: 1.1rem;
    margin: 10px 0 8px;
    line-height: 1.3;
}
.product-card h3 a {
    color: #1e2a3a;
}
.product-card .info-line {
    font-size: 0.85rem;
    color: #4a627a;
    margin: 4px 0;
}
.product-card .info-line strong {
	font-weight:normal;
}
.product-card .price {
    font-size: 1.3rem;
    color: #e67e22;
}
.product-card .old-price {
    font-size: 0.9rem;
    color: #8e9eae;
    text-decoration: line-through;
    margin-left: 8px;
}
.product-card .info-line:last-of-type {
    margin-top: 8px;
    color: #2c6e9e;
}

/* ===== Кнопка "Загрузить ещё" ===== */
.load-more {
    display: block;
    width: 240px;
    margin: 20px auto;
    padding: 12px 20px;
    background: #1e2a3a;
    color: #fff;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    transition: background 0.2s;
}
.load-more:hover {
    background: #e67e22;
}
.loader {
    text-align: center;
    margin: 20px;
    display: none;
    font-size: 1rem;
    color: #e67e22;
}

/* ===== Подвал ===== */
footer {
    background: #1e2a3a;
    color: #ddd;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}
footer a {
    color: #e67e22;
}

/* ===== Страница товара (детальная) ===== */
.product-detail {
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}
.product-detail img {
    max-width: 100%;
    border-radius: 16px;
    margin-bottom: 20px;
}
.product-detail h1 {
    font-size: 1.8rem;
    margin: 0 0 15px;
}
.detail-row {
    margin: 12px 0;
}
.detail-row strong {
    color: #1e2a3a;
    min-width: 140px;
    display: inline-block;
}
.detail-row ul {
    list-style-position: inside;
	padding-left: 20px;
}
.detail-row ul li::marker {
    margin-right:10px;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
th, td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}
th {
    background: #f0f2f5;
}

/* ===== Страницы списков (категории, бренды и т.д.) ===== */
.list-page {
    max-width: 800px;
    margin: 40px auto;
    background: #fff;
    border-radius: 24px;
    padding: 30px;
}
.list-page h1 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}
.list-page input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 10px;
    margin-bottom: 25px;
}
.list-page ul {
    list-style: none;
}
.list-page li {
    margin: 12px 0;
}
.list-page li a {
    font-size: 1.1rem;
    display: block;
    padding: 6px 0;
}
.back-btn {
    display: inline-block;
    margin-bottom: 20px;
    background: #e0e4e8;
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    color: #1e2a3a;
}
.back-btn:hover {
    background: #cbd2d9;
    text-decoration: none;
}

/* ===== Адаптивность для планшетов (ширина ≤ 900px) ===== */
@media (max-width: 900px) {
    main {
        padding: 20px;
    }
    .products {
        gap: 20px;
    }
    .product-card {
        padding: 14px;
    }
    .product-card img {
        height: 160px;
    }
    .product-detail {
        padding: 20px;
    }
}

/* ===== Адаптивность для телефонов (ширина ≤ 640px) ===== */
@media (max-width: 640px) {
    header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 12px;
        padding: 15px;
    }
    .logo a {
        font-size: 1.5rem;
    }
    .top-nav {
        justify-content: center;
        gap: 15px;
    }
    .search form {
        justify-content: center;
    }
    .search input {
        width: 180px;
    }
    .user-links {
        justify-content: center;
        gap: 15px;
    }
    main {
        padding: 15px;
    }
    .products {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 15px;
    }
    .product-card {
        padding: 12px;
    }
    .product-card img {
        height: 140px;
    }
    .product-card h3 {
        font-size: 1rem;
    }
    .price {
        font-size: 1.1rem;
    }
    .list-page {
        margin: 20px;
        padding: 20px;
    }
    .detail-row strong {
        display: block;
        margin-bottom: 4px;
    }
    th, td {
        padding: 6px 8px;
        font-size: 0.85rem;
    }
    .load-more {
        width: 90%;
        max-width: 280px;
    }
}

/* ===== Адаптивность для очень маленьких экранов (≤ 480px) ===== */
@media (max-width: 480px) {
    .products {
        grid-template-columns: 1fr;
    }
    .product-card img {
        height: auto;
        max-height: 200px;
    }
    .search input {
        width: 140px;
    }
}

/* Добавим стили для форм, таблиц, блоков */
.account-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
.account-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}
.account-nav a {
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 30px;
    background: #f0f0f0;
    color: #333;
}
.account-nav a:hover {
    background: #e67e22;
    color: #fff;
}
.card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}
.stat-block {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    flex: 1;
    min-width: 200px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #eee;
}
.stat-block svg {
    width: 32px;
    height: 32px;
    margin-bottom: 10px;
    stroke: #e67e22;
    fill: none;
}
.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #1e2a3a;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
input, select, textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    font-family: Tahoma, sans-serif;
}
button, .button {
    background: #e67e22;
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
}
button:hover, .button:hover {
    background: #cf711f;
}
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
th {
    background: #f8f8f8;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
    text-decoration: none;
    color: #e67e22;
}
.back-link svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
}
.error-message {
    color: #d32f2f;
    margin-top: 10px;
}
.success-message {
    color: #2e7d32;
    margin-top: 10px;
}

/* Переписка – стиль мессенджера */
.messages-container {
    margin: 25px 0;
}
.message-thread {
    margin-bottom: 16px;
}
.message-bubble {
    display: flex;
    margin-bottom: 12px;
    align-items: flex-start;
}
.message-bubble.admin {
    justify-content: flex-start;
}
.message-bubble.user {
    justify-content: flex-end;
}
.message-avatar {
    width: 36px;
    height: 36px;
    background: #e67e22;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    margin-right: 12px;
    flex-shrink: 0;
}
.message-bubble.user .message-avatar {
    order: 2;
    margin-right: 0;
    margin-left: 12px;
    background: #2c3e2f;
}
.message-content {
    max-width: 70%;
    background: #fff;
    border-radius: 20px;
    padding: 10px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    position: relative;
}
.message-bubble.admin .message-content {
    background: #f1f0f0;
}
.message-bubble.user .message-content {
    background: #e67e22;
    color: #fff;
}
.message-author {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}
.message-bubble.user .message-author {
    color: #fff;
}
.message-text {
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
}
.message-time {
    font-size: 0.7rem;
    color: #999;
    margin-top: 5px;
    text-align: right;
}
.message-bubble.user .message-time {
    color: #ffefd6;
}
.message-reply-link {
    font-size: 0.75rem;
    margin-top: 6px;
    display: inline-block;
    color: #e67e22;
    text-decoration: none;
}
.message-bubble.user .message-reply-link {
    color: #fff;
}
.child-messages {}
/* Для совсем маленьких экранов */
@media (max-width: 640px) {
    .child-messages {}
    .message-content {
        max-width: 85%;
    }
    .message-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}

/* ===== Отзывы и вопросы на странице товара ===== */
.reviews-section,
.questions-section {
    margin-top: 40px;
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1e2a3a;
}

.write-btn {
    background: #e67e22;
    color: #fff;
    padding: 8px 20px;
    border-radius: 30px;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    display: inline-block;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
}

.write-btn:hover {
    background: #cf711f;
    text-decoration: none;
    transform: translateY(-1px);
}

.no-data {
    color: #888;
    font-style: italic;
    padding: 15px 0;
    margin: 0;
}

.reviews-list,
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.review-item,
.question-item {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.review-item:hover,
.question-item:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.review-header,
.question-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.review-author,
.question-author {
    font-weight: bold;
    color: #2c3e2f;
}

.review-rating {
    color: #f5b042;
    letter-spacing: 2px;
    font-size: 0.9rem;
}

.review-date,
.question-date {
    color: #888;
    font-size: 0.75rem;
}

.review-title {
    font-weight: bold;
    margin: 8px 0 5px;
    font-size: 1rem;
    color: #1e2a3a;
}

.review-comment,
.question-text {
    margin: 8px 0;
    line-height: 1.45;
    color: #333;
}

.review-reply,
.question-answer {
    background: #eef2f5;
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.85rem;
    border-left: 3px solid #e67e22;
}

.review-reply strong,
.question-answer strong {
    color: #1e2a3a;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 640px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .review-header,
    .question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .review-item,
    .question-item {
        padding: 12px 15px;
    }
}

/* Корзина */
.cart-table {
    width: 100%;
    border-collapse: collapse;
}
.cart-table th, .cart-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}
.cart-table tfoot td {
    border-top: 2px solid #ddd;
    font-weight: bold;
}
.cart-table input[type="number"] {
    width: 70px;
    padding: 5px;
}
.remove-item {
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
}
.add-to-cart-btn {
    background: #e67e22;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    margin-top: 10px;
    cursor: pointer;
    font-size: 0.85rem;
}