/* ============================================
   ROAST & CO — ОСНОВНЫЕ СТИЛИ
   ============================================ */

:root {
    --color-bg: #fdfaf6;
    --color-text: #2b2118;
    --color-primary: #6f4e37;
    --color-primary-dark: #4a3428;
    --color-accent: #c8a27a;
    --color-muted: #8a7a6b;
    --color-white: #ffffff;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(43, 33, 24, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh; /* Фикс мобильного Safari */
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   ШАПКА (HEADER)
   ============================================ */
.site-header {
    background: var(--color-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-primary-dark);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav {
    display: flex;
    gap: 24px;
}

.nav a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--color-primary);
}

/* Корзина в шапке */
.cart-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--color-primary);
    color: var(--color-white);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s;
}

.cart-link:hover {
    background: var(--color-primary-dark);
}

.cart-count {
    background: var(--color-white);
    color: var(--color-primary-dark);
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    padding: 0 6px;
}

/* ============================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================ */
main {
    flex: 1;
    padding-top: 40px !important;
    padding-bottom: 80px !important; /* Отступ снизу */
}

/* Если main имеет класс .container, сбрасываем боковые padding, чтобы не дублировались */
main.container {
    padding-left: 20px !important;
    padding-right: 20px !important;
}
/* ============================================
   ПОДВАЛ (FOOTER)
   ============================================ */
.site-footer {
    background: var(--color-primary-dark);
    color: var(--color-accent);
    padding: 24px 0;
    text-align: center;
    font-size: 14px;
    margin-top: auto; /* прижимает к низу при короткой странице */
}

/* ============================================
   ГЛАВНАЯ (HERO + POPULAR)
   ============================================ */
.hero {
    text-align: center;
    padding: 60px 20px;
}

.hero h1 {
    font-size: 42px;
    color: var(--color-primary-dark);
    margin-bottom: 16px;
}

.hero p {
    font-size: 18px;
    color: var(--color-muted);
    max-width: 600px;
    margin: 0 auto;
}

.btn-primary {
    display: inline-block;
    margin-top: 24px;
    padding: 12px 28px;
    background: var(--color-primary);
    color: var(--color-white);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    margin-bottom: 12px;
}

/* ============================================
   КАТАЛОГ
   ============================================ */
.catalog-header {
    margin-bottom: 32px;
}

.catalog-header h1 {
    font-size: 32px;
    color: var(--color-primary-dark);
}

.catalog-desc {
    color: var(--color-muted);
    margin-top: 8px;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 32px;
}

.catalog-sidebar h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-muted);
    margin-bottom: 12px;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 4px;
}

.category-list a {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.2s;
}

.category-list a:hover {
    background: rgba(111, 78, 55, 0.08);
}

.category-list a.active {
    background: var(--color-primary);
    color: var(--color-white);
}

/* Сетка товаров */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--color-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(43, 33, 24, 0.12);
}

.product-image {
    position: relative;
    aspect-ratio: 1;
    background: #f0e6dc;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    opacity: 0.5;
}

.product-placeholder.large {
    font-size: 120px;
    background: #f0e6dc;
    border-radius: var(--radius);
    aspect-ratio: 1;
}

.product-info {
    padding: 14px 16px 18px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.product-meta {
    font-size: 13px;
    color: var(--color-muted);
    margin-bottom: 8px;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary-dark);
}

.empty {
    color: var(--color-muted);
    padding: 40px 0;
}

.featured {
    margin-top: 60px;
}

.featured h2 {
    font-size: 26px;
    margin-bottom: 20px;
    color: var(--color-primary-dark);
}

/* ============================================
   КАРТОЧКА ТОВАРА (DETAIL)
   ============================================ */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

.product-detail-image img {
    width: 100%;
    border-radius: var(--radius);
    display: block;
}

.product-detail-info h1 {
    font-size: 30px;
    margin: 8px 0 12px;
    color: var(--color-primary-dark);
}

.breadcrumb {
    font-size: 13px;
    color: var(--color-muted);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.breadcrumb:hover {
    color: var(--color-primary);
}

.product-detail-meta {
    color: var(--color-muted);
    margin-bottom: 16px;
}

.product-detail-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: 16px;
}

.product-detail-desc {
    margin-bottom: 24px;
    line-height: 1.7;
}

.btn-buy {
    padding: 14px 32px;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-buy:hover {
    background: var(--color-primary-dark);
}

.back-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--color-muted);
    text-decoration: none;
    font-size: 14px;
}

.back-link:hover {
    color: var(--color-primary);
}

/* ============================================
   КОРЗИНА
   ============================================ */
.page-title {
    font-size: 32px;
    color: var(--color-primary-dark);
    margin-bottom: 32px;
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr 80px 120px 40px;
    gap: 16px;
    align-items: center;
    padding: 16px;
    background: var(--color-white);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0e6dc;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-image .product-placeholder {
    font-size: 32px;
}

.cart-item-name {
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.cart-item-name:hover {
    color: var(--color-primary);
}

.cart-item-meta {
    font-size: 13px;
    color: var(--color-muted);
    margin-top: 4px;
}

.cart-item-qty {
    font-size: 14px;
    color: var(--color-muted);
}

.cart-item-price {
    font-weight: 700;
    color: var(--color-primary-dark);
    text-align: right;
}

.cart-item-remove-form {
    display: contents;
}

.cart-item-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f5f0eb;
    color: var(--color-muted);
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    font-family: inherit;
}

.cart-item-remove:hover {
    background: #e53935;
    color: white;
}

.cart-summary,
.order-summary {
    background: var(--color-white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
}

.cart-summary h2,
.order-summary h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--color-primary-dark);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0e6dc;
}

.summary-total {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary-dark);
    border-bottom: none;
    margin: 12px 0 20px;
}

.empty-cart {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart p {
    font-size: 20px;
    color: var(--color-muted);
    margin-bottom: 24px;
}

/* ============================================
   ОФОРМЛЕНИЕ ЗАКАЗА
   ============================================ */
.order-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}

.order-form {
    background: var(--color-white);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0d6cc;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--color-bg);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #f0e6dc;
}

/* ============================================
   УСПЕШНЫЙ ЗАКАЗ
   ============================================ */
.success-block {
    text-align: center;
    padding: 60px 20px;
    max-width: 500px;
    margin: 0 auto;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: #43a047;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
}

.success-block h1 {
    font-size: 32px;
    color: var(--color-primary-dark);
    margin-bottom: 16px;
}

.success-block p {
    color: var(--color-muted);
    margin-bottom: 12px;
    font-size: 16px;
}

.success-block .btn-primary {
    margin-top: 24px;
}

/* ============================================
   СООБЩЕНИЯ (MESSAGES)
   ============================================ */
.messages {
    margin-bottom: 24px;
}

.message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(43, 33, 24, 0.06);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.message-icon {
    font-size: 20px;
    line-height: 1;
}

.message-text {
    flex: 1;
}

.message-action {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.message-action:hover {
    opacity: 1;
    text-decoration: underline;
}

.message-cart-added {
    background: linear-gradient(135deg, #f3e9dc, #e8d9c5);
    color: var(--color-primary-dark);
    border-left: 4px solid var(--color-primary);
}

.message-cart-removed {
    background: #f5f0eb;
    color: var(--color-muted);
    border-left: 4px solid var(--color-muted);
}

.message-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #43a047;
}

.message-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #e53935;
}

.message-warning {
    background: #fff8e1;
    color: #f57c00;
    border-left: 4px solid #fb8c00;
}

.message-info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #1976d2;
}

/* Ошибки форм */
.field-error {
    color: #c62828;
    font-size: 13px;
    margin-top: 6px;
}

.form-errors {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* ============================================
   СТРАНИЦА "О НАС"
   ============================================ */
.about-header {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(to bottom, #fdfaf6, #f3e9dc);
    border-radius: var(--radius);
    margin-bottom: 40px;
}

.about-header h1 {
    font-size: 42px;
    color: var(--color-primary-dark);
    margin-bottom: 16px;
}

.about-subtitle {
    font-size: 18px;
    color: var(--color-muted);
    max-width: 600px;
    margin: 0 auto;
}

.about-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 48px;
    align-items: start;
}

.about-text h2,
.about-contact h2 {
    font-size: 24px;
    color: var(--color-primary-dark);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0e6dc;
}

.about-text p {
    margin-bottom: 16px;
    line-height: 1.8;
    color: var(--color-text);
}

.about-features {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.feature-icon {
    font-size: 28px;
    background: #f3e9dc;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature h3 {
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--color-primary-dark);
}

.feature p {
    font-size: 14px;
    color: var(--color-muted);
    margin: 0;
    line-height: 1.5;
}

.about-contact {
    background: var(--color-white);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.contact-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
}

.contact-list li {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact-list a {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
}

.contact-list a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.map-container {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: 300px;
}

.map-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ============================================
   АДАПТИВ (МОБИЛЬНЫЕ)
   ============================================ */
@media (max-width: 768px) {
    /* Шапка */
    .header-inner {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 12px;
    }

    .cart-link {
        margin-left: auto;
        order: 2;
    }

    .nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 4px;
        gap: 16px;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .nav a {
        white-space: nowrap;
        font-size: 14px;
    }

    /* Каталог */
    .catalog-layout {
        grid-template-columns: 1fr;
    }

    .product-detail {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .hero h1 {
        font-size: 28px;
    }

    /* Корзина и заказ */
    .cart-layout,
    .order-layout {
        grid-template-columns: 1fr;
    }

    .cart-item {
        grid-template-columns: 60px 1fr 40px;
        grid-template-areas:
            "img info remove"
            "img qty price";
    }

    .cart-item-image { grid-area: img; width: 60px; height: 60px; }
    .cart-item-info { grid-area: info; }
    .cart-item-qty { grid-area: qty; }
    .cart-item-price { grid-area: price; text-align: left; }
    .cart-item-remove { grid-area: remove; }

    .cart-summary,
    .order-summary {
        position: static;
    }

    /* О нас */
    .about-layout {
        grid-template-columns: 1fr;
    }

    .about-header {
        padding: 40px 16px;
    }
}