/* ============================================================
   Стили публичной части — тёмная тема с кофейными акцентами
   ============================================================ */

:root {
    --bg:          #171210;   /* основной фон */
    --bg-alt:      #1f1814;   /* фон чередующихся секций */
    --card:        #251d17;   /* фон карточек */
    --border:      #3a2e24;   /* границы */
    --text:        #ece3d9;   /* основной текст */
    --muted:       #b3a494;   /* приглушённый текст */
    --accent:      #c98d5f;   /* кофейно-карамельный акцент */
    --accent-dark: #8c5a3a;   /* тёмный кофейный */
    --radius:      14px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Шапка ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(23, 18, 16, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 68px;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo__img {
    max-height: 46px;
    width: auto;
}

.logo__text {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.5px;
}

.logo__text em {
    font-style: normal;
    color: var(--accent);
}

.site-nav {
    display: flex;
    gap: 24px;
    margin-left: auto;
}

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

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

.header-phone {
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}

/* ---------- Поиск в шапке ---------- */

.search-form {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 340px;
    min-width: 150px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.search-form:focus-within {
    border-color: var(--accent);
}

.search-form__input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    padding: 9px 4px 9px 14px;
}

.search-form__input::placeholder {
    color: var(--muted);
}

.search-form__btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.search-form__btn:hover {
    color: var(--accent);
}

.search-form__btn svg {
    width: 18px;
    height: 18px;
}

/* Панель результатов поиска */
.search-result-bar {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
    color: var(--muted);
}

.search-result-bar strong {
    color: var(--accent);
}

.search-reset {
    margin-left: 10px;
    text-decoration: underline;
}

/* Бургер (виден только на мобильных) */
.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
}

.burger span {
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

.burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Первый экран ---------- */

.hero {
    padding: 90px 0 70px;
    background:
        radial-gradient(ellipse at 80% 10%, rgba(201, 141, 95, 0.14), transparent 55%),
        radial-gradient(ellipse at 10% 90%, rgba(140, 90, 58, 0.12), transparent 50%),
        var(--bg);
    text-align: center;
}

.hero h1 {
    font-size: clamp(30px, 5vw, 48px);
    line-height: 1.2;
    margin-bottom: 18px;
}

.hero h1 span {
    color: var(--accent);
}

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

.hero__actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 13px 28px;
    border-radius: 10px;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn--accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 6px 20px rgba(201, 141, 95, 0.25);
}

.btn--accent:hover {
    transform: translateY(-2px);
}

.btn--ghost {
    border: 1px solid var(--accent);
    color: var(--accent);
}

.btn--ghost:hover {
    background: rgba(201, 141, 95, 0.12);
}

/* ---------- Секции ---------- */

.section {
    padding: 70px 0;
}

.section--alt {
    background: var(--bg-alt);
}

.section__title {
    font-size: clamp(24px, 3.5vw, 34px);
    margin-bottom: 36px;
    position: relative;
    padding-bottom: 14px;
}

.section__title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 64px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.empty-note {
    color: var(--muted);
}

/* ---------- Вкладки групп в каталогах ---------- */

.tabs__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 26px;
}

.tab-btn {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--muted);
    font: inherit;
    font-size: 14.5px;
    font-weight: 600;
    padding: 9px 20px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.tab-btn:hover {
    color: var(--text);
    border-color: var(--accent-dark);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-color: transparent;
    color: #fff;
}

/* Карточка, скрытая невыбранной вкладкой или живым поиском.
   !important обязателен: ниже по файлу .card задаёт display:flex,
   который при равной специфичности перебил бы это правило. */
.card.card--hidden,
.card.card--search-hidden {
    display: none !important;
}

/* ---------- Карточки ---------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-dark);
}

.card--soldout {
    opacity: 0.6;
}

.card__img {
    height: 190px;
    background: #14100d;
}

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

.card__img--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    color: var(--accent-dark);
}

.card__body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.badge {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.badge--condition {
    background: rgba(201, 141, 95, 0.15);
    color: var(--accent);
    border: 1px solid rgba(201, 141, 95, 0.35);
}

.badge--stock {
    background: rgba(94, 176, 106, 0.15);
    color: #7fca8a;
    border: 1px solid rgba(94, 176, 106, 0.35);
}

.badge--out {
    background: rgba(200, 90, 90, 0.15);
    color: #d98a8a;
    border: 1px solid rgba(200, 90, 90, 0.35);
}

.card__title {
    font-size: 19px;
    margin-bottom: 10px;
}

/* Краткое описание: не более 4 строк, остальное — в модальном окне */
.card__desc {
    color: var(--muted);
    font-size: 14.5px;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card__footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.card__price {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.card--clickable {
    cursor: pointer;
}

.card__more {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    transition: color 0.15s;
}

.card--clickable:hover .card__more {
    color: var(--accent);
}

/* ---------- Контакты ---------- */

.contacts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
}

.contacts__item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.contacts__item--wide {
    grid-column: 1 / -1;
}

.contacts__label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.contacts__value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.contacts__text {
    color: var(--text);
}

/* ---------- Подвал ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 26px 0;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

/* ---------- Плавающие кнопки чатов ---------- */

.chat-buttons {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.chat-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

/* Кнопка MAX — буква «M», синий градиент */
.chat-btn--max {
    background: linear-gradient(135deg, #2D8CFF, #1a5fd0);
    font-size: 26px;
    font-weight: 800;
    font-family: Arial, sans-serif;
}

/* Кнопка Telegram — самолётик, голубая */
.chat-btn--telegram {
    background: #29B6F6;
}

.chat-btn--telegram svg {
    width: 28px;
    height: 28px;
    margin: 2px 3px 0 0;
}

/* ---------- Модальное окно карточки ---------- */

body.no-scroll {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal[hidden] {
    display: none;
}

.modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 7, 5, 0.75);
    backdrop-filter: blur(3px);
}

.modal__dialog {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(23, 18, 16, 0.8);
    color: var(--text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.modal__close:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.modal__img {
    max-height: 280px;
    overflow: hidden;
    background: #14100d;
}

.modal__img img {
    width: 100%;
    height: 280px;
    object-fit: cover;
}

.modal__body {
    padding: 24px;
}

.modal__badges {
    margin-bottom: 12px;
}

.modal__title {
    font-size: 23px;
    margin-bottom: 12px;
}

.modal__desc {
    color: var(--muted);
    font-size: 15px;
    margin-bottom: 16px;
}

.modal__price {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    padding-bottom: 18px;
    border-bottom: 1px dashed var(--border);
}

/* ---------- Форма заявки в модальном окне ---------- */

.request-form {
    margin-top: 18px;
}

.request-form__title {
    font-size: 17px;
    margin-bottom: 14px;
}

.request-form input[type="text"],
.request-form input[type="tel"],
.request-form input[type="email"],
.request-form textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 14.5px;
    padding: 11px 14px;
    margin-bottom: 12px;
}

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

.request-form textarea {
    resize: vertical;
}

.request-form__row {
    display: flex;
    gap: 12px;
}

.request-form__row input {
    flex: 1;
    min-width: 0;
}

.request-form__submit {
    width: 100%;
    border: none;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.request-form__submit:disabled {
    opacity: 0.6;
    cursor: default;
}

.request-form__status {
    margin-top: 10px;
    font-size: 14px;
    min-height: 20px;
}

.request-form__status.is-ok {
    color: #7fca8a;
}

.request-form__status.is-error {
    color: #d98a8a;
}

.request-form__note {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--muted);
}

.request-form__fallback {
    margin-top: 18px;
    font-size: 16px;
}

/* Поле-ловушка для ботов: скрыто от людей */
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* ---------- Адаптивность ---------- */

@media (max-width: 1000px) {
    .search-form {
        max-width: 220px;
    }
}

@media (max-width: 860px) {
    .burger {
        display: flex;
        margin-left: auto;
    }

    /* Поиск переносится на вторую строку шапки на всю ширину */
    .site-header__inner {
        flex-wrap: wrap;
        padding-bottom: 10px;
    }

    .search-form {
        order: 10;
        flex-basis: 100%;
        max-width: none;
    }

    .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        margin: 0;
        background: var(--bg-alt);
        border-bottom: 1px solid var(--border);
        display: none;
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav a {
        padding: 15px 20px;
        border-top: 1px solid var(--border);
    }

    .header-phone {
        margin-left: auto;
        font-size: 15px;
    }

    .site-header__inner {
        gap: 14px;
    }

    .hero {
        padding: 60px 0 50px;
    }
}

@media (max-width: 480px) {
    .header-phone {
        display: none;
    }

    .request-form__row {
        flex-direction: column;
        gap: 0;
    }

    .modal {
        padding: 10px;
    }

    .modal__body {
        padding: 18px;
    }

    .chat-btn {
        width: 50px;
        height: 50px;
    }

    .chat-buttons {
        right: 14px;
        bottom: 14px;
    }
}
