/* Index Page Components - Part 2 */

/* Hero Features - Force 4th element to center */
.hero-features .feature:nth-child(4) {
    grid-column: 1 / -1 !important;
    justify-self: center !important;
    max-width: 300px !important;
    width: 300px !important;
}

/* На мобильных устройствах четвертый блок такой же как остальные */
@media (max-width: 640px) {
    .hero-features .feature:nth-child(4) {
        grid-column: unset !important;
        justify-self: unset !important;
        width: unset !important;
        max-width: unset !important;
        min-width: unset !important;
    }
    
    /* Максимальная специфичность для переопределения любых стилей */
    .hero-features .feature:nth-child(4)[style] {
        grid-column: unset !important;
        justify-self: unset !important;
        width: unset !important;
        max-width: unset !important;
        min-width: unset !important;
    }
    
    /* Еще более специфичное правило */
    div.hero-features div.feature:nth-child(4) {
        grid-column: unset !important;
        justify-self: unset !important;
        width: unset !important;
        max-width: unset !important;
        min-width: unset !important;
    }
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 32px;
    justify-content: center;
}

/* Ограничиваем максимальную ширину для одного товара */
.products-grid:has(.product-card:only-child) {
    grid-template-columns: minmax(350px, 400px);
    justify-content: center;
}

/* Ограничиваем максимальную ширину для двух товаров */
.products-grid:has(.product-card:nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(350px, 400px));
    justify-content: center;
}

/* Fallback для браузеров без поддержки :has() */
.products-grid.single-product {
    grid-template-columns: minmax(350px, 400px);
    justify-content: center;
}

.products-grid.two-products {
    grid-template-columns: repeat(2, minmax(350px, 400px));
    justify-content: center;
}

.product-card {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow-md);
    transition: all 0.4s ease;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.product-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(16, 185, 129, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(37, 99, 235, 0.2);
}

.product-card:hover::after {
    opacity: 1;
}

/* Product Image Styles */
.product-image {
    width: 100%;
    height: 320px;
    background: linear-gradient(135deg, var(--bg-light), #e5e7eb);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin-bottom: 20px;
    color: var(--text-light);
    position: relative;
    /* overflow: hidden; - убираем, чтобы бейджи выступали */
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

/* Product Badge inside Image */
.product-image .product-badge {
    position: absolute;
    top: -18px;
    right: 12px;
    background: var(--accent-color);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Product Brand inside Image */
.product-image .product-brand {
    position: absolute;
    top: -18px;
    left: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Badge Colors */
.product-image .product-badge.hit {
    background: #ef4444;
}

/* Hit Products - Force text colors */
.products-grid .product-specs .spec-label {
    color: #6b7280 !important;
}

.products-grid .product-specs .spec-value {
    color: #1f2937 !important;
}


.product-image .product-badge.econom {
    background: #f59e0b;
}

.product-image .product-badge.premium {
    background: #8b5cf6;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .product-image {
        height: 300px;
        font-size: 40px;
    }

    .product-image .product-badge {
        top: -15px;
        right: 8px;
        padding: 4px 8px;
        font-size: 10px;
    }

    .product-image .product-brand {
        top: -15px;
        left: 8px;
        padding: 4px 8px;
        font-size: 10px;
    }
}

.product-card > * {
    position: relative;
    z-index: 1;
}

.product-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    background: var(--accent-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-brand {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 20px;
}

.product-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-dark);
    line-height: 1.3;
}

.product-specs {
    list-style: none;
    margin-bottom: 24px;
}

.product-specs li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 15px;
}

.product-specs li:last-child {
    border-bottom: none;
}

.spec-label {
    color: var(--text-light);
    font-weight: 500;
}

.spec-value {
    font-weight: 700;
    color: var(--text-dark);
}

.product-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
}

.price-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--secondary-color);
}

.old-price {
    text-decoration: line-through;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
}

.discount {
    background: #dc2626;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    width: fit-content;
}

.buy-btn {
    background: var(--secondary-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.buy-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.buy-btn:hover::before {
    width: 300px;
    height: 300px;
}

.buy-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.buy-btn:active {
    transform: translateY(0);
}

.buy-btn span {
    position: relative;
    z-index: 1;
}

/* Brands Section */
.brands {
    background: var(--bg-light);
    padding: 80px 0;
}

.brands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.brand-card {
    background: var(--bg-white);
    padding: 32px 24px;
    border-radius: 16px;
    text-align: center;
    font-weight: 700;
    color: var(--text-dark);
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.brand-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.brands-note {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
}

/* Services Section */
.services {
    background: var(--bg-white);
    padding: 100px 0;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    margin-bottom: 48px;
}

.service-card {
    background: var(--bg-light);
    padding: 40px 32px;
    border-radius: 20px;
    text-align: center;
    transition: all 0.4s ease;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    background: var(--bg-white);
}

.service-icon {
    font-size: 48px;
    margin-bottom: 24px;
}

.service-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.service-description {
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.6;
}

.service-price {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--accent-color);
}

.service-price.free {
    color: var(--warning-color);
}

.service-price.paid {
    color: var(--accent-color);
}

.service-btn {
    background: #10b981 !important;
    color: white;
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s ease;
    width: 100%;
}

.service-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.service-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* About Section Styles */
.about {
    padding: 80px 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.about-grid {
    display: flex;
    flex-direction: column;
    gap: 50px;
    margin-top: 50px;
}

.about-text {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-dark);
}

.about-text p {
    margin-bottom: 20px;
}

.about-text p:last-child {
    margin-bottom: 0;
}

.about-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.feature-card {
    background: white;
    padding: 30px 25px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.feature-card p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0;
}

/* Responsive Design for About Section */
@media (max-width: 768px) {
    .about {
        padding: 60px 0;
    }
    
    .about-grid {
        gap: 40px;
        margin-top: 40px;
    }
    
    .about-features {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .feature-card {
        padding: 25px 20px;
    }
    
    .feature-icon {
        font-size: 40px;
        margin-bottom: 15px;
    }
    
    .feature-card h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .feature-card p {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .about {
        padding: 40px 0;
    }
    
    .about-grid {
        gap: 30px;
        margin-top: 30px;
    }
    
    .about-features {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .feature-card {
        padding: 20px 15px;
    }
    
    .feature-icon {
        font-size: 36px;
        margin-bottom: 12px;
    }
}
