/* Gift Module CSS */
.dut-gift-label {
    color: #f8702c;
    font-size: 11px;
    font-weight: 700;
    margin-top: 5px;
    text-transform: uppercase;
    display: block;
}

.dut-gift-badge {
    position: absolute !important;
    top: 20px !important;
    right: -35px !important;
    color: #fff !important;
    width: 140px !important;
    text-align: center !important;
    transform: rotate(45deg) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    padding: 7px 0 !important;
    z-index: 10 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    line-height: 1 !important;
    pointer-events: none;
}

/* Ensure container allows overflow for ribbon */
.woocommerce ul.products li.product,
.product {
    overflow: hidden !important;
    position: relative !important;
}

/* Mobile optimization (< 767px) */
@media (max-width: 767px) {
    .dut-gift-badge {
        top: 15px !important;
        right: -35px !important;
        width: 115px !important;
        font-size: 9px !important;
        padding: 5px 0 !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    }
}

/* Accordion Wrapper & Scroll Limits */
.dut-gift-accordion-wrapper {
    margin: 30px 0;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 550px;
    /* Desktop: ~3 items + 1 open */
    padding-right: 5px;
}

.dut-gift-accordion-wrapper::-webkit-scrollbar {
    width: 6px;
}

.dut-gift-accordion-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

@media (max-width: 768px) {
    .dut-gift-accordion-wrapper {
        max-height: 480px;
        /* Mobile: ~2 items + 1 open */
    }
}

.dut-gift-accordion-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.dut-gift-accordion-item.active {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    border-color: #839d03;
}

.dut-gift-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.05);
    user-select: none;
    transition: background 0.2s;
}

.dut-gift-accordion-header:hover {
    background: #f8fafc;
}

.dut-gift-accordion-header .header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dut-gift-accordion-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1a202c;
}

.dut-gift-accordion-header .count {
    font-size: 12px;
    color: #718096;
    font-weight: 500;
}

.dut-gift-accordion-header .toggle-icon {
    transition: transform 0.3s ease;
    color: #a0aec0;
}

.active .dut-gift-accordion-header .toggle-icon {
    transform: rotate(180deg);
    color: #839d03;
}

.dut-gift-accordion-content {
    border-top: 1px solid #f1f5f9;
}

.dut-gift-accordion-content .dut-gift-selection-box {
    margin: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 20px;
}

.dut-gift-box-header .icon {
    font-size: 24px;
}

.dut-gift-box-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: #1a202c;
}

.dut-gift-carousel-wrapper {
    position: relative;
    width: 100%;
}

/* Premium Carousel Styling */
.dut-gift-carousel {
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 10px;
}

/* Custom Scrollbar for Carousel */
.dut-gift-carousel::-webkit-scrollbar {
    height: 6px;
}

.dut-gift-carousel::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 10px;
}

.dut-gift-carousel::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.dut-gift-carousel::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.dut-gift-carousel:active {
    cursor: grabbing;
}

.dut-gift-carousel.is-dragging {
    scroll-snap-type: none !important;
    scroll-behavior: auto !important;
}

.dut-gift-grid {
    display: flex !important;
    /* Flex row for carousel */
    gap: 15px;
    width: max-content;
    padding: 5px;
}

.dut-gift-card {
    flex: 0 0 160px;
    /* Fixed width for carousel items */
    scroll-snap-align: start;
    background: #fff;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.dut-gift-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border-color: #839d03;
}

.dut-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: #fff;
    border: 1px solid #edf2f7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: 0.3s;
}

.dut-carousel-arrow:hover {
    background: #839d03;
    color: #fff;
    border-color: #839d03;
}

.dut-carousel-arrow.prev {
    left: -16px;
}

.dut-carousel-arrow.next {
    right: -16px;
}

@media (max-width: 768px) {
    .dut-carousel-arrow {
        display: none;
    }

    /* Hide on mobile as swipe is better */
    .dut-gift-carousel {
        cursor: default;
    }
}

.dut-gift-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.dut-gift-name {
    font-size: 13px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 10px;
    display: block;
    height: 40px;
    overflow: hidden;
}

.dut-add-gift-btn {
    display: inline-block;
    background: #3182ce;
    color: #fff;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    transition: 0.2s;
}

.dut-add-gift-btn:hover {
    background: #2c5282;
    color: #fff;
}

/* Minicart Gift Notice */
.dut-mini-cart-gift-notice {
    background: #fff9f0;
    border: 1px solid #fee2d5;
    padding: 15px;
    border-radius: 12px;
    margin: 10px 0 20px;
    border-left: 5px solid #f8702c;
    text-align: center;
    box-shadow: 0 4px 12px rgba(248, 112, 44, 0.1);
}

.dut-mini-cart-gift-notice p {
    margin: 0 0 10px;
    font-weight: 700;
    color: #2d3748;
    font-size: 14px;
}

.dut-btn-view-gift {
    display: inline-block;
    background: #f8702c;
    color: #fff !important;
    padding: 6px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    transition: 0.2s;
}

.dut-btn-view-gift:hover {
    background: #e06020;
    transform: translateY(-1px);
}

/* --- BLIND BAG STYLES --- */
.dut-blind-bag-wrapper {
    text-align: center;
    padding: 10px;
}

.dut-blind-bag-limit-reached {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 20px;
    border-radius: 12px;
    color: #22c55e;
    font-weight: 700;
}

.dut-blind-bag-limit-reached .dashicons {
    font-size: 30px;
    width: 30px;
    height: 30px;
    margin-bottom: 10px;
}

.dut-blind-bag-intro h4 {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 800;
    color: #2b6cb0;
}

.dut-blind-bag-intro p {
    margin: 0 0 20px;
    font-size: 13px;
    color: #4a5568;
}

.dut-blind-bag-grid {
    display: grid;
    grid-template-rows: 1fr;
    grid-auto-flow: column;
    grid-auto-columns: 140px;
    gap: 15px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 10px;
    justify-content: space-around;
}

.dut-blind-bag-grid.multi-row {
    grid-template-rows: repeat(2, 1fr);
}

.dut-blind-bag-grid::-webkit-scrollbar {
    height: 6px;
}

.dut-blind-bag-grid::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 10px;
}

.dut-blind-bag-grid::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.dut-blind-bag-grid::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

@media (max-width: 768px) {

    .dut-blind-bag-grid,
    .dut-blind-bag-grid.multi-row {
        grid-template-rows: 1fr;
    }
}

.dut-blind-bag-item {
    background: linear-gradient(135deg, #fcebbb 0%, #f8b500 100%);
    border-radius: 16px;
    padding: 20px;
    width: 140px;
    box-shadow: 0 10px 20px rgba(248, 181, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 2px solid #fff;
    scroll-snap-align: start;
}

.dut-blind-bag-item:before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.dut-blind-bag-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(248, 181, 0, 0.3);
}

.dut-blind-bag-item:hover:before {
    opacity: 1;
}

.dut-blind-bag-item.shaking {
    animation: dut-bag-shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes dut-bag-shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0) rotate(-2deg);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0) rotate(2deg);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-3px, 0, 0) rotate(-4deg);
    }

    40%,
    60% {
        transform: translate3d(3px, 0, 0) rotate(4deg);
    }
}

.dut-blind-bag-item .bag-visual {
    font-size: 50px;
    margin-bottom: 15px;
    line-height: 1;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.dut-btn-open-bag {
    background: #fff;
    color: #d97706;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 13px;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: 0.2s;
}

.dut-btn-open-bag:hover {
    background: #fffbeb;
    color: #b45309;
}

.dut-blind-bag-item.opened {
    background: #fff;
    border-color: #cbd5e0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: default;
    transform: none;
}

.dut-blind-bag-item.opened:hover {
    transform: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dut-blind-bag-item.opened .bag-result-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    animation: dut-pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes dut-pop-in {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.dut-blind-bag-item.opened .bag-result-name {
    font-size: 11px;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dut-blind-bag-item.opened.special {
    background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
    border-color: #fc8181;
    box-shadow: inset 0 0 0 2px #fc8181, 0 4px 15px rgba(252, 129, 129, 0.2);
}

.dut-blind-bag-item.opened.special .bag-result-name {
    color: #c53030;
}

/* Reclaim UI */
.dut-bag-reclaim-overlay {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.dut-btn-reclaim-bag {
    background: #f8f9fa;
    color: #2d3748;
    border: 1px solid #cbd5e0;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    width: 100%;
}

.dut-btn-reclaim-bag:hover {
    background: #edf2f7;
    border-color: #a0aec0;
    color: #1a202c;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dut-btn-reclaim-bag:active {
    transform: scale(0.98);
}

.dut-btn-reclaim-bag.is-loading {
    opacity: 0.6;
    cursor: wait;
}

/* Fix for greyed out reclaimed items */
.dut-blind-bag-item.opened img[style*="grayscale"] {
    transition: all 0.3s;
}

.dut-blind-bag-item.opened:hover img[style*="grayscale"] {
    filter: grayscale(0%) !important;
    opacity: 1 !important;
}