/**
 * BG Product Bundles - Frontend Styles
 * Author: Sascha Marc Rahn
 */

/* ============================================
   GRID WRAPPER & CONTAINER
   ============================================ */

.bg-bundles-grid-wrapper {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.bg-bundles-grid {
    display: flex;
    gap: 20px;
    position: relative;
}

/* ============================================
   LAYOUT 1: HORIZONTAL SCROLL
   ============================================ */

.bg-bundles-grid.layout-1 {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #f0c800 #333;
}

.bg-bundles-grid.layout-1::-webkit-scrollbar {
    height: 8px;
}

.bg-bundles-grid.layout-1::-webkit-scrollbar-track {
    background: #333;
    border-radius: 4px;
}

.bg-bundles-grid.layout-1::-webkit-scrollbar-thumb {
    background: #f0c800;
    border-radius: 4px;
}

.bg-bundles-grid.layout-1 .bundle-box {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

/* ============================================
   LAYOUT 2: RESPONSIVE GRID
   ============================================ */

.bg-bundles-grid.layout-2 {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.bg-bundles-grid.layout-2 .bundle-box {
    flex: 0 0 auto;
}

/* ============================================
   LAYOUT 3: CAROUSEL/SLIDER
   ============================================ */

.bg-bundles-grid.layout-3 {
    position: relative;
    overflow: hidden;
}

.bg-bundles-grid.layout-3 .bundle-box {
    flex: 0 0 auto;
    transition: transform 0.5s ease;
}

.bundle-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(240, 200, 0, 0.9);
    color: #000;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.bundle-carousel-nav:hover {
    background: #f0c800;
    transform: translateY(-50%) scale(1.1);
}

.bundle-carousel-nav.prev {
    left: 10px;
}

.bundle-carousel-nav.next {
    right: 10px;
}

/* ============================================
   LAYOUT 4: FEATURED + SMALL
   ============================================ */

.bg-bundles-grid.layout-4 {
    flex-wrap: wrap;
}

.bg-bundles-grid.layout-4 .bundle-box:first-child {
    flex: 0 0 calc(60% - 10px);
    min-height: 600px !important;
}

.bg-bundles-grid.layout-4 .bundle-box:not(:first-child) {
    flex: 0 0 calc(40% - 10px);
    min-height: 280px !important;
}

/* ============================================
   BUNDLE BOX - BASE STYLES
   ============================================ */

.bundle-box {
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.bundle-box:hover {
    transform: translateY(-5px);
    border-color: #f0c800;
    box-shadow: 0 0 20px rgba(240, 200, 0, 0.4),
                0 8px 16px rgba(0, 0, 0, 0.4);
}

/* ============================================
   BADGE CONTAINER - NO ANIMATION
   ============================================ */

.bundle-badge-container {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    pointer-events: none;
}

.bundle-badge-image {
    max-width: 80px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.bundle-savings-badge {
    background: linear-gradient(135deg, #ff0000, #ff6600);
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.4);
    white-space: nowrap;
}

/* ============================================
   PRODUCT IMAGE - FIXED SIZE
   ============================================ */

.bundle-image {
    width: 100%;
    height: 250px; /* Default fallback */
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bundle-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.bundle-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    transition: transform 0.3s ease;
}

.bundle-box:hover .bundle-image img {
    transform: scale(1.05);
}

/* ============================================
   CONTENT AREA
   ============================================ */

.bundle-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    background: #1a1a1a;
}

/* ============================================
   LABEL
   ============================================ */

.bundle-label {
    background: linear-gradient(90deg, #f0c800, #ffdd00);
    color: #000;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    align-self: flex-start;
}

/* ============================================
   TITLE
   ============================================ */

.bundle-title {
    margin: 0;
    font-size: 20px;
    line-height: 1.3;
}

.bundle-title a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.bundle-title a:hover {
    color: #f0c800;
}

/* ============================================
   BUNDLE INCLUDES
   ============================================ */

.bundle-includes {
    color: #ccc;
    font-size: 14px;
    line-height: 1.5;
}

.bundle-includes strong {
    display: block;
    margin-bottom: 8px;
    color: #fff;
}

.bundle-includes ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bundle-includes ul li {
    padding: 4px 0 4px 20px;
    position: relative;
}

.bundle-includes ul li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #f0c800;
    font-weight: 700;
}

/* ============================================
   PRICES - BADGE ALIGNED RIGHT
   ============================================ */

.bundle-prices {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 15px 0;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    position: relative;
}

.bundle-regular-price {
    color: #999;
    font-size: 16px;
}

.bundle-regular-price del {
    text-decoration: line-through;
}

.bundle-sale-price {
    color: #ff4444;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* ============================================
   🔥 RABAT BADGE - STØRRE & PULSERENDE
   ============================================ */

/* Rabat badge ved siden af prisen - GUL GRADIENT */
.bundle-sale-price .bundle-savings-badge-inline {
    background: linear-gradient(135deg, #f0c800, #ffdd00);
    color: #000;
    padding: 8px 16px;
    border-radius: 20px;
    /* 
    ⚙️ ÆNDRE STØRRELSE HER:
    Ændre 22px til ønsket størrelse (f.eks. 18px, 20px, 24px)
    */
    font-size: 22px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 8px rgba(240, 200, 0, 0.4);
    /* 
    ⚙️ ÆNDRE ANIMATION HASTIGHED HER:
    Ændre 2s til ønsket varighed (f.eks. 1s, 1.5s, 3s)
    */
    animation: badge-pulse 2s ease-in-out infinite;
}

/* Pulserende animation */
@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 8px rgba(240, 200, 0, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(240, 200, 0, 0.6);
    }
}

.bundle-savings-text {
    color: #00ff00;
    font-size: 14px;
    font-weight: 600;
}

/* ============================================
   STOCK STATUS
   ============================================ */

.bundle-stock-status {
    font-size: 13px;
    font-weight: 600;
}

.bundle-stock-status .in-stock {
    color: #00ff00;
}

.bundle-stock-status .out-of-stock {
    color: #ff0000;
}

.bundle-stock-status .low-stock {
    color: #ff9900;
}

/* ============================================
   ACTIONS
   ============================================ */

.bundle-actions {
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bundle-actions .button {
    width: 100%;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.bundle-quickview-btn {
    background: #333;
    color: #fff;
}

.bundle-quickview-btn:hover {
    background: #444;
    transform: translateY(-2px);
}

.bundle-add-to-cart-btn {
    background: linear-gradient(135deg, #f0c800, #ffdd00);
    color: #000;
}

.bundle-add-to-cart-btn:hover {
    background: linear-gradient(135deg, #ffdd00, #f0c800);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 200, 0, 0.4);
}

/* ============================================
   SHOP/CATEGORY PAGE BADGE OVERLAY
   ============================================ */

.woocommerce-bundle-badge-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    max-width: 60px;
}

.woocommerce-bundle-badge-overlay img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* ============================================
   PRICE WRAPPER (for regular shop loop)
   ============================================ */

.bundle-price-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bundle-savings-badge-small {
    background: #ff0000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    align-self: flex-start;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

@media (max-width: 1200px) {
    .bg-bundles-grid-wrapper {
        max-width: 100%;
    }
    
    .bg-bundles-grid.layout-2 .bundle-box {
        flex: 0 0 calc(50% - 10px);
    }
    
    .bg-bundles-grid.layout-4 .bundle-box:first-child {
        flex: 0 0 100%;
    }
    
    .bg-bundles-grid.layout-4 .bundle-box:not(:first-child) {
        flex: 0 0 calc(33.333% - 14px);
    }
}

@media (max-width: 768px) {
    .bg-bundles-grid.layout-2 .bundle-box {
        flex: 0 0 100%;
    }
    
    .bg-bundles-grid.layout-4 .bundle-box:not(:first-child) {
        flex: 0 0 calc(50% - 10px);
    }
    
    .bundle-image {
        height: 200px;
    }
    
    .bundle-title {
        font-size: 18px;
    }
    
    .bundle-sale-price {
        font-size: 24px;
    }
    
    /* Rabat badge lidt mindre på mobil */
    .bundle-sale-price .bundle-savings-badge-inline {
        font-size: 18px;
        padding: 6px 12px;
    }
    
    .bundle-carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .bg-bundles-grid-wrapper {
        padding: 0 10px;
    }
    
    .bg-bundles-grid {
        gap: 15px;
    }
    
    .bundle-content {
        padding: 15px;
    }
    
    .bundle-actions {
        padding: 0 15px 15px;
    }
    
    .bg-bundles-grid.layout-4 .bundle-box:not(:first-child) {
        flex: 0 0 100%;
    }
    
    /* Rabat badge endnu mindre på små mobiler */
    .bundle-sale-price .bundle-savings-badge-inline {
        font-size: 16px;
        padding: 5px 10px;
    }
}

/* ============================================
   LOADING STATE
   ============================================ */

.bundle-box.loading {
    opacity: 0.6;
    pointer-events: none;
}

.bundle-box.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #333;
    border-top: 4px solid #f0c800;
    border-radius: 50%;
    animation: bundle-loading-spin 1s linear infinite;
}

@keyframes bundle-loading-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   CART & ORDER STYLES
   ============================================ */

/* Bundle Badge in Cart/Order */
.bundle-cart-badge,
.bundle-order-badge {
    display: inline-block;
    background: linear-gradient(90deg, #f0c800, #ffdd00);
    color: #000;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Bundle Price in Cart */
.bundle-cart-price {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bundle-cart-price del {
    color: #999;
    font-size: 14px;
}

.bundle-cart-price ins {
    color: #ff4444;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.bundle-cart-savings {
    color: #00ff00;
    font-weight: 600;
}

/* Bundle Contents in Cart */
.bundle-cart-contents {
    margin: 10px 0 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.bundle-cart-contents-title {
    margin: 0 0 10px;
    color: #333;
    font-size: 14px;
}

.bundle-cart-products-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bundle-cart-products-list li {
    padding: 5px 0;
    color: #666;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bundle-cart-products-list .bundle-product-qty {
    background: #e0e0e0;
    color: #333;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 12px;
}

.bundle-cart-products-list .bundle-product-name {
    flex: 1;
}

/* Bundle Contents in Order */
.bundle-order-contents {
    margin: 15px 0 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.bundle-order-contents-title {
    margin: 0 0 10px;
    color: #333;
    font-size: 14px;
}

.bundle-order-products-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bundle-order-products-list li {
    padding: 5px 0;
    color: #666;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bundle-order-products-list .bundle-product-qty {
    background: #e0e0e0;
    color: #333;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 12px;
}

.bundle-order-products-list .bundle-product-name {
    flex: 1;
}

/* Email Styles (inline) */
.bundle-order-contents table {
    width: 100%;
    border-collapse: collapse;
}

.bundle-order-contents td {
    padding: 5px;
    border: none;
}

/* Notification Toast */
.bundle-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 999999;
    font-size: 15px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.bundle-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.bundle-notification.success {
    background: #00ff00;
    color: #000;
}

.bundle-notification.error {
    background: #ff0000;
    color: #fff;
}

/* Admin Order Page */
.woocommerce-order-items .bundle-order-badge {
    display: inline-block;
    margin-bottom: 5px;
}

/* ============================================
   🔥 COMPACT PRODUCT LIST WITH HOVER ZOOM
   ============================================ */

.bundle-products-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.bundle-product-item-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    transition: background 0.2s ease;
}

.bundle-product-item-compact:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* ============================================
   🔥 HOVER ZOOM PÅ PRODUKTBILLEDER
   ============================================ */

.bundle-product-thumb-compact {
    flex: 0 0 50px;
    width: 50px;
    height: 50px;
    overflow: visible; /* Tillad billede at vokse ud over container */
    position: relative;
    z-index: 1;
}

.bundle-product-thumb-compact img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #333;
    /* 
    ⚙️ ÆNDRE ZOOM EFFEKT HER:
    - transition varighed: 0.3s = hurtig, 0.5s = medium, 0.8s = langsom
    - transform scale: 1.6 = 80x80px, 1.8 = 90x90px, 2.0 = 100x100px
    */
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Hover effekt - KUN på desktop (ikke mobile) */
@media (hover: hover) and (pointer: fine) {
    .bundle-product-thumb-compact:hover img {
        transform: scale(2.0); /* 50px → 80px */
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
        border-color: #f0c800;
        z-index: 999;
        position: relative;
    }
}

.bundle-product-info-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.bundle-product-name-compact {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bundle-product-meta-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.bundle-product-qty-badge {
    background: #f0c800;
    color: #000;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 11px;
}

.bundle-product-price-compact {
    color: #999;
    font-size: 11px;
}

.bundle-more-products {
    padding: 8px;
    text-align: center;
    color: #f0c800;
    font-size: 12px;
    font-weight: 600;
    background: rgba(240, 200, 0, 0.1);
    border-radius: 6px;
    border: 1px dashed #f0c800;
}

/* Remove old bullet list styles from bundle-includes */
.bundle-includes ul {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .bundle-product-item-compact {
        padding: 6px;
    }
    
    .bundle-product-thumb-compact {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
    }
    
    .bundle-product-thumb-compact img {
        width: 40px;
        height: 40px;
    }
    
    /* Zoom effekt justeret til mobile størrelse */
    @media (hover: hover) and (pointer: fine) {
        .bundle-product-thumb-compact:hover img {
            transform: scale(2.0); /* 40px → 70px */
        }
    }
    
    .bundle-product-name-compact {
        font-size: 12px;
    }
}

/* ============================================
   BLACK FRIDAY COUNTDOWN STYLES
   ============================================ */

.bundle-countdown-container {
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    border: 2px solid #f0c800;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 0 20px rgba(240, 200, 0, 0.3);
}

.bundle-countdown-header {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.bundle-countdown-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
}

.countdown-segment {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.countdown-value {
    background: linear-gradient(135deg, #f0c800, #ffdd00);
    color: #000;
    font-size: 32px;
    font-weight: 900;
    padding: 10px 15px;
    border-radius: 8px;
    min-width: 60px;
    box-shadow: 0 4px 8px rgba(240, 200, 0, 0.4);
    font-family: 'Arial Black', sans-serif;
    letter-spacing: -1px;
}

.countdown-label {
    color: #f0c800;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.countdown-separator {
    color: #f0c800;
    font-size: 28px;
    font-weight: 700;
    padding: 0 5px;
    align-self: flex-start;
    margin-top: 10px;
}

.bundle-countdown-footer {
    color: #ffdd00;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

/* Hide cart button when countdown is active */
.bundle-countdown-hidden {
    display: none !important;
}

/* Responsive Countdown */
@media (max-width: 768px) {
    .bundle-countdown-container {
        padding: 15px;
    }
    
    .countdown-value {
        font-size: 24px;
        padding: 8px 12px;
        min-width: 50px;
    }
    
    .countdown-label {
        font-size: 9px;
    }
    
    .countdown-separator {
        font-size: 22px;
    }
    
    .bundle-countdown-header {
        font-size: 12px;
    }
    
    .bundle-countdown-footer {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .bundle-countdown-timer {
        gap: 5px;
    }
    
    .countdown-value {
        font-size: 20px;
        padding: 6px 10px;
        min-width: 45px;
    }
    
    .countdown-label {
        font-size: 8px;
    }
    
    .countdown-separator {
        font-size: 18px;
        padding: 0 3px;
    }
}

/* Countdown Animation */
@keyframes countdown-pulse {
    0%, 100% {
        box-shadow: 0 4px 8px rgba(240, 200, 0, 0.4);
    }
    50% {
        box-shadow: 0 4px 16px rgba(240, 200, 0, 0.6);
    }
}

.countdown-value {
    animation: countdown-pulse 2s ease-in-out infinite;
}

/* When countdown finishes - fade in cart button */
.bundle-add-to-cart-btn:not(.bundle-countdown-hidden) {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}