/* ============================================
   Shop Grid Pro - Main Styles
   ============================================ */

/* Grid Layout */
.sgp-shop-section {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.sgp-grid {
    display: grid;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    align-items: stretch;
    box-sizing: border-box;
}

/* ============================================
   Product Card
   ============================================ */
.sgp-product-card {
    position: relative;
    background: #fff;
    border-radius: 4px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
    overflow: hidden;
    border: 1px solid transparent;
    box-sizing: border-box;
    min-width: 0;
}

.sgp-product-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-color: #eee;
}

.sgp-card-empty {
    visibility: hidden;
}

/* Badge */
.sgp-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    border-radius: 3px;
    line-height: 1.4;
}

.sgp-badge-featured {
    background-color: #e74c3c !important;
}

.sgp-badge-sale {
    background-color: #555 !important;
}

.sgp-badge-free {
    background-color: #27ae60 !important;
}

/* Product Image */
.sgp-card-image-link {
    display: block;
    text-align: center;
    margin-bottom: 8px;
    position: relative;
    padding-bottom: 100%; /* 1:1 ratio */
    overflow: hidden;
}

.sgp-card-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 85%;
    max-height: 85%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.sgp-product-card:hover .sgp-card-image {
    transform: translate(-50%, -50%) scale(1.05);
}

.sgp-card-image-placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #f8f8f8;
}

/* Card Info */
.sgp-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Rating */
.sgp-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    min-height: 16px;
}

.sgp-stars {
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.sgp-star-full {
    color: #f5a623;
}

.sgp-star-half {
    color: #f5a623;
    opacity: 0.6;
}

.sgp-star-empty {
    color: #ddd;
}

.sgp-rating-count {
    font-size: 11px;
    color: #999;
}

/* Brand */
.sgp-brand {
    font-size: 11px;
    color: #999;
    margin-bottom: 2px;
    font-weight: 400;
    min-height: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Title - fixed 2-line height */
.sgp-card-title {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6em; /* FIXED height, not min-height */
    word-break: break-word;
}

.sgp-card-title a {
    color: inherit;
    text-decoration: none;
}

.sgp-card-title a:hover {
    color: #e74c3c;
}

/* Discount Badge */
.sgp-discount-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: #e74c3c;
    border-radius: 3px;
    margin-bottom: 4px;
    align-self: flex-start;
}

/* Prices - always pushed to bottom */
.sgp-prices {
    margin-top: auto;
    margin-bottom: 8px;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.sgp-price-regular {
    font-size: 11px;
    color: #999;
}

.sgp-price-regular del {
    text-decoration: line-through;
}

.sgp-price-sale {
    font-size: 16px;
    font-weight: 800;
    color: #e74c3c;
}

.sgp-price-sale del {
    font-size: 11px;
    font-weight: 400;
    color: #999;
}

.sgp-price-sale ins {
    text-decoration: none;
    font-weight: 800;
}

/* Add to Cart Button */
.sgp-add-to-cart {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: #222;
    color: #fff;
    border: 2px solid #222;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 6px;
    line-height: 1.4;
}

.sgp-add-to-cart:hover {
    background: transparent;
    color: #222;
}

.sgp-add-to-cart.sgp-adding {
    opacity: 0.6;
    pointer-events: none;
}

.sgp-add-to-cart.sgp-added {
    background: #27ae60 !important;
    border-color: #27ae60 !important;
    color: #fff !important;
}

.sgp-view-product {
    background: transparent;
    color: #222;
}

.sgp-view-product:hover {
    background: #222;
    color: #fff;
}

/* Shipping Text */
.sgp-shipping {
    font-size: 9px;
    color: #bbb;
    line-height: 1.3;
    margin-bottom: 2px;
}

/* Stock Status */
.sgp-stock {
    font-size: 10px;
    font-weight: 600;
}

.sgp-in-stock {
    color: #27ae60;
}

.sgp-out-stock {
    color: #e74c3c;
}

/* ============================================
   Side Banner
   ============================================ */
.sgp-side-banner {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    min-height: 100%;
}

.sgp-banner-link {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
}

.sgp-banner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sgp-banner-cta {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    background: #fff;
    color: #222;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid #222;
    border-radius: 3px;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sgp-banner-cta:hover {
    background: #222;
    color: #fff;
}

/* ============================================
   Full-Width Banner Widget
   ============================================ */
.sgp-fw-banner {
    width: 100%;
}

.sgp-fw-single,
.sgp-fw-item {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: #f5f5f5;
}

.sgp-fw-single {
    height: 250px;
}

.sgp-fw-grid {
    display: grid;
    gap: 8px;
    width: 100%;
}

.sgp-fw-link {
    display: block;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    text-decoration: none;
}

.sgp-fw-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.sgp-fw-single:hover .sgp-fw-img,
.sgp-fw-item:hover .sgp-fw-img {
    transform: scale(1.03);
}

.sgp-fw-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 24px;
    pointer-events: none;
}

.sgp-fw-overlay-text {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
    line-height: 1.3;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sgp-fw-cta {
    display: inline-block;
    padding: 10px 28px;
    background: #fff;
    color: #222;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid #222;
    border-radius: 3px;
    transition: all 0.2s ease;
    pointer-events: auto;
    cursor: pointer;
}

.sgp-fw-single:hover .sgp-fw-cta,
.sgp-fw-item:hover .sgp-fw-cta {
    background: #222;
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .sgp-fw-grid {
        grid-template-columns: 1fr !important;
    }

    .sgp-fw-item {
        height: 200px !important;
    }

    .sgp-fw-single {
        height: 180px !important;
    }

    .sgp-fw-overlay-text {
        font-size: 16px;
    }

    .sgp-fw-cta {
        padding: 8px 20px;
        font-size: 11px;
    }
}

/* ============================================
   In-Grid Promo Cards (SAME SIZE as products)
   Card height is set by product cards in the row.
   Promo card just fills that space — never taller.
   ============================================ */
.sgp-promo-card {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: #f5f5f5;
    /* CRITICAL: don't let content define height */
    min-height: 0;
    min-width: 0;
}

/* Wrapper fills entire card */
.sgp-promo-card-link {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: block;
    text-decoration: none;
    overflow: hidden;
}

/* No-link wrapper same treatment */
.sgp-promo-card > div.sgp-promo-card-link {
    cursor: default;
}

/* Image covers entire card — NO overflow, NO gray */
.sgp-promo-card-img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
}

.sgp-promo-card:hover .sgp-promo-card-img {
    transform: scale(1.03);
    transition: transform 0.3s ease;
}

.sgp-promo-card-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.5));
    z-index: 2;
    pointer-events: none;
}

.sgp-promo-card-title {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.3;
    margin-bottom: 8px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.sgp-promo-card-cta {
    display: inline-block;
    padding: 6px 16px;
    background: #fff;
    color: #222;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    pointer-events: auto;
    transition: all 0.2s ease;
}

.sgp-promo-card:hover .sgp-promo-card-cta {
    background: #222;
    color: #fff;
}

/* ============================================
   Promo Bar
   ============================================ */
.sgp-promo-bar {
    background: #fff5f5;
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid #f0d0d0;
    font-family: inherit;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.sgp-promo-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1200px;
    width: 100%;
    justify-content: center;
    position: relative;
}

.sgp-promo-discount {
    font-size: 36px;
    font-weight: 900;
    color: #e74c3c;
    line-height: 1;
}

.sgp-promo-discount sup {
    font-size: 18px;
    vertical-align: super;
}

.sgp-promo-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sgp-promo-text {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sgp-promo-code {
    font-size: 16px;
    font-weight: 900;
    color: #e74c3c;
    padding: 2px 8px;
    border: 1px dashed #e74c3c;
    border-radius: 3px;
    cursor: pointer;
}

.sgp-countdown {
    font-weight: 700;
    font-size: 14px;
    color: #555;
}

.sgp-promo-sub {
    font-size: 9px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sgp-promo-close {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.sgp-promo-close:hover {
    color: #333;
}

/* ============================================
   Responsive
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .sgp-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .sgp-side-banner {
        grid-column: span 3 !important;
        grid-row: auto !important;
        height: 250px;
    }

    .sgp-card-title {
        font-size: 11px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .sgp-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    /* Promo cards stay in 1 column — slightly narrower than products */
    .sgp-promo-card {
        min-height: 0 !important;
        margin: 0 -4px !important;
    }

    .sgp-side-banner {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        height: 180px;
    }

    .sgp-card-title {
        font-size: 11px;
    }

    .sgp-brand {
        font-size: 10px;
    }

    .sgp-price-current {
        font-size: 14px;
    }

    .sgp-add-to-cart {
        font-size: 10px;
        padding: 7px 8px;
    }

    .sgp-shipping {
        font-size: 8px;
    }

    .sgp-promo-bar {
        padding: 8px 12px;
    }

    .sgp-promo-inner {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    .sgp-promo-discount {
        font-size: 24px;
    }

    .sgp-promo-content {
        justify-content: center;
    }

    .sgp-promo-sub {
        display: none;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .sgp-grid {
        gap: 4px !important;
    }

    .sgp-product-card {
        padding: 8px;
    }

    .sgp-card-title {
        font-size: 10px;
        min-height: 2.6em;
    }

    .sgp-add-to-cart {
        font-size: 9px;
        padding: 6px 8px;
    }

    .sgp-side-banner {
        height: 150px;
    }
}
