/* ------------------------------------------------------------------ */
/* Thimze Deals — Frontend styles                                       */
/* ------------------------------------------------------------------ */

/* Slider wrapper — same pattern as packages */
.thimze-deals-wrap {
    position: relative;
    overflow: hidden;
    margin: 0 0 40px;
}

.thimze-deals-grid {
    display: flex;
    flex-direction: row;
    gap: 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: none;
}
.thimze-deals-grid::-webkit-scrollbar { display: none; }

/* Grid mode — used when [thimze_deals layout="grid"] is rendered (e.g.
   inline on the shop archive). Plain responsive grid, no horizontal
   scroll, no carousel arrows. */
.thimze-deals-wrap--grid {
    overflow: visible;
}
.thimze-deals-wrap--grid .thimze-deals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow-x: visible;
    padding-bottom: 0;
}
.thimze-deals-wrap--grid .thimze-deal-card {
    flex: unset;
    min-width: 0;
    max-width: none;
    width: 100%;
}

@media (max-width: 600px) {
    .thimze-deals-wrap--grid .thimze-deals-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__img {
        height: 100px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__body {
        padding: 10px 10px 12px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__name {
        font-size: 13px;
        margin-bottom: 2px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__desc,
    .thimze-deals-wrap--grid .thimze-deal-card__items {
        display: none;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__price-row {
        margin-bottom: 6px;
        gap: 5px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__price {
        font-size: 14px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__original-price {
        font-size: 11px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__discount-pill {
        font-size: 10px;
        padding: 1px 6px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__stock {
        margin-bottom: 6px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__stock-label {
        font-size: 10px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__timer {
        padding: 6px 8px;
        margin-bottom: 8px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__timer-label {
        font-size: 10px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__timer-value {
        font-size: 12px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__btn {
        padding: 8px;
        font-size: 12px;
    }
    .thimze-deals-wrap--grid .thimze-deal-card__badge {
        font-size: 10px;
        padding: 3px 8px;
        top: 6px;
        left: 6px;
    }
}

.thimze-deals__empty {
    text-align: center;
    color: #666;
    padding: 2rem 0;
}

/* Card — fixed width so they sit in a row, same sizing as package cards */
.thimze-deal-card {
    background: #fff;
    border: 1.5px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    flex: 0 0 320px;
    min-width: 320px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.thimze-deal-card:hover {
    border-color: #27c2eb;
    box-shadow: 0 4px 20px rgba(39,194,235,.12);
}

.thimze-deal-card.is-hot {
    border: 2px solid #D85A30;
}

.thimze-deal-card.is-expired {
    opacity: 0.55;
}

/* Slider nav arrows — identical pattern to packages */
.thimze-deals-wrap .thimze-deal-prev,
.thimze-deals-wrap .thimze-deal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #e5e5e5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #000;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: background .15s, border-color .15s, color .15s;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.thimze-deal-prev { left: 0; }
.thimze-deal-next { right: 0; }
.thimze-deal-prev:hover,
.thimze-deal-next:hover { background: #27c2eb; border-color: #27c2eb; color: #fff; }
.thimze-deal-prev.hidden,
.thimze-deal-next.hidden { display: none; }

/* Fade edge when scrollable */
.thimze-deals-wrap::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 8px;
    width: 48px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,.9));
    pointer-events: none;
}
.thimze-deals-wrap.at-end::after { display: none; }

/* Image — taller so it shows better */
.thimze-deal-card__img {
    width: 100%;
    height: 200px;
    background: #f4f4f5;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

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

.thimze-deal-card__img-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #d4d4d8;
    display: block;
}

.thimze-deal-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: #FAECE7;
    color: #993C1D;
}

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

.thimze-deal-card__name {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    margin: 0 0 4px;
    line-height: 1.25;
}

.thimze-deal-card__desc {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px;
    line-height: 1.5;
}

.thimze-deal-card__items {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.thimze-deal-card__items li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: #444;
    padding: 5px 9px;
    background: #f6f8fa;
    border-radius: 6px;
}

.thimze-deal-card__items .thimze-pkg-item-name {
    font-weight: 500;
}

.thimze-deal-card__items .thimze-pkg-item-qty {
    color: #888;
    font-size: 12px;
    white-space: nowrap;
}

.thimze-deal-card__price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.thimze-deal-card__price {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    letter-spacing: -.01em;
}

.thimze-deal-card__original-price {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
}

.thimze-deal-card__discount-pill {
    font-size: 11px;
    font-weight: 600;
    background: #E1F5EE;
    color: #0F6E56;
    padding: 2px 8px;
    border-radius: 20px;
}

.thimze-deal-card__stock {
    margin-bottom: 12px;
}

.thimze-deal-card__stock-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #71717a;
    margin-bottom: 4px;
}

.thimze-deal-card__stock-bar {
    height: 5px;
    background: #f4f4f5;
    border-radius: 4px;
    overflow: hidden;
}

.thimze-deal-card__stock-fill {
    height: 100%;
    border-radius: 4px;
    background: #D85A30;
}

.thimze-deal-card__timer {
    background: #f9fafb;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.thimze-deal-card.is-hot .thimze-deal-card__timer {
    background: #FAECE7;
}

.thimze-deal-card__timer-label {
    font-size: 11px;
    color: #71717a;
}

.thimze-deal-card__timer-value {
    font-size: 14px;
    font-weight: 600;
    color: #18181b;
    font-variant-numeric: tabular-nums;
}

.thimze-deal-card.is-hot .thimze-deal-card__timer-value {
    color: #993C1D;
}

.thimze-deal-card__timer-value.is-urgent {
    color: #993C1D;
}

/* Button — same brand color as Add to cart / package buttons */
.thimze-deal-card__btn {
    margin-top: auto;
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: #27c2eb;
    color: #fff;
    text-align: center;
    box-sizing: border-box;
    min-height: 46px;
    transition: background .15s ease;
}

.thimze-deal-card__btn:hover {
    background: #1a9dbf;
}

.thimze-deal-card__btn:disabled,
.thimze-deal-card__btn.is-disabled {
    background: #f4f4f5;
    color: #a1a1aa;
    cursor: default;
}

.thimze-deal-card__btn.is-loading {
    opacity: 0.7;
    cursor: wait;
}

.thimze-deal-card__btn.is-added {
    background: #27c2eb;
}
.thimze-deal-card__btn.is-added:hover {
    background: #1a9dbf;
}

.thimze-deal-view-cart {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 12px;
    color: #27c2eb;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.thimze-deal-view-cart:hover { color: #1a9dbf; }

/* ── Mobile: cards fit within the screen with side gutters ── */
@media (max-width: 600px) {
    .thimze-deals-wrap {
        overflow: hidden;
        margin-left:  -16px;
        margin-right: -16px;
        padding-top: 0;
    }

    .thimze-deals-grid {
        gap: 10px;
        padding-left: 56px;
        padding-right: 56px;
        scroll-snap-type: x mandatory;
    }

    .thimze-deal-card {
        flex: 0 0 75vw;
        min-width: 75vw;
        max-width: 75vw;
        scroll-snap-align: start;
    }

    .thimze-deal-card__img {
        height: 160px;
    }

    .thimze-deals-wrap .thimze-deal-prev,
    .thimze-deals-wrap .thimze-deal-next {
        display: flex;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 14px;
        z-index: 3;
    }
    .thimze-deal-prev { left: 8px; }
    .thimze-deal-next { right: 8px; }
}
