/* ============================================================
   sh-card.css — Unified Product Card (Modern Clean 4A)
   Single source of truth for all product cards across the site.

   Variants:
   - .sh-card              — standard card (leaders, seocatalog, favorites, recommendations)
   - .sh-card--no-btn      — card without CTA button (recommendations without cart)
   - .sh-card--cooperation — "УЗНАТЬ СТОИМОСТЬ" instead of price+cart
   ============================================================ */

/* ============================================================
   DESKTOP (min-width: 1260px)
   ============================================================ */
@media screen and (min-width: 1260px) {

    .sh-card {
        position: relative;
        background: #fff;
        border-radius: 1px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        border: 1px solid #EDEEF1;
        transition: border-color 0.3s, box-shadow 0.3s;
    }
    .sh-card:hover {
        border-color: #CCAD22;
        box-shadow: 0 8px 24px rgba(204, 173, 34, 0.1);
    }

    /* Badge */
    .sh-card-badge {
        position: absolute;
        top: 16px;
        left: 16px;
        padding: 5px 12px;
        background: #CC3E22;
        color: #fff;
        font-family: 'InterMedium', 'Inter', sans-serif;
        font-size: 12px;
        font-weight: 700;
        border-radius: 1px;
        z-index: 2;
        line-height: 1;
    }

    /* Favorite button */
    .sh-card-fav {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
        background: #fff;
        border: 1px solid #E0E2E8;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 2;
        transition: all 0.2s;
        padding: 0;
    }
    .sh-card-fav:hover {
        border-color: #CC3E22;
    }
    .sh-card-fav:hover svg {
        stroke: #CC3E22;
    }
    .sh-card-fav svg {
        width: 18px;
        height: 18px;
        stroke: #9799A6;
        fill: none;
        stroke-width: 1.5;
        stroke-linecap: round;
        stroke-linejoin: round;
        transition: all 0.25s;
        display: block;
    }
    .sh-card-fav.active svg,
    .sh-card-fav--active svg {
        stroke: #CC3E22;
        fill: #CC3E22;
    }

    /* Favorite remove form (favorites page) */
    .sh-card-fav-remove {
        position: absolute;
        top: 16px;
        right: 16px;
        z-index: 2;
    }
    .sh-card-fav-remove .sh-card-fav {
        position: static;
    }

    /* Image area */
    .sh-card-img {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 280px;
        padding: 8px 12px;
        background: #F5F6F8;
        text-decoration: none;
    }
    .sh-card-img img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    }
    .sh-card:hover .sh-card-img img {
        transform: scale(1.05);
    }

    /* Card body */
    .sh-card-body {
        padding: 16px 20px 0;
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    /* Product name */
    .sh-card-name {
        font-family: 'InterMedium', 'Inter', sans-serif;
        font-size: 15px;
        font-weight: 500;
        color: #2B2C32;
        line-height: 1.35;
        margin-bottom: 10px;
    }
    .sh-card-name a {
        color: inherit;
        text-decoration: none;
    }
    .sh-card-name a:hover {
        color: #383B47;
    }

    /* Prices */
    .sh-card-prices {
        margin-top: auto;
        display: flex;
        align-items: baseline;
        gap: 10px;
        margin-bottom: 16px;
    }
    .sh-card-price-current {
        font-family: 'Inter', sans-serif;
        font-size: 24px;
        font-weight: 700;
        color: #0E0F11;
    }
    .sh-card-price-old {
        font-family: 'Inter', sans-serif;
        font-size: 15px;
        color: #9799A6;
        text-decoration: line-through;
    }

    /* CTA Button */
    .sh-card-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 50px;
        margin: 0 -1px -1px;
        background: #383B47;
        color: #fff;
        font-family: 'Inter', sans-serif;
        font-size: 13px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border: none;
        cursor: pointer;
        border-radius: 0 0 1px 1px;
        transition: background 0.2s;
        text-decoration: none;
        line-height: 1;
    }
    .sh-card-btn:hover {
        background: #4E5164;
        color: #fff;
    }
    .sh-card-btn:disabled {
        opacity: 0.6;
        cursor: default;
    }

    /* Separator (legacy compat) */
    .sh-card-sep {
        display: none;
    }

    /* OLD price format (inline, legacy compat for templates not yet migrated) */
    .sh-card-price {
        text-align: center;
        font-family: 'Inter', sans-serif;
        font-size: 24px;
        font-weight: 700;
        color: #0E0F11;
        margin-top: auto;
        padding: 0 20px 16px;
    }
    .sh-card-price .sh-card-price-old {
        font-size: 15px;
        color: #9799A6;
        text-decoration: line-through;
        margin-right: 8px;
        font-weight: 400;
    }

    /* Catalog section grid override (Intec flex → CSS Grid for sh-cards) */
    .c-catalog-section-catalog-tile-1 .catalog-section-items,
    .c-catalog-section-catalog-tile-4 .catalog-section-items {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    /* "Перейти в каталог" button container */
    .sh-leaders-bottom {
        text-align: center;
        padding-top: 48px;
        padding-bottom: 48px;
    }

    /* Grid layouts */
    .sh-leaders-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
        justify-content: center;
    }

    .sh-recommendations-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 20px;
    }

    /* Cooperation variant: scrollable row */
    .sh-card--cooperation .sh-card-img {
        height: 280px;
    }

    /* Cooperation card footer */
    .sh-card-footer {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 50px;
        margin: 0 -1px -1px;
        background: #383B47;
        color: #fff;
        font-family: 'Inter', sans-serif;
        font-size: 13px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border: none;
        border-radius: 0 0 1px 1px;
        text-decoration: none;
        transition: background 0.2s;
    }
    .sh-card-footer:hover {
        background: #4E5164;
        color: #fff;
    }

    /* Favorites empty state */
    .sh-favorites-empty {
        text-align: center;
        padding: 80px 20px;
    }
    .sh-favorites-empty-title {
        font-size: 18px;
        font-weight: 500;
        color: #2B2C32;
        margin-bottom: 8px;
    }
    .sh-favorites-empty-text {
        font-size: 14px;
        color: #717883;
        margin-bottom: 24px;
    }
    .sh-favorites-empty-btn {
        display: inline-block;
        padding: 12px 32px;
        background: #383B47;
        color: #fff;
        text-decoration: none;
        font-size: 13px;
        font-weight: 600;
        text-transform: uppercase;
        border-radius: 1px;
    }
    .sh-favorites-empty-btn:hover {
        background: #4E5164;
        color: #fff;
    }
}


/* ============================================================
   TABLET (768px — 1259px)
   ============================================================ */
@media screen and (min-width: 768px) and (max-width: 1259px) {

    .sh-card {
        position: relative;
        background: #fff;
        border-radius: 1px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        border: 1px solid #EDEEF1;
        transition: border-color 0.3s, box-shadow 0.3s;
    }
    .sh-card:hover {
        border-color: #CCAD22;
        box-shadow: 0 6px 20px rgba(204, 173, 34, 0.08);
    }

    .sh-card-badge {
        position: absolute;
        top: 12px;
        left: 12px;
        padding: 4px 10px;
        background: #CC3E22;
        color: #fff;
        font-family: 'InterMedium', 'Inter', sans-serif;
        font-size: 12px;
        font-weight: 700;
        border-radius: 1px;
        z-index: 2;
        line-height: 1;
    }

    .sh-card-fav {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        background: #fff;
        border: 1px solid #E0E2E8;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 2;
        transition: all 0.2s;
        padding: 0;
    }
    .sh-card-fav:hover { border-color: #CC3E22; }
    .sh-card-fav:hover svg { stroke: #CC3E22; }
    .sh-card-fav svg {
        width: 16px; height: 16px;
        stroke: #9799A6; fill: none;
        stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
        transition: all 0.25s; display: block;
    }
    .sh-card-fav.active svg,
    .sh-card-fav--active svg { stroke: #CC3E22; fill: #CC3E22; }

    .sh-card-fav-remove {
        position: absolute; top: 12px; right: 12px; z-index: 2;
    }
    .sh-card-fav-remove .sh-card-fav { position: static; }

    .sh-card-img {
        display: flex; align-items: center; justify-content: center;
        height: 300px;
        padding: 8px 10px;
        background: #F5F6F8;
        text-decoration: none;
    }
    .sh-card-img img {
        max-width: 100%; max-height: 100%;
        object-fit: contain;
    }

    .sh-card-body {
        padding: 12px 16px 0;
        flex: 1; display: flex; flex-direction: column;
    }

    .sh-card-name {
        font-family: 'InterMedium', 'Inter', sans-serif;
        font-size: 14px; font-weight: 500;
        color: #2B2C32; line-height: 1.35;
        margin-bottom: 8px;
    }
    .sh-card-name a { color: inherit; text-decoration: none; }

    .sh-card-prices {
        margin-top: auto;
        display: flex; align-items: baseline; gap: 8px;
        margin-bottom: 12px;
    }
    .sh-card-price-current {
        font-size: 20px; font-weight: 700; color: #0E0F11;
    }
    .sh-card-price-old {
        font-size: 14px; color: #9799A6; text-decoration: line-through;
    }

    .sh-card-btn {
        display: flex; align-items: center; justify-content: center;
        height: 46px; margin: 0 -1px -1px;
        background: #383B47; color: #fff;
        font-size: 12px; font-weight: 600;
        text-transform: uppercase; letter-spacing: 0.4px;
        border: none; cursor: pointer;
        border-radius: 0 0 1px 1px;
        transition: background 0.2s;
        text-decoration: none; line-height: 1;
    }
    .sh-card-btn:hover { background: #4E5164; color: #fff; }

    .sh-card-sep { display: none; }

    .sh-card-price {
        text-align: center;
        font-size: 20px; font-weight: 700; color: #0E0F11;
        margin-top: auto; padding: 0 16px 12px;
    }
    .sh-card-price .sh-card-price-old {
        font-size: 14px; color: #9799A6;
        text-decoration: line-through; margin-right: 6px; font-weight: 400;
    }

    .sh-leaders-bottom {
        text-align: center;
        padding-top: 36px;
    }

    /* Catalog section grid override — tablet */
    .c-catalog-section-catalog-tile-1 .catalog-section-items,
    .c-catalog-section-catalog-tile-4 .catalog-section-items {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .sh-leaders-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .sh-recommendations-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .sh-card-footer {
        display: flex; align-items: center; justify-content: center;
        height: 46px; margin: 0 -1px -1px;
        background: #383B47; color: #fff;
        font-size: 12px; font-weight: 600;
        text-transform: uppercase; letter-spacing: 0.4px;
        border: none; border-radius: 0 0 1px 1px;
        text-decoration: none; transition: background 0.2s;
    }
    .sh-card-footer:hover { background: #4E5164; color: #fff; }

    .sh-favorites-empty { text-align: center; padding: 60px 20px; }
    .sh-favorites-empty-title { font-size: 16px; font-weight: 500; color: #2B2C32; margin-bottom: 8px; }
    .sh-favorites-empty-text { font-size: 13px; color: #717883; margin-bottom: 20px; }
    .sh-favorites-empty-btn {
        display: inline-block; padding: 10px 28px;
        background: #383B47; color: #fff; text-decoration: none;
        font-size: 12px; font-weight: 600; text-transform: uppercase; border-radius: 1px;
    }
}


/* ============================================================
   MOBILE (max-width: 767px)
   ============================================================ */
@media screen and (max-width: 767px) {

    .sh-card {
        position: relative;
        background: #fff;
        border-radius: 1px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        border: 1px solid #EDEEF1;
    }

    .sh-card-badge {
        position: absolute;
        top: 10px; left: 10px;
        padding: 4px 8px;
        background: #CC3E22; color: #fff;
        font-family: 'InterMedium', 'Inter', sans-serif;
        font-size: 11px; font-weight: 700;
        border-radius: 1px; z-index: 2; line-height: 1;
    }

    .sh-card-fav {
        position: absolute;
        top: 10px; right: 10px;
        width: 30px; height: 30px;
        background: #fff; border: 1px solid #E0E2E8;
        border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        cursor: pointer; z-index: 2; padding: 0;
    }
    .sh-card-fav svg {
        width: 15px; height: 15px;
        stroke: #9799A6; fill: none;
        stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
        display: block;
    }
    .sh-card-fav.active svg,
    .sh-card-fav--active svg { stroke: #CC3E22; fill: #CC3E22; }

    .sh-card-fav-remove {
        position: absolute; top: 10px; right: 10px; z-index: 2;
    }
    .sh-card-fav-remove .sh-card-fav { position: static; }

    .sh-card-img {
        display: flex; align-items: center; justify-content: center;
        height: 220px;
        padding: 6px 8px;
        background: #F5F6F8;
        text-decoration: none;
    }
    .sh-card-img img {
        max-width: 100%; max-height: 100%; object-fit: contain;
    }

    .sh-card-body {
        padding: 10px 14px 0;
        flex: 1; display: flex; flex-direction: column;
    }

    .sh-card-name {
        font-family: 'InterMedium', 'Inter', sans-serif;
        font-size: 13px; font-weight: 500;
        color: #2B2C32; line-height: 1.3;
        margin-bottom: 6px;
    }
    .sh-card-name a { color: inherit; text-decoration: none; }

    .sh-card-prices {
        margin-top: auto;
        display: flex; align-items: baseline; gap: 6px;
        margin-bottom: 10px;
    }
    .sh-card-price-current {
        font-size: 18px; font-weight: 700; color: #0E0F11;
    }
    .sh-card-price-old {
        font-size: 13px; color: #9799A6; text-decoration: line-through;
    }

    .sh-card-btn {
        display: flex; align-items: center; justify-content: center;
        width: calc(100% + 2px);
        margin: 0 -1px -1px;
        height: 48px; padding: 0 6px;
        background: #383B47; color: #fff;
        font-family: 'Inter', sans-serif;
        font-size: 12px; font-weight: 600;
        text-transform: uppercase; letter-spacing: 0.3px;
        border: none; cursor: pointer;
        border-radius: 0 0 1px 1px;
        transition: background 0.2s;
        text-decoration: none; line-height: 1;
    }

    .sh-card-sep { display: none; }

    .sh-card-price {
        text-align: center;
        font-size: 18px; font-weight: 700; color: #0E0F11;
        margin-top: auto; padding: 0 14px 10px;
    }
    .sh-card-price .sh-card-price-old {
        font-size: 13px; color: #9799A6;
        text-decoration: line-through; margin-right: 6px; font-weight: 400;
    }

    .sh-leaders-bottom {
        text-align: center;
        padding-top: 28px;
    }

    /* Catalog section grid override — mobile */
    .c-catalog-section-catalog-tile-1 .catalog-section-items,
    .c-catalog-section-catalog-tile-4 .catalog-section-items {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .sh-leaders-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .sh-recommendations-grid {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .sh-recommendations-grid::-webkit-scrollbar { display: none; }
    .sh-recommendations-grid .sh-card {
        min-width: 240px;
        scroll-snap-align: start;
    }

    .sh-card-footer {
        display: flex; align-items: center; justify-content: center;
        height: 44px; margin: 0 -1px -1px;
        background: #383B47; color: #fff;
        font-size: 11px; font-weight: 600;
        text-transform: uppercase; letter-spacing: 0.3px;
        border: none; border-radius: 0 0 1px 1px;
        text-decoration: none;
    }

    .sh-favorites-empty { text-align: center; padding: 48px 16px; }
    .sh-favorites-empty-title { font-size: 15px; font-weight: 500; color: #2B2C32; margin-bottom: 6px; }
    .sh-favorites-empty-text { font-size: 13px; color: #717883; margin-bottom: 16px; }
    .sh-favorites-empty-btn {
        display: inline-block; padding: 10px 24px;
        background: #383B47; color: #fff; text-decoration: none;
        font-size: 11px; font-weight: 600; text-transform: uppercase; border-radius: 1px;
    }
}
