/* ==========================================
   COMPONENTS — buttons, .vk-custom-card, .product-card, modals, forms
   ========================================== */

button,
a,
[role="button"],
.btn,
.top-link-btn,
.category-filter-btn,
.category-chip {
    touch-action: manipulation;
}

/* Сбрасываем лишние ограничения ширины с отдельных экранов, чтобы они слушались глобальный контейнер */
#screen-main,
#screen-create,
#screen-products,
#screen-categories,
.screen {
    position: relative !important;
    z-index: 2 !important; /* Поднимаем контент выше фиксированного фона */
    width: 100% !important;
    max-width: 100% !important;
    background: transparent !important;
    box-sizing: border-box !important;
    left: 0 !important;
    right: 0 !important;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

/* КРИТИЧЕСКИЙ ФИКС ФРИЗА: скрываем модалки до загрузки JS */
.modal-overlay {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    box-sizing: border-box;
}

/* Показывать модалку ТОЛЬКО при наличии класса active */
.modal-overlay.active {
    display: flex !important;
}

/* Оформление заглавия модалки */
.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 16px 0;
    color: #111827;
    padding-right: 28px;
    line-height: 1.3;
}

/* Отдельные блоки с текстом */
.modal-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #f3f4f6;
}

/* Фичи / пункты */
.modal-feature {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85rem;
    padding-bottom: 6px;
    border-bottom: 1px solid #edf2f7;
}

/* Кнопка ВКонтакте */
.vk-group-btn {
    display: block;
    width: 100%;
    background: #0077ff;
    color: #ffffff !important;
    text-align: center;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none !important;
    font-size: 0.9rem;
    transition: background 0.2s ease;
    box-sizing: border-box;
    border: none;
    cursor: pointer;
    margin-top: 4px;
}

/* Всплывающее меню контактов — оверлей на весь экран */
.action-sheet-overlay,
.modal-backdrop,
.contact-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    background: rgba(15, 23, 42, 0.4) !important; /* Мягкое затемнение фона */
    z-index: 9999 !important; /* Гарантированно поверх всего */
    display: none;
    align-items: flex-end !important; /* Прижимаем шторку к нижнему краю */
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* Отступы между блоками формы */
.form-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    margin-bottom: 20px !important; /* Увеличиваем расстояние между полями */
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Строка для цены и единицы измерения */
.form-row {
    display: flex !important;
    gap: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Стили для подписей к полям */
.form-label {
    color: #374151 !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
}

/* Мягкое текстовое поле для описания */
#screen-create textarea {
    min-height: 100px !important;
    resize: vertical !important;
}

/* Стили для placeholder */
.form-input::placeholder, #screen-create textarea::placeholder {
    color: #9ca3af !important;
}

/* Корректируем верхний отступ у заголовка внутри карточки, чтобы он не прилипал */
#screen-create h2, #screen-create .screen-title {
    margin-top: 0 !important;
    margin-bottom: 20px !important;
    color: #111827 !important;
    font-size: 1.4rem !important;
    font-weight: 800 !important;
}

/* Официальный виджет сообщества ВК (экран «Лента новостей») */
#vk_groups,
#vk_groups iframe {
    width: 100% !important;
    border-radius: 16px !important;
    overflow: hidden;
}

/* VK OpenAPI сжимает iframe до ~200px — держим высоту стены принудительно */
#vk_groups iframe {
    height: 600px !important;
    min-height: 600px !important;
    display: block !important;
    background: #fff !important;
    flex-shrink: 0 !important;
}

#vk_groups {
    margin-top: 0;
    margin-bottom: 0;
    overflow: hidden;
    background: #fff;
    border-radius: 16px;
}

#screen-stories > #vk_groups {
    margin-top: var(--content-gutter, 4px) !important;
    flex: 1 1 auto;
    min-height: 600px !important;
}

/* Модалки внутри app (кроме bottom-sheet и PIN — они фиксируются отдельно) */
.modal, .popup {
    position: absolute !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* PIN-модалка: полный оверлей, блокирует клики по фону */
#modal-pin,
.modal-pin-overlay {
    position: fixed !important;
    inset: 0 !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    background: rgba(15, 23, 42, 0.55) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: auto !important;
}

#modal-pin.hidden,
.modal-pin-overlay.hidden {
    display: none !important;
    pointer-events: none !important;
}

#modal-pin .modal-pin-dialog {
    position: relative !important;
    z-index: 10000 !important;
    pointer-events: auto !important;
    margin: 0 !important;
    max-width: 24rem !important;
    width: 100% !important;
}

/* Крестик закрытия в PIN-модалке скрыт (если появится) */
#modal-pin .modal-close-btn,
#modal-pin .modal-close,
#modal-pin .close-btn {
    display: none !important;
}

.modal-overlay .modal-content {
    position: relative !important;
    z-index: 1001 !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    padding: 24px 20px;
    max-width: 380px;
    width: 100% !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    margin: 0 !important;
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 14px;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
}

.modal-close-btn:hover {
    color: #111827;
}

.modal-block p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #374151;
}

.modal-feature:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.modal-feature strong {
    color: #065f46;
    font-weight: 600;
}

.modal-feature span {
    color: #4b5563;
    line-height: 1.35;
}

/* Выделенный блок инструкции */
.highlight-block,
.modal-block.highlight-block {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 0.85rem;
    line-height: 1.4;
}

.highlight-block strong {
    color: #047857;
}

.vk-group-btn:hover {
    background: #0066cc;
}

.action-sheet-overlay.active,
.modal-backdrop.active,
.contact-modal.active {
    display: flex !important;
}

/* Всплывающая карточка контактов (bottom sheet) */
.action-sheet-body,
.bottom-sheet,
.contact-card {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important; /* Скругление только сверху */
    background: #ffffff !important;
    padding: 20px 16px 28px 16px !important;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.15) !important;
    z-index: 10000 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    animation: slideUp 0.25s ease-out;
}


@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.action-sheet-btn {
    display: block !important;
    width: 100% !important;
    padding: 14px !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    margin-bottom: 8px !important;
    cursor: pointer !important;
    text-align: center !important;
}

.btn-call { background: #e8f5e9 !important; color: #00b050 !important; }

.btn-message { background: #e0f2fe !important; color: #0284c7 !important; }

.btn-cancel { background: #f3f4f6 !important; color: #374151 !important; margin-bottom: 0 !important; }

.form-row .form-group {
    width: auto !important;
    min-width: 0 !important;
}

.flex-1 {
    flex: 1 !important;
}

/* Единый стиль для всех полей ввода и селектов */
.form-input, .form-select, #screen-create textarea {
    width: 100% !important;
    padding: 12px 14px !important;
    border: 1px solid #e2e8f0 !important;
    background-color: #ffffff !important;
    border-radius: 12px !important;
    font-size: 0.9rem !important;
    color: #111827 !important;
    box-sizing: border-box !important;
    outline: none !important;
    transition: all 0.2s ease !important;
}

/* Эффект при клике на поле (фокус) */
.form-input:focus, .form-select:focus, #screen-create textarea:focus {
    border-color: #059669 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12) !important;
}

#screen-create {
    box-sizing: border-box !important;
}

.form-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    padding: 16px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

.vk-card-info {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.vk-icon {
    width: 36px !important;
    height: 36px !important;
    background: #0077ff !important; /* Фирменный синий ВК */
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.vk-text-block {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    flex-grow: 1 !important; /* Занимает доступное пространство */
    min-width: 0 !important; /* Важно для корректной работы nowrap */
}

.vk-title {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: #111827 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important; /* Если вдруг текст совсем длинный, он аккуратно сократится трехточием */
}

.vk-sub {
    font-size: 0.7rem !important;
    color: #6b7280 !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.vk-btn {
    background: #ffffff !important;
    color: #0077ff !important;
    border: 1px solid #cbd5e1 !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transition: all 0.2s ease !important;
}

.vk-btn:hover {
    background: #0077ff !important;
    color: #ffffff !important;
    border-color: #0077ff !important;
}

.vk-btn-primary {
    background-color: #0077ff !important; /* Ярко-синий ВК */
    color: #ffffff !important; /* Белый текст */
    border: none !important;
    font-weight: 700 !important;
    padding: 8px 16px !important;
    border-radius: 10px !important;
    transition: background-color 0.2s ease !important;
}

.vk-btn-primary:hover {
    background-color: #0066dd !important; /* Чуть темнее при наведении */
    color: #ffffff !important;
}

/* Карточка товара — визуал (геометрия в layout.css) */
.product-card,
.card,
.product-item,
.feed-card-item {
    background: #f1f5f9 !important;
    background-color: #f1f5f9 !important; /* Плотный серый фон карточек для четкого контраста */
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    box-shadow: none !important;
    overflow: hidden !important; /* Чтобы картинка идеально скруглялась по верху */
    padding: 0 !important;
    display: flex !important;          /* Safari: явный flex-контейнер */
    flex-direction: column !important; /* Safari: вертикальная ось */
    width: calc(100% - 24px) !important; /* Одинаковый отступ по 12px слева и справа */
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
    height: auto !important;
    min-height: max-content !important; /* Safari: расширение под весь контент */
    flex-shrink: 0 !important;          /* Safari: не сжимается в скролл-ленте */
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease !important;
}

.product-card-image,
.product-card-media,
.card-media {
    position: relative !important;
    width: 100% !important;
    height: 220px !important;
    min-height: 220px !important;
    max-height: 220px !important;
    object-fit: cover !important;
    border-radius: 12px 12px 0 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: transparent !important;
    background-color: transparent !important;
    flex-shrink: 0 !important;
}

.product-card-image > img,
.product-card-image-img,
.product-card-image img,
.product-card-media img,
.card-media img {
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    height: 220px !important;
    min-height: 220px !important;
    max-height: 220px !important;
    object-fit: cover !important;
    object-position: center !important;
    opacity: 1 !important;
    visibility: visible !important;
    flex-shrink: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
}

/* Галерея — дублируем жёсткие правила, чтобы перебить конфликты */
.card-gallery-wrapper {
    position: relative !important;
    width: 100% !important;
    height: 220px !important;
    min-height: 220px !important;
    background: transparent !important;
    background-color: transparent !important;
    overflow: hidden !important;
    border-radius: 12px 12px 0 0 !important;
}

.card-gallery {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 220px !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    scrollbar-width: none !important;
    background: transparent !important;
}

.card-gallery img,
.card-gallery-wrapper img {
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    height: 220px !important;
    min-height: 220px !important;
    object-fit: cover !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    scroll-snap-align: start !important;
    background: transparent !important;
}

.product-card:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Контент под обложкой — всегда видимый блок текста и кнопок */
.product-card-body,
.card-body,
.product-card-info {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 1 1 auto !important;         /* Занимает оставшееся место после картинки */
    flex-shrink: 0 !important;         /* Safari: не сжимается и не выдавливается вниз */
    height: auto !important;
    min-height: 0 !important;          /* Safari: предотвращает схлопывание блока */
    width: 100% !important;            /* Safari: гарантирует полную ширину */
    background-color: #f1f5f9 !important;
    padding: 12px 14px 14px 14px !important;
    gap: 6px !important;
    box-sizing: border-box !important;
}

.product-card .product-card-body,
.product-card .card-body,
.product-card .product-card-info,
.card .product-card-body,
.card .card-body,
.card .product-card-info,
.card-content {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 1 1 auto !important;         /* Занимает оставшееся место после картинки */
    flex-shrink: 0 !important;         /* Safari: не сжимается и не выдавливается вниз */
    height: auto !important;
    min-height: 0 !important;          /* Safari: предотвращает схлопывание блока */
    width: 100% !important;            /* Safari: гарантирует полную ширину */
    background-color: #f1f5f9 !important;
    padding: 12px 14px 14px 14px !important;
    gap: 6px !important;
    box-sizing: border-box !important;
}

.product-price-unit:empty {
    display: none !important;
}

.product-desc:empty {
    display: none !important;
}

/* Подложка ленты — визуал (backdrop на ::before в feed.css, чтобы не ломать sticky) */
.main-feed-card {
    background-color: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-radius: 16px !important;
    border: none !important;
    overflow: visible !important;
}

/* Описание товара — визуал/типографика частично в typography.css */
.product-desc,
.card-desc,
.product-description,
.description-box,
.product-desc-box,
.product-desc-box p,
.product-card .product-desc-box p {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Единая левая линия: заголовок, продавец, описание */
.product-card-title,
.product-title,
.card-title,
.product-card__title {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 65% !important;
}

.product-card-title,
.product-title,
.card-title,
.product-card__title,
.product-card-seller,
.product-author,
.seller-info,
.author-info,
.product-card-description,
.product-desc,
.card-desc,
.product-description {
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-align: left !important;
}

.product-card-seller,
.product-author,
.seller-info,
.author-info {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-left: 0 !important;
}

.product-card-description,
.product-desc,
.card-desc,
.product-description {
    box-sizing: border-box !important;
    width: 100% !important;
    padding-left: 4px !important; /* Легкий отступ правее */
    word-break: break-word !important; /* Переносит длинные слова на новую строку */
    overflow-wrap: break-word !important;
    white-space: normal !important;
    line-height: 1.35 !important;
    color: #475569 !important;
}

/* УРОВЕНЬ 1 — Название и цена: геометрия в layout.css, текст в typography.css */
.product-card__meta {
    color: #9ca3af;
}

/* Цена + единица измерения (без цветной плашки) */
.product-price-box,
.product-price-wrapper {
    display: inline-flex !important;
    align-items: baseline !important;
    gap: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    flex-shrink: 0 !important;
}

/* Акцентная цифра с ₽ — тёмная */
.price-val,
.product-card-price,
.product-price,
.card-price,
.product-card__price {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #0f172a !important; /* Тёмно-серый/чёрный вместо зелёного */
    margin: 0 !important;
    white-space: nowrap !important;
    background: transparent !important;
    padding: 0 !important;
    text-align: right;
    display: inline;
    border-radius: 0 !important;
}

/* Единица измерения — приглушённая */
.price-unit,
.product-price-unit,
.product-card__unit {
    color: #64748b !important;
    font-weight: 400 !important;
    font-size: 0.85em !important;
    margin-left: 3px !important;
    opacity: 1 !important;
    background: transparent !important;
    text-align: right;
    white-space: nowrap !important;
}

/* 3. ВТОРОСТЕПЕННЫЙ ФОН — Автор и Локация */
.seller-block,
.product-card__seller,
.seller-info,
.product-author,
.author-info {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 0.85rem !important;
    color: #64748b !important; /* Приглушённый серый */
    font-weight: 500 !important;
    margin: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.seller-avatar {
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    background: #e2e8f0 !important;
    color: #475569 !important;
    font-weight: 700 !important;
    font-size: 0.7rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 0 !important;
    flex-shrink: 0 !important;
}

.seller-info strong,
.product-author strong,
.author-info strong,
.product-card__seller span {
    color: #111827;
    font-weight: 600;
}

/* Гео-тег населенного пункта внутри карточки товара */
.product-card .location-tag {
    background: transparent !important; /* Полностью убираем серое поле */
    padding: 0 !important;
    border-radius: 0 !important;
    color: #64748b !important; /* Спокойный текстовый серый */
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    margin-left: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    display: inline !important;
}

/* Добавляем стильную разделительную точку перед названием локации */
.product-card .location-tag::before {
    content: "• " !important;
    margin: 0 4px !important;
    color: #94a3b8 !important;
}

.product-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Primary Solid CTA — «+ Продать» (DESIGN_SYSTEM.md §5) */
.add-product-btn,
.btn-sell,
.add-btn {
    background: linear-gradient(135deg, #2E6653 0%, #1E5644 100%) !important;
    background-color: transparent !important;
    color: var(--text-on-brand, #FFFFFF) !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    box-shadow:
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.45),
        0 8px 20px -4px rgba(46, 102, 83, 0.4) !important;
    transition:
        transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
        background 0.2s ease,
        box-shadow 0.2s ease !important;
    -webkit-tap-highlight-color: transparent !important;
}

.add-product-btn:hover,
.btn-sell:hover,
.add-btn:hover {
    background: linear-gradient(135deg, #357a65 0%, #1a4f40 100%) !important;
    color: var(--text-on-brand, #FFFFFF) !important;
    box-shadow:
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.58),
        0 10px 24px -4px rgba(46, 102, 83, 0.5) !important;
}

.add-product-btn:active,
.btn-sell:active,
.add-btn:active {
    transform: scale(0.96) translateY(1px) !important;
    box-shadow:
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.32),
        0 4px 12px -4px rgba(46, 102, 83, 0.28) !important;
}

/* Card Action CTA — «Связаться» (soft fill, вторичный уровень) */
.contact-btn,
.btn-contact,
.btn-primary-action,
.card-action-btn {
    background: var(--brand-light-bg, #EAF2EE) !important;
    background-color: var(--brand-light-bg, #EAF2EE) !important;
    color: var(--brand-primary, #2E6653) !important;
    border: 1px solid rgba(46, 102, 83, 0.28) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        var(--shadow-subtle, 0 4px 20px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02)) !important;
    transition:
        transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease !important;
    -webkit-tap-highlight-color: transparent !important;
}

.contact-btn:hover,
.btn-contact:hover,
.btn-primary-action:hover,
.card-action-btn:hover {
    background: #d9ebe3 !important;
    color: var(--brand-dark, #1E5644) !important;
    border-color: rgba(46, 102, 83, 0.45) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.65),
        var(--shadow-subtle, 0 4px 20px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02)) !important;
}

.contact-btn:active,
.btn-contact:active,
.btn-primary-action:active,
.card-action-btn:active {
    transform: scale(0.97) !important;
    background: #cfe4da !important;
    color: var(--brand-dark, #1E5644) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        0 2px 8px -2px rgba(46, 102, 83, 0.12) !important;
}

/* Кнопка «Связаться» — геометрия карточки */
.contact-btn,
.btn-contact,
.btn-primary-action,
.card-action-btn,
.product-card .btn-connect {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    height: 44px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600 !important;
    cursor: pointer;
}

.contact-btn-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.product-actions-row {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
    margin-top: 16px !important;
    box-sizing: border-box !important;
}

.btn-connect {
    flex-grow: 1 !important;
    background: #f0fdf4 !important;
    color: #047857 !important;
    border: 1px solid #a7f3d0 !important;
    padding: 12px 24px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    text-align: center !important;
    transition: all 0.2s ease !important;
}

.btn-connect:hover {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
}

.btn-delete-item,
.btn-delete,
.delete-btn,
.delete-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 10px !important;
    background-color: #fef2f2 !important; /* Мягкий светло-красный фон */
    border: 1.5px solid #f87171 !important; /* Чёткая красная обводка */
    color: #ef4444 !important; /* Сочный красный крестик */
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    position: static !important;
    line-height: 1 !important;
    padding: 0 !important;
    opacity: 1 !important;
}

.btn-delete-item:hover,
.btn-delete:hover,
.delete-btn:hover,
.delete-icon:hover,
.btn-delete:active,
.delete-icon:active {
    background-color: #fee2e2 !important;
    border-color: #dc2626 !important;
    color: #ef4444 !important;
    opacity: 1 !important;
}

.action-sheet-header {
    text-align: center !important;
    color: #6b7280 !important;
    font-size: 0.85rem !important;
    margin-bottom: 12px !important;
}

/* Геометрия .card-footer уже задана в layout.css */

.btn-contact,
.btn-primary-action {
    flex: 1 !important;
    margin: 0 !important;
    height: auto;
    padding: 10px 14px !important;
    border-radius: 9999px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    cursor: pointer;
}

/* --- Микро-анимации взаимодействия --- */

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-primary-action,
.vk-btn,
.category-btn,
.search-btn,
button {
    transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease !important;
}

.vk-btn:active,
.category-btn:active {
    transform: scale(0.96) !important;
}

/* --- Свечение поиска и подсветка категорий --- */

/* 1. Мягкое свечение инпута при фокусе */
#search-input:focus,
.hero__search-input:focus,
.search-input:focus {
    outline: none !important;
    border-color: #34d399 !important;
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.45) !important;
    transition: all 0.25s ease !important;
}

/* Подсветка чипов категорий при поиске */
.highlight-food,
[data-category="food"].highlight-food,
button.highlight-food {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
    border: 1px solid #fca5a5 !important;
    transform: translateY(-1px) scale(1.03) !important;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.2) !important;
    transition: all 0.2s ease !important;
}

.highlight-health,
[data-category="health"].highlight-health,
button.highlight-health {
    background-color: #dcfce7 !important;
    color: #15803d !important;
    border: 1px solid #86efac !important;
    transform: translateY(-1px) scale(1.03) !important;
    box-shadow: 0 4px 10px rgba(21, 128, 61, 0.2) !important;
    transition: all 0.2s ease !important;
}

.highlight-craft,
[data-category="craft"].highlight-craft,
button.highlight-craft {
    background-color: #fef9c3 !important;
    color: #ca8a04 !important;
    border: 1px solid #fde047 !important;
    transform: translateY(-1px) scale(1.03) !important;
    box-shadow: 0 4px 10px rgba(202, 138, 4, 0.2) !important;
    transition: all 0.2s ease !important;
}

.highlight-masterclass,
[data-category="masterclass"].highlight-masterclass,
button.highlight-masterclass {
    background-color: #ede9fe !important;
    color: #6d28d9 !important;
    border: 1px solid #c4b5fd !important;
    transform: translateY(-1px) scale(1.03) !important;
    box-shadow: 0 4px 10px rgba(109, 40, 217, 0.2) !important;
    transition: all 0.2s ease !important;
}

/* Toast-уведомления */
.app-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 10000;
    transform: translateX(-50%) translateY(16px);
    max-width: calc(100% - 32px);
    padding: 12px 18px;
    border-radius: 12px;
    background: #111827;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================
   Safari Dark Mode — карточки товаров
   ========================================== */
.product-card *,
.card * {
    background-color: transparent !important;
}

.product-card,
.card {
    background-color: #f1f5f9 !important;
}

.product-card h2,
.product-card h3,
.product-card p,
.product-card span,
.card h2,
.card h3,
.card p,
.card span {
    color: #0f172a !important;
}

/* Восстанавливаем акцентные элементы после transparent-сброса */
.product-card .product-card-body,
.product-card .product-card-content,
.product-card .card-body,
.product-card .product-card-info,
.product-card .card-content,
.card .product-card-body,
.card .card-body,
.card .product-card-info,
.card .card-content {
    background-color: #f1f5f9 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.product-card .product-price-box,
.product-card .product-price-wrapper,
.card .product-price-box,
.card .product-price-wrapper {
    background: transparent !important;
}

.product-card .price-val,
.product-card .product-card-price,
.product-card .product-price,
.product-card .card-price,
.card .price-val,
.card .product-price,
.card .card-price {
    color: #0f172a !important;
    font-weight: 700 !important;
    background: transparent !important;
}

.product-card .price-unit,
.product-card .product-price-unit,
.card .price-unit,
.card .product-price-unit {
    color: #64748b !important;
    font-weight: 400 !important;
    font-size: 0.85em !important;
    margin-left: 3px !important;
    background: transparent !important;
}

.product-card .seller-avatar,
.card .seller-avatar {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

.product-card .seller-info,
.product-card .product-author,
.product-card .author-info,
.product-card .location-tag,
.card .seller-info,
.card .location-tag {
    color: #64748b !important;
    background: transparent !important;
}

.product-card .seller-info strong,
.product-card .product-author strong,
.product-card .author-info strong,
.card .seller-info strong {
    color: #111827 !important;
}

.product-card .btn-primary-action,
.product-card .btn-contact,
.product-card .contact-btn,
.product-card .btn-connect,
.card .btn-primary-action,
.card .btn-contact,
.card .contact-btn {
    background: var(--brand-light-bg, #EAF2EE) !important;
    color: var(--brand-primary, #2E6653) !important;
    border: 1px solid rgba(46, 102, 83, 0.28) !important;
}

.product-card .btn-delete,
.product-card .delete-icon,
.product-card .delete-btn,
.card .btn-delete,
.card .delete-icon,
.card .delete-btn {
    background-color: #fef2f2 !important;
    color: #ef4444 !important;
}

@media (prefers-color-scheme: dark) {
    .product-card *,
    .card * {
        background-color: transparent !important;
    }

    .product-card,
    .card {
        background-color: #f1f5f9 !important;
    }

    .product-card .product-card-body,
    .product-card .card-body,
    .product-card .product-card-info,
    .product-card .card-content,
    .card .product-card-body,
    .card .card-body,
    .card .product-card-info {
        background-color: #f1f5f9 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .product-card h2,
    .product-card h3,
    .product-card p,
    .product-card span,
    .card h2,
    .card h3,
    .card p,
    .card span {
        color: #0f172a !important;
    }

    .product-card .product-price-box,
    .product-card .product-price-wrapper,
    .card .product-price-box {
        background: transparent !important;
    }

    .product-card .price-val,
    .product-card .product-card-price,
    .product-card .product-price,
    .product-card .card-price {
        color: #0f172a !important;
        font-weight: 700 !important;
    }

    .product-card .price-unit,
    .product-card .product-price-unit {
        color: #64748b !important;
        font-weight: 400 !important;
        font-size: 0.85em !important;
        margin-left: 3px !important;
    }

    .product-card .seller-avatar {
        background: #e2e8f0 !important;
        color: #475569 !important;
    }

    .product-card .btn-primary-action,
    .product-card .btn-contact,
    .product-card .btn-connect,
    .product-card .contact-btn {
        background: var(--brand-light-bg, #EAF2EE) !important;
        color: var(--brand-primary, #2E6653) !important;
        border: 1px solid rgba(46, 102, 83, 0.28) !important;
    }

    .product-card .btn-delete,
    .product-card .delete-icon {
        background-color: #fef2f2 !important;
        color: #ef4444 !important;
    }
}


