/* =========================
   HNNP Gift Offer - Full CSS
   ========================= */

.hnnp-gift-offer,
.hnnp-gift-offer * {
    box-sizing: border-box;
}

/* Box ngoài */
.hnnp-gift-offer {
    width: 100%;
    max-width: 100%;
    margin: 12px 0;
    padding: 12px 14px 16px;
    border-radius: 16px;
    background: #f5f5f7;
    overflow: hidden;
    position: relative;
    isolation: isolate;
}

/* Tiêu đề */
.hnnp-gift-offer__heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    color: #1f1f1f;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.hnnp-gift-offer__heading-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
}

/* Icon hộp quà dùng gradient từ snippet: id="blue-grad" */
.hnnp-gift-offer__heading-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

.hnnp-gift-offer__heading-icon svg path {
    fill: url(#blue-grad) !important;
}

/* Slider */
.hnnp-gift-offer__slider {
    position: relative;
    width: 100%;
    max-width: 100%;
    padding: 0 0 16px;
    overflow: hidden;
}

/* Rail desktop */
.hnnp-gift-offer__rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(250px, calc((100% - 12px) / 2));
    gap: 12px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 2px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.hnnp-gift-offer__rail::-webkit-scrollbar {
    display: none;
}

/* Card */
.hnnp-gift-offer__item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 88px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 11px;
    background: #ffffff;
    scroll-snap-align: start;
    overflow: hidden;
}

/* Ảnh / logo */
.hnnp-gift-offer__media {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 52px;
    width: 52px;
    min-width: 52px;
}

.hnnp-gift-offer__image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    min-width: 52px;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    overflow: hidden;
}

.hnnp-gift-offer__image img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.hnnp-gift-offer__image--empty {
    background: #f3f4f6;
}

/* Nội dung */
.hnnp-gift-offer__content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}

.hnnp-gift-offer__title {
    display: -webkit-box;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    color: #333333;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.32;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.hnnp-gift-offer__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    margin: 0;
}

/* Badge */
.hnnp-gift-offer__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    max-width: 120px;
    min-width: 0;
    padding: 4px 7px;
    border-radius: 4px;
    background: #e8f0ff;
    color: #315da8;
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Link chi tiết */
.hnnp-gift-offer__link {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 2px;
    color: #3b82f6 !important;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none !important;
    white-space: nowrap;
}

.hnnp-gift-offer__link:hover,
.hnnp-gift-offer__link:focus-visible {
    color: #2563eb !important;
    text-decoration: none !important;
}

.hnnp-gift-offer__link svg {
    display: block;
    width: 12px;
    height: 12px;
}

/* Arrow */
.hnnp-gift-offer__nav {
    position: absolute;
    top: 42%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: #9ca3af;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transform: translateY(-50%);
    transition: opacity 0.2s ease, visibility 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.hnnp-gift-offer__nav:hover {
    background: #ffffff;
    color: #2b5acd;
}

.hnnp-gift-offer__nav--prev {
    left: -12px;
}

.hnnp-gift-offer__nav--next {
    right: -12px;
}

.hnnp-gift-offer__nav svg {
    display: block;
    width: 13px;
    height: 13px;
}

.hnnp-gift-offer__nav:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.hnnp-gift-offer:not(.is-scrollable) .hnnp-gift-offer__nav {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Pagination */
.hnnp-gift-offer__pagination {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 4px;
}

.hnnp-gift-offer__pagination span {
    display: block;
    width: 16px;
    height: 3px;
    border-radius: 999px;
    background: #e5e7eb;
    cursor: pointer;
    transition: width 0.2s ease, background 0.2s ease;
}

.hnnp-gift-offer__pagination span.is-active {
    width: 22px;
    background: #2b5acd;
}

/* Tablet */
@media (max-width: 768px) {
    .hnnp-gift-offer {
        padding: 12px 12px 16px;
        border-radius: 15px;
    }

    .hnnp-gift-offer__heading {
        font-size: 17px;
    }

    .hnnp-gift-offer__rail {
        grid-auto-columns: minmax(245px, 82%);
        gap: 10px;
    }

    .hnnp-gift-offer__item {
        min-height: 86px;
    }
}

/* Mobile: đổi thành 2 cột, không kéo ngang */
@media (max-width: 480px) {
    .hnnp-gift-offer {
        margin: 10px 0;
        padding: 12px;
        border-radius: 14px;
    }

    .hnnp-gift-offer__heading {
        margin-bottom: 10px;
        font-size: 16px;
    }

    .hnnp-gift-offer__heading-icon,
    .hnnp-gift-offer__heading-icon svg {
        width: 20px;
        height: 20px;
    }

    .hnnp-gift-offer__slider {
        padding-bottom: 0;
        overflow: visible;
    }

    .hnnp-gift-offer__rail {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-flow: row;
        grid-auto-columns: initial;
        gap: 10px;
        overflow: visible;
        padding: 0;
        scroll-snap-type: none;
    }

    .hnnp-gift-offer__item {
        align-items: center;
        gap: 8px;
        min-height: 78px;
        padding: 9px;
        border-radius: 10px;
    }

    .hnnp-gift-offer__media {
        flex: 0 0 40px;
        width: 40px;
        min-width: 40px;
    }

    .hnnp-gift-offer__image {
        width: 40px;
        min-width: 40px;
        height: 40px;
        border-radius: 7px;
    }

    .hnnp-gift-offer__content {
        justify-content: center;
        gap: 3px;
        min-width: 0;
    }

    .hnnp-gift-offer__title {
        min-height: 0;
        margin: 0;
        font-size: 12.5px;
        line-height: 1.25;
        -webkit-line-clamp: 2;
    }

    .hnnp-gift-offer__meta {
        gap: 5px;
        flex-wrap: wrap;
        justify-content: flex-start;
        margin: 0;
    }

    .hnnp-gift-offer__badge {
    flex: 0 1 auto;
    max-width: 110px;
    padding: 4px 6px;
    font-size: 9px;
    line-height: 1;
}

    .hnnp-gift-offer__link {
        font-size: 11px;
    }

    .hnnp-gift-offer__nav,
    .hnnp-gift-offer__pagination {
        display: none !important;
    }
}

/* Mobile rất nhỏ: nếu 2 cột bị chật thì về 1 cột */
@media (max-width: 360px) {
    .hnnp-gift-offer__rail {
        grid-template-columns: 1fr;
    }

    .hnnp-gift-offer__item {
        min-height: 76px;
    }

    .hnnp-gift-offer__media,
    .hnnp-gift-offer__image {
        flex-basis: 38px;
        width: 38px;
        min-width: 38px;
        height: 38px;
    }

    .hnnp-gift-offer__title {
        font-size: 12.5px;
    }
}