/* ==========================================================================
   Sadias Kitchen — Reusable Food / Product Card
   Components:
     <x-frontend.Product.product-grid>
     <x-frontend.Product.product-card>
   ========================================================================== */

/* ------------------------------- GRID ----------------------------------- */

.sk-product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.sk-product-grid>* {
    min-width: 0;
}

@media (min-width: 425px) {
    .sk-product-grid {
        gap: 10px;
    }
}

@media (min-width: 768px) {
    .sk-product-grid {
        gap: 14px;
    }
}

@media (min-width: 1024px) {
    .sk-product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (min-width: 1200px) {
    .sk-product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 18px;
    }
}

/* ------------------------------- CARD ----------------------------------- */

.sk-product-card {
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    container-type: inline-size;
    background: #fff;
    border: 1px solid #edf0f4;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.05);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.35s ease;
}

.sk-product-card:focus-visible {
    outline: 2px solid rgba(236, 26, 35, 0.5);
    outline-offset: 2px;
}

/* -------------------------------- MEDIA --------------------------------- */

.sk-product-card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f4f5f7;
    flex: 0 0 auto;
}

.sk-product-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ------------------------------- BADGES --------------------------------- */

.sk-product-card__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: calc(100% - 16px);
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #343a40;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.sk-product-card__badge i {
    font-size: 9px;
}

.sk-product-card__badge--offer {
    left: auto;
    right: 8px;
    background: linear-gradient(135deg, #ec1a23 0%, #ff4757 100%);
    color: #fff;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(236, 26, 35, 0.35);
}

.sk-product-card__soldout {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: grayscale(1) blur(1px);
    backdrop-filter: grayscale(1) blur(1px);
    color: #495057;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

/* -------------------------------- BODY ---------------------------------- */

.sk-product-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    padding: 8px;
}

.sk-product-card__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    height: 2.7em;
    margin: 0;
    overflow: hidden;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.1px;
    word-break: break-word;
}

.sk-product-card__desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    margin: 4px 0 0;
    overflow: hidden;
    color: #8b93a3;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
}

/* --------------------------- PRICE / ACTION ----------------------------- */

.sk-product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
}

.sk-product-card__price {
    display: flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sk-product-card__price .menu-price {
    color: #ec1a23;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.sk-product-card__price del {
    color: #adb5bd;
    font-size: 11px;
    font-weight: 500;
}

.sk-product-card__add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 0 0 auto;
    min-height: 30px;
    padding: 6px 9px;
    border: none;
    border-radius: 6px;
    background: #ec1a23;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(236, 26, 35, 0.22);
    transition: background-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.sk-product-card__add i {
    font-size: 11px;
}

.sk-product-card__add .sk-product-card__label-full {
    display: none;
}

.sk-product-card__add .sk-product-card__icon-check {
    display: none;
}

.sk-product-card__add:disabled {
    background: #adb5bd;
    box-shadow: none;
    cursor: not-allowed;
}

.sk-product-card__add.is-busy {
    opacity: 0.85;
    cursor: progress;
}

.sk-product-card__add.is-added,
.sk-product-card__add.is-added:hover {
    background: #16a34a;
    box-shadow: 0 6px 14px rgba(22, 163, 74, 0.3);
    transform: none;
}

.sk-product-card__add.is-added .sk-product-card__icon-cart {
    display: none;
}

.sk-product-card__add.is-added .sk-product-card__icon-check {
    display: inline;
}

.sk-product-card__add:active {
    transform: scale(0.96);
}

.sk-product-card__add:focus-visible {
    outline: 2px solid rgba(236, 26, 35, 0.55);
    outline-offset: 2px;
}

/* --------------------- HOVER (pointer devices only) ---------------------- */

@media (hover: hover) and (pointer: fine) {

    .sk-product-card:hover {
        z-index: 3;
        transform: translateY(-4px);
        border-color: #f7d3d5;
        box-shadow: 0 14px 28px rgba(17, 24, 39, 0.12);
    }

    .sk-product-card:hover .sk-product-card__media img {
        transform: scale(1.05);
    }

    .sk-product-card:hover .sk-product-card__add,
    .sk-product-card__add:hover {
        background: #c41620;
        box-shadow: 0 6px 14px rgba(236, 26, 35, 0.32);
        transform: translateY(-1px);
    }

    .sk-product-card__add:disabled:hover,
    .sk-product-card:hover .sk-product-card__add:disabled {
        background: #adb5bd;
        box-shadow: none;
        transform: none;
    }
}

/* --------------------- TABLET & DESKTOP (576px+) ------------------------ */

@media (min-width: 576px) {
    .sk-product-card {
        border-radius: 12px;
    }

    .sk-product-card__body {
        padding: 11px;
    }

    .sk-product-card__title {
        font-size: 15px;
    }

    .sk-product-card__desc {
        -webkit-line-clamp: 2;
        line-clamp: 2;
        font-size: 12px;
    }

    .sk-product-card__footer {
        gap: 8px;
        padding-top: 10px;
    }

    .sk-product-card__price .menu-price {
        font-size: 16px;
    }

    .sk-product-card__price del {
        font-size: 12px;
    }

    .sk-product-card__add {
        min-height: 34px;
        padding: 8px 12px;
        font-size: 12.5px;
        gap: 5px;
    }

    .sk-product-card__add i {
        font-size: 12px;
    }

    .sk-product-card__add .sk-product-card__label-full {
        display: inline;
    }

    .sk-product-card__add .sk-product-card__label-short {
        display: none;
    }
}

/* Narrow cards (4-up grids on 1200-1400px screens) drop back to the short
   label so the price is never clipped by the button. */
@container (max-width: 214px) {
    .sk-product-card__add .sk-product-card__label-full {
        display: none;
    }

    .sk-product-card__add .sk-product-card__label-short {
        display: inline;
    }
}

/* ------------------- VERY SMALL SCREENS (320px - 425px) ------------------ */

@media (max-width: 424.98px) {
    .sk-product-card__badge {
        top: 6px;
        left: 6px;
        max-width: calc(100% - 12px);
        padding: 3px 6px;
        font-size: 9px;
        gap: 3px;
    }

    .sk-product-card__badge--offer {
        right: 6px;
        left: auto;
    }

    .sk-product-card__body {
        padding: 7px;
    }

    .sk-product-card__footer {
        gap: 4px;
        padding-top: 6px;
    }

    .sk-product-card__price {
        gap: 4px;
    }

    .sk-product-card__price .menu-price {
        font-size: 13px;
    }

    .sk-product-card__price del {
        font-size: 10px;
    }

    .sk-product-card__add {
        gap: 3px;
        min-height: 30px;
        padding: 6px 8px;
        font-size: 11px;
    }

    .sk-product-card__add i {
        font-size: 10px;
    }
}

/* ---------------------------- STATUS TOAST ------------------------------- */

.sk-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 9999;
    max-width: min(92vw, 420px);
    padding: 11px 16px;
    border-radius: 10px;
    background: #1f2937;
    color: #fff;
    font-size: 13.5px;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 14px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    pointer-events: none;
}

.sk-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}
