:root {
    --primary-color: #D32F2F;
    /* Deep Red */
    --primary-dark: #B71C1C;
    --secondary-color: #212121;
    /* Dark Charcoal */
    --text-color: #333333;
    --text-light: #757575;
    --background-light: #F5F5F5;
    --white: #FFFFFF;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: #f8f9fa;

    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo img {
    height: 50px;
    width: auto;
}

.nav a {
    text-decoration: none;
    color: var(--secondary-color);
    margin-left: 20px;
    font-weight: 500;
    transition: var(--transition);
}

.nav a:hover {
    color: var(--primary-color);
}

.cart-trigger {
    position: relative;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--primary-color);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    white-space: nowrap;
}

/* Hero */
.hero {
    position: relative;
    overflow: hidden;
    background-color: #2d1e1e;
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('hero_bg_final.jpg');
    background-size: cover;
    background-position: center;
    color: var(--white);
    text-align: center;
    padding: 100px 20px;
    margin-bottom: 40px;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(211, 47, 47, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(211, 47, 47, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 20%, rgba(139, 69, 19, 0.08) 0%, transparent 50%);
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Products */
.section-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2rem;
    color: var(--secondary-color);
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    background: #f0f0f0;
    border-radius: 20px;
    padding: 5px 15px;
    margin: 0 20px;
    flex-grow: 1;
    max-width: 400px;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    padding: 5px;
    flex-grow: 1;
    font-family: var(--font-main);
}

.search-bar button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
}

.search-bar button:hover {
    color: var(--primary-color);
}

/* Catalog Layout */
.catalog-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 30px;
    align-items: start;
}

.sidebar {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
}

.sidebar h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--secondary-color);
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.category-list {
    list-style: none;
}

.category-list li {
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    margin-bottom: 5px;
    color: var(--text-color);
}

.category-list li:hover {
    background-color: #f5f5f5;
    color: var(--primary-color);
}

.category-list li.active {
    background-color: var(--primary-color);
    color: var(--white);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Fixed 4 columns */
    gap: 20px;
    padding-bottom: 60px;
}

.product-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.product-image {
    height: 200px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.product-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: auto;
    margin-bottom: 15px;
}

.product-quantity-input {
    margin-bottom: 10px;
}

.product-quantity-input label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.product-quantity-input > div {
    display: flex;
    align-items: center;
    gap: 5px;
}

.product-qty-input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: var(--font-main);
    transition: var(--transition);
    box-sizing: border-box;
    text-align: center;
}

.product-qty-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.1);
}

.product-qty-unit {
    font-size: 0.85rem;
    color: #999;
    white-space: nowrap;
}

/* Cart Modal */
.cart-modal {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: var(--white);
    z-index: 1000;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.cart-modal.active {
    right: 0;
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-cart {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 15px;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.cart-item-price {
    color: var(--primary-color);
    font-weight: 600;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: var(--white);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    background: #f9f9f9;
}

.cart-total {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
}

.checkout-form {
    margin-bottom: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: none; /* Скрыта по умолчанию, показывается когда есть товары */
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: var(--transition);
    box-sizing: border-box; /* Важно для правильной ширины */
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.1);
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: #e74c3c;
}

/* Форма управляется через JS, не используем !important */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Footer */
.footer {
    background: var(--secondary-color);
    color: var(--white);
    padding: 40px 0;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    text-align: left;
}

.footer-section h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--white);
    font-weight: 600;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--white);
    text-decoration: underline;
}

.company-info {
    font-size: 0.9rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
}

.company-info p {
    margin-bottom: 5px;
}

/* Чекбоксы в форме */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.checkbox-label a {
    color: var(--primary-color);
    text-decoration: underline;
}

.checkbox-label a:hover {
    color: var(--primary-dark);
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-links {
        align-items: center;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .cart-modal {
        width: 100%;
        right: -100%;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 15px;
    }

    .search-bar {
        order: 3;
        width: 100%;
        margin: 0;
        max-width: none;
    }

    .catalog-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        margin-bottom: 20px;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}

/* Reviews Page Styles */
.reviews-section {
    padding: 40px 0;
    min-height: 60vh;
    background:
        radial-gradient(circle at 15% 20%, rgba(211, 47, 47, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 85% 10%, rgba(33, 33, 33, 0.06) 0%, transparent 45%),
        radial-gradient(circle at 60% 85%, rgba(211, 47, 47, 0.06) 0%, transparent 50%);
}

.section-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 40px;
    font-size: 1.1rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* About / Contacts sections (Index) */
.info-section {
    padding: 60px 0;
    background:
        radial-gradient(circle at 10% 15%, rgba(211, 47, 47, 0.06) 0%, transparent 45%),
        radial-gradient(circle at 90% 30%, rgba(33, 33, 33, 0.05) 0%, transparent 45%);
}

.info-section-alt {
    background:
        radial-gradient(circle at 15% 80%, rgba(211, 47, 47, 0.06) 0%, transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(33, 33, 33, 0.05) 0%, transparent 45%);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    align-items: start;
}

.info-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
}

.info-card h3 {
    margin: 0 0 12px 0;
    color: var(--secondary-color);
}

.info-card p {
    color: var(--text-color);
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.info-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text-color);
    line-height: 1.7;
}

.info-list li {
    margin: 8px 0;
}

.info-list a {
    color: var(--primary-color);
    text-decoration: none;
}

.info-list a:hover {
    text-decoration: underline;
}

.reviews-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    align-items: start;
}

.review-form-container {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 110px;
}

.review-form-container h2 {
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.review-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.review-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: var(--transition);
    box-sizing: border-box;
    resize: vertical;
    min-height: 180px;
    line-height: 1.55;
    background: #fbfbfb;
}

.review-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.1);
    background: #fff;
}

.rating-input {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.rating-input .fa-star {
    font-size: 1.5rem;
    color: #ddd;
    cursor: pointer;
    transition: var(--transition);
}

.rating-input .fa-star.fas {
    color: #ffc107;
}

.rating-input .fa-star:hover {
    color: #ffc107;
}

.form-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 6px;
    display: none;
}

.form-message.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4caf50;
}

.form-message.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

.reviews-list-container {
    max-width: 1000px;
    margin: 0 auto;
}

.reviews-list-container h2 {
    margin-bottom: 30px;
    color: var(--secondary-color);
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.review-card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.04);
}

.review-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.review-author {
    flex: 1;
}

.review-author strong {
    display: block;
    margin-bottom: 5px;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.review-date {
    color: var(--text-light);
    font-size: 0.9rem;
}

.review-rating-display {
    display: flex;
    gap: 3px;
}

.review-rating-display .fa-star {
    font-size: 1.1rem;
}

.review-rating-display .fa-star.fas {
    color: #ffc107;
}

.review-rating-display .fa-star.far {
    color: #ddd;
}

.review-text {
    color: var(--text-color);
    line-height: 1.6;
    white-space: pre-wrap;
}

.no-reviews {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.nav a.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Responsive for reviews */
@media (max-width: 768px) {
    .reviews-layout {
        grid-template-columns: 1fr;
    }

    .review-form-container {
        padding: 20px;
        position: static;
    }

    .review-header {
        flex-direction: column;
    }

    .review-rating-display {
        margin-top: 10px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}