/* ============================================================
   ОБЩИЙ СТИЛЬ ДЛЯ САЙТА МЕЛАМ
   ============================================================ */

/* ----- Переменные ----- */
:root {
    --primary: #1A3A4A;
    --primary-light: #2C5A70;
    --accent: #E87A2D;
    --accent-hover: #D06A1E;
    --bg-light: #f8f9fa;
    --text-dark: #1e1e1e;
    --text-light: #ffffff;
    --gray: #6c757d;
    --border: #e9ecef;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 12px;
    --transition: 0.3s ease;
}

/* ----- Сброс и база ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Inter', sans-serif;
    background: #ffffff;
    color: var(--text-dark);
    line-height: 1.6;
}
a {
    text-decoration: none;
    color: inherit;
}
ul {
    list-style: none;
}
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ----- ШАПКА ----- */
.header {
    background: var(--primary);
    color: var(--text-light);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.logo {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.logo span {
    color: var(--accent);
}
.nav {
    display: flex;
    align-items: center;
    gap: 32px;
}
.nav a {
    font-weight: 500;
    font-size: 16px;
    transition: color var(--transition);
    position: relative;
}
.nav a:hover {
    color: var(--accent);
}
.nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width var(--transition);
}
.nav a:hover::after {
    width: 100%;
}
.nav a.active {
    color: var(--accent);
}
.nav a.active::after {
    width: 100%;
}
.header-contact {
    display: flex;
    align-items: center;
    gap: 16px;
    font-weight: 500;
}
.header-contact a {
    color: var(--text-light);
    transition: color var(--transition);
}
.header-contact a:hover {
    color: var(--accent);
}
.header-contact .separator {
    color: rgba(255,255,255,0.3);
}
.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
}
.burger span {
    display: block;
    width: 28px;
    height: 3px;
    background: var(--text-light);
    border-radius: 3px;
    transition: 0.3s ease;
}
.burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
}
.burger.active span:nth-child(2) {
    opacity: 0;
}
.burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}

/* ----- ФУТЕР ----- */
.footer {
    background: #0F2936;
    color: rgba(255,255,255,0.8);
    padding: 40px 0 20px;
    margin-top: 40px;
}
.footer .bottom {
    text-align: center;
    font-size: 14px;
    opacity: 0.7;
}

/* ----- КНОПКИ (общие) ----- */
.btn-primary {
    display: inline-block;
    padding: 14px 34px;
    background: var(--accent);
    color: #fff;
    border-radius: 40px;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    transition: background 0.3s, transform 0.2s;
    border: none;
    cursor: pointer;
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}
.btn-outline {
    display: inline-block;
    padding: 14px 34px;
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 40px;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    transition: background 0.3s;
}
.btn-outline:hover {
    background: rgba(255,255,255,0.1);
}
.btn-small {
    display: inline-block;
    padding: 8px 20px;
    background: var(--accent);
    color: #fff;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.3s;
    border: none;
    cursor: pointer;
}
.btn-small:hover {
    background: var(--accent-hover);
}

/* ============================================================
   КАРТОЧКИ ТОВАРОВ (единый стиль для главной и каталога)
   ============================================================ */
.products-grid-home {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.catalog-page .products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 600px;
    margin: 0 auto;
}

.product-card-home,
.catalog-page .product-card {
    display: block;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
.product-card-home:hover,
.catalog-page .product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}
.product-card-home .img-placeholder,
.catalog-page .product-card .img-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.product-card-home .img-placeholder img,
.catalog-page .product-card .img-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.product-card-home .img-placeholder .icon,
.catalog-page .product-card .img-placeholder .icon {
    font-size: 48px;
    color: #6c757d;
}
.product-card-home .info,
.catalog-page .product-card .info {
    padding: 16px 18px 20px;
    text-align: center;
}
.product-card-home .name,
.catalog-page .product-card .name {
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 4px;
}
.product-card-home .price,
.catalog-page .product-card .price {
    font-weight: 700;
    font-size: 20px;
    color: #1A3A4A;
    margin-bottom: 12px;
}
.product-card-home .btn-small,
.catalog-page .product-card .btn-small {
    display: inline-block;
    padding: 8px 20px;
    background: #E87A2D;
    color: #fff;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.3s;
    pointer-events: none;
}

/* ----- ГЛАВНАЯ (специфичные стили) ----- */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    padding: 80px 0 70px;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute;
    right: -10%;
    top: -30%;
    width: 500px;
    height: 500px;
    background: rgba(232, 122, 45, 0.12);
    border-radius: 50%;
    pointer-events: none;
}
.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    position: relative;
    z-index: 1;
}
.hero-text h1 {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
}
.hero-text h1 span {
    color: var(--accent);
}
.hero-text p {
    font-size: 18px;
    opacity: 0.9;
    max-width: 500px;
    margin-bottom: 32px;
}
.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.hero-image .slideshow-container {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 4/3;
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(255,255,255,0.05);
    border: 2px dashed rgba(255,255,255,0.2);
}
.hero-image .slideshow-container .slide-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}
.hero-image .slideshow-container .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease;
}
.hero-image .slideshow-container .slide.active {
    opacity: 1;
    z-index: 2;
}
.hero-image .slideshow-container .slide-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 20px;
}
.hero-image .slideshow-container .slide-placeholder.hidden {
    display: none;
}
.slideshow-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}
.slideshow-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: background 0.3s;
    border: none;
    padding: 0;
}
.slideshow-dots .dot.active {
    background: var(--accent);
}
.slideshow-dots .dot:hover {
    background: rgba(255,255,255,0.8);
}
.slideshow-arrows {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 10;
    pointer-events: none;
}
.slideshow-arrows .arrow {
    pointer-events: auto;
    background: rgba(0,0,0,0.3);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.slideshow-arrows .arrow:hover {
    background: rgba(0,0,0,0.6);
}

.benefits-centered {
    text-align: center;
}
.benefits-centered .benefits-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}
.benefits-centered .benefit-item {
    flex: 0 1 280px;
    background: #fff;
    padding: 28px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s;
}
.benefits-centered .benefit-item:hover {
    transform: translateY(-6px);
}
.benefits-centered .benefit-item .icon {
    font-size: 40px;
    margin-bottom: 12px;
}
.benefits-centered .benefit-item h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}
.benefits-centered .benefit-item p {
    font-size: 15px;
    color: var(--gray);
    line-height: 1.4;
}
.categories-centered {
    text-align: center;
}
.categories-centered .subtitle {
    color: var(--gray);
    margin-bottom: 20px;
}

/* ----- КАТАЛОГ (специфичные стили) ----- */
.catalog-page {
    padding: 40px 0;
}
.catalog-page h1 {
    font-size: 32px;
    margin-bottom: 30px;
    text-align: center;
}

/* ----- КАРТОЧКА ТОВАРА (product.php) ----- */
.product-detail {
    padding: 40px 0;
}
.product-detail h1 {
    font-size: 32px;
    margin-bottom: 10px;
}
.product-content {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-top: 20px;
}
.product-left {
    flex: 0 0 40%;
    max-width: 400px;
}
.product-left .photo {
    width: 100%;
    aspect-ratio: 1/1;
    background: #f8f9fa;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-left .photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}
.product-left .photo .placeholder {
    font-size: 60px;
    color: var(--gray);
}
.product-left .selected-info {
    margin-top: 20px;
    background: var(--bg-light);
    padding: 20px;
    border-radius: var(--radius);
    border-left: 4px solid var(--accent);
    display: none;
}
.product-left .selected-info.active {
    display: block;
}
.product-left .selected-info .price {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}
.product-left .selected-info .sku {
    color: var(--gray);
    margin: 5px 0 10px;
}
.product-left .selected-info .add-form {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}
.product-left .selected-info .add-form input[type="number"] {
    width: 80px;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 6px;
}
.product-left .selected-info .add-form .btn-primary {
    padding: 10px 30px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
}
.product-left .selected-info .add-form .btn-primary:hover {
    background: var(--accent-hover);
}
.product-right {
    flex: 1;
}
.param-group {
    margin-bottom: 20px;
}
.param-group label {
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}
.param-group .options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.param-group .options button {
    padding: 8px 18px;
    border: 2px solid #ddd;
    border-radius: 30px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.param-group .options button:hover:not(:disabled) {
    border-color: var(--accent);
    background: #fff;
}
.param-group .options button.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}
.param-group .options button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #e9ecef;
}
.status-message {
    margin: 15px 0;
    padding: 10px;
    border-radius: 8px;
    background: #fff3cd;
    color: #856404;
    display: none;
}
.status-message.show {
    display: block;
}
.cart-quantity {
    margin-top: 8px;
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
}
.order-info {
    margin-top: 6px;
    font-size: 14px;
    color: var(--gray);
}
.order-error {
    color: #dc3545;
    font-weight: 500;
}
.product-info-text {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: var(--radius);
    font-size: 16px;
    color: var(--primary);
    border-left: 3px solid var(--accent);
    display: none;
    font-weight: 600;
}
.add-form .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ----- КОРЗИНА (cart.php) ----- */
.cart-page {
    padding: 40px 0;
}
.cart-page h1 {
    font-size: 32px;
    margin-bottom: 24px;
}
.cart-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.cart-table th {
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
}
.cart-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.cart-table .item-image {
    width: 140px;
    text-align: center;
}
.cart-table .item-image img {
    max-width: 120px;
    max-height: 120px;
    border-radius: 4px;
}
.cart-table .qty-input {
    width: 70px;
    padding: 6px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    text-align: center;
}
.cart-total td {
    font-weight: 700;
    font-size: 18px;
    border-top: 2px solid var(--primary);
}
.btn-remove {
    color: #dc3545;
    font-weight: 500;
}
.btn-remove:hover {
    text-decoration: underline;
}
.cart-actions {
    margin-top: 20px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    text-align: center;
}
.btn-update {
    background: #6c757d;
    color: #fff;
}
.btn-update:hover {
    background: #5a6268;
}
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.order-form-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border);
}
.order-form-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--primary);
}
.order-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.order-form-grid .form-group-full {
    grid-column: 1 / -1;
}
.order-form-grid .form-group {
    margin-bottom: 16px;
}
.order-form-grid label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
}
.order-form-grid label .required {
    color: #dc3545;
}
.order-form-grid input,
.order-form-grid textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}
.order-form-grid textarea {
    min-height: 80px;
    resize: vertical;
}
.order-form-grid .btn-submit {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 14px 40px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 40px;
    font-weight: 600;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s;
}
.order-form-grid .btn-submit:hover {
    background: var(--accent-hover);
}

/* ----- КОНТАКТЫ (contacts.php) ----- */
.contacts-page {
    padding: 60px 0;
}
.contacts-page h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
}
.contacts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}
.contacts-info {
    background: var(--bg-light);
    padding: 30px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.contacts-info .contact-item {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}
.contacts-info .contact-item .icon {
    font-size: 24px;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}
.contacts-info .contact-item .text {
    font-size: 16px;
}
.contacts-info .contact-item .text strong {
    display: block;
    font-weight: 600;
    color: var(--primary);
}
.contacts-info .contact-item .text a {
    color: var(--accent);
}
.contacts-info .contact-item .text a:hover {
    text-decoration: underline;
}
.map-container {
    background: var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    color: var(--gray);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 2px dashed #ced4da;
}

/* ----- АДАПТИВНОСТЬ (общая) ----- */
@media (max-width: 1024px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .hero-text p {
        margin-left: auto;
        margin-right: auto;
    }
    .hero-buttons {
        justify-content: center;
    }
}
@media (max-width: 768px) {
    .nav {
        display: none;
        flex-direction: column;
        width: 100%;
        background: var(--primary);
        padding: 20px 0;
        gap: 16px;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: 16px;
    }
    .nav.open {
        display: flex;
    }
    .burger {
        display: flex;
    }
    .hero {
        padding: 50px 0 40px;
    }
    .hero-text h1 {
        font-size: 32px;
    }
    .hero-text p {
        font-size: 16px;
    }
    .hero-image .slideshow-container {
        max-width: 100%;
    }
    .slideshow-arrows .arrow {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    .benefits-centered .benefits-grid {
        flex-direction: column;
        align-items: center;
    }
    .benefits-centered .benefit-item {
        flex: 0 1 100%;
        max-width: 400px;
    }
    .header-contact {
        font-size: 14px;
        gap: 10px;
    }
    .product-content {
        flex-direction: column;
        align-items: stretch;
    }
    .product-left {
        flex: 1;
        max-width: 100%;
    }
    .product-left .photo {
        aspect-ratio: 4/3;
    }
    .contacts-grid {
        grid-template-columns: 1fr;
    }
    .order-form-grid {
        grid-template-columns: 1fr;
    }
    .order-form-grid .btn-submit {
        justify-self: stretch;
    }
    .cart-table .item-image {
        width: 80px;
    }
    .cart-table .item-image img {
        max-width: 60px;
        max-height: 60px;
    }
    .cart-table .qty-input {
        width: 60px;
    }
    
    /* Адаптив для карточек товаров */
    .products-grid-home {
        grid-template-columns: 1fr 1fr;
        max-width: 600px;
    }
    .catalog-page .products-grid {
        grid-template-columns: 1fr 1fr;
        max-width: 400px;
    }
}
@media (max-width: 480px) {
    .hero-text h1 {
        font-size: 26px;
    }
    .header-contact {
        flex-wrap: wrap;
        justify-content: center;
    }
    .cart-table {
        font-size: 14px;
    }
    .cart-table th,
    .cart-table td {
        padding: 8px 10px;
    }
    .contacts-page h1 {
        font-size: 28px;
    }
    
    /* Адаптив для карточек товаров (телефоны) */
    .products-grid-home {
        grid-template-columns: 1fr;
        max-width: 300px;
    }
    .catalog-page .products-grid {
        grid-template-columns: 1fr;
        max-width: 300px;
    }
}