/**
 * Upsell Popup System - Styles
 * 
 * @package UpsellPopup
 * @version 1.0.0
 */

/* ==========================================================================
   Popup Overlay & Container
   ========================================================================== */

.upsell-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
}

.upsell-popup-overlay.active-popup {
    display: flex !important;
}

body.popup-open {
    overflow: hidden;
}

.upsell-popup-container {
    background: white;
    max-width: 640px;
    width: 90%;
    border-radius: 16px;
    padding: 24px;
    position: relative;
    z-index: 99999;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: 90vh;
}

h3.upsell-popup-title {
    margin: 0;
    text-align: center;
    font-size: 32px !important;
    font-style: normal;
    font-weight: 600 !important;
    line-height: 116% !important;
    letter-spacing: -0.32px;
}

.upsell-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 20px;
    cursor: pointer;
    color: #555;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
}

/* ==========================================================================
   Essential Cross-Sells Section
   ========================================================================== */

.essential-crosssells-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.essential-crosssells-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #000527;
}

.essential-crosssells-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.essential-crosssell-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px 8px 8px;
    background: #E6F2FF;
    border-radius: 16px;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.essential-crosssell-card:hover {
    background: #d4e8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 12, 94, 0.1);
}

.essential-add-to-cart-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.essential-crosssell-left { 
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    width: 70%;
}

.essential-crosssell-image {
    flex-shrink: 0;
    width: 110px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
}

.essential-crosssell-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.essential-crosssell-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
   
}

.essential-crosssell-name {
    margin: 0;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #000527 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.essential-crosssell-right {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    width: 30%;
    justify-content: flex-end;
}

.essential-crosssell-price {
    font-size: 14px;
    font-weight: 600;
    color: #000C5E;
}

.essential-variation-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.essential-variation-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    min-width: 100px;
}

.essential-add-to-cart-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #000c5e;
    color: white;
    border: none;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.essential-add-to-cart-circle:hover:not(:disabled) {
    background: #000947;
    transform: scale(1.05);
}

.essential-add-to-cart-circle:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.essential-add-to-cart-circle.adding {
    pointer-events: none;
}

.essential-add-to-cart-circle.added {
    background: #28a745;
}

/* ==========================================================================
   Upsell Products Grid
   ========================================================================== */

.upsell-products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.upsell-product-item {
    padding: 8px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    background: #E6F2FF;
    gap: 12px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
    justify-content: space-between;
}

.upsell-product-item.selected {
    background: #CCE6FF;
    border: 2px solid #000C5E;
}

.upsell-product-image img {
    height: 135px !important;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px !important;
}

.upsell-product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0px;
}

h4.upsell-product-title a {
    color: #000527;
}

.upsell-product-price {
    color: #000C5E;
    font-weight: 600;
}

.upsell-product-text {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.upsell-add-to-cart {
    background-color: #fff;
    color: #000c5e;
    border: none;
    padding: 4px 0px !important;
}

.upsell-add-to-cart:hover {
    background-color: #000c5e;
    color: #fff;
}

button.upsell-add-to-cart:focus {
    background-color: #fff;
    color: #000c5e;
}

/* ==========================================================================
   Popup Actions
   ========================================================================== */

.upsell-popup-actions {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.upsell-popup-checkout-btn {
    background-color: #000C5E;
    color: white;
    border: none;
    transition: background-color 0.3s;
    width: 50%;
}

.upsell-popup-checkout-btn:hover {
    background-color: #000C5E;
}

.upsell-popup-cancel-btn {
    color: #1D1921;
    transition: background-color 0.3s;
    height: 48px;
    padding: 0px 24px !important;
    justify-content: center;
    align-items: center;
    gap: 8px;
    display: flex;
    border: 2px solid #000C5E;
    font-size: 16px !important;
    font-weight: 500 !important;
    line-height: 120% !important;
    width: 50%;
}

.upsell-popup-cancel-btn:hover {
    background-color: #000C5E;
}

/* ==========================================================================
   Custom Add to Cart Button
   ========================================================================== */

.custom-add-to-cart-section {
    margin: 20px 0;
}

.custom-add-to-cart-section .quantity {
    margin-bottom: 15px;
}

.custom-add-to-cart-button {
    background-color: #000;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 16px;
    width: 100%;
    margin-top: 10px;
}

.custom-add-to-cart-button:hover {
    background-color: #333;
}

.custom-add-to-cart-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Force hide native WooCommerce buttons */
form.cart:not(.custom-cart-form) .single_add_to_cart_button {
    display: none !important;
}

.custom-cart-form {
    margin: 20px 0;
}

.variation-selector {
    margin-bottom: 15px;
}

.variation-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

/* ==========================================================================
   Success Messages
   ========================================================================== */

.upsell-success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #E6F2FF;
    color: #000;
    padding: 12px 24px;
    border-radius: 4px;
    z-index: 999999;
    font-weight: 500;
}

/* ==========================================================================
   Pagination Dots
   ========================================================================== */

.upsell-pagination {
    display: none;
    justify-content: center;
    gap: 8px;
}

.pagination-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ddd;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.pagination-dot.active {
    background-color: #000c5e;
}

.pagination-dot:hover {
    background-color: #000c5e;
    opacity: 0.7;
}

/* ==========================================================================
   Circular Add to Cart Button
   ========================================================================== */

.circular-add-to-cart {
    border-radius: 50%;
    background: #000c5e;
    color: white;
    border: none;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.circular-add-to-cart:hover {
    background: #000c5e;
}

.circular-add-to-cart:focus {
    background: #000c5e;
}

.circular-add-to-cart:active {
    transform: scale(0.95);
}

.circular-add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.circular-add-to-cart.adding {
    pointer-events: none;
}

.circular-add-to-cart.adding::after {
    content: '+';
    position: absolute;
    font-size: 18px;
}

/* ==========================================================================
   Basket Toggle
   ========================================================================== */

.basket-toggle-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.basket-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.basket-icon {
    width: 24px;
    height: 24px;
    filter: brightness(0.3);
}

.basket-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    font-size: 12px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.basket-nav-total {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

/* ==========================================================================
   Basket Slideout
   ========================================================================== */

.basket-slideout {
    position: fixed;
    top: 0;
    right: -500px;
    width: 500px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 9999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    padding: 80px 40px;
    gap: 24px;
}

.basket-slideout.active {
    right: 0;
}

.basket-slideout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.basket-slideout-overlay.active {
    opacity: 1;
    visibility: visible;
}

.basket-slideout-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.basket-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.basket-slideout-header h3 {
    margin: 0;
    font-size: 32px;
    color: #000;
    font-weight: 600;
    font-family: Poppins;
}

.basket-slideout-close {
    border: none;
    font-size: 32px !important;
    color: #000;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.basket-slideout-close:hover,
.basket-slideout-close:focus {
    color: #000c5e;
    background: none;
    outline: none;
}

.basket-slideout-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.basket-item-count {
    font-family: Poppins;
    font-size: 16px;
    font-style: normal;
    font-weight: 600;
    line-height: 120%;
}

.basket-items {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.product-total {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0px 20px 10px;
}

.basket-product,
.item-total {
    font-family: Poppins;
    font-size: 16px;
    font-style: normal;
    font-weight: 600;
    line-height: 120%;
}

.basket-item {
    display: flex;
    flex-direction: row;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #e6f2ff;
}

.basket-item:last-child {
    border-bottom: none;
}

.basket-item-image {
    flex-shrink: 0;
}

.product-thumbnail {
    width: 100px;
    height: 100px !important;
    object-fit: contain;
    border-radius: 8px;
}

.basket-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.basket-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.basket-item-name {
    display: flex;
    gap: 8px;
}

.basket-item-name,
.basket-item-price {
    font-family: Poppins;
    font-size: 16px;
    font-style: normal;
    font-weight: 600;
    line-height: 120%;
}

.basket-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    overflow: hidden;
}

button.remove-bundle {
    border: 0;
}

button.remove-bundle:hover,
button.remove-bundle:focus {
    background: none;
}

span.bundle-toggle {
    cursor: pointer;
}

.bundle-toggle svg {
    transition: transform 0.2s ease;
}

.bundle-toggle.open svg {
    transform: rotate(180deg);
}

.bundle-items-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bundle-sub-item {
    color: #000527;
    font-family: Poppins;
    font-size: 14px;
    font-style: normal;
    font-weight: 600;
    line-height: 120%;
}

.basket-slideout-footer h2 {
    margin: 0;
}

.basket-total {
    font-weight: 600;
}

.basket-slideout-info {
    font-size: 14px;
    color: #666;
    margin: 10px 0;
}

.basket-buttons {
    display: flex;
    gap: 12px;
}

.basket-btn,
.basket-checkout-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.basket-btn {
    background: #fff;
    color: #000c5e;
    border: 2px solid #000c5e;
}

.basket-btn:hover {
    background: #f8f9fa;
}

.basket-checkout-btn {
    background: #000c5e;
    color: #fff;
}

.basket-checkout-btn:hover {
    background: #000947;
}

/* ==========================================================================
   Mobile Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .basket-toggle-container {
        /* Mobile adjustments if needed */
    }
    
    .basket-icon {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 767px) {
    .upsell-popup-container {
        position: relative;
        overflow-x: hidden;
        width: 95%;
        max-width: none;
        padding: 20px;
    }
    
    /* Essential cross-sells become swiper on mobile */
    .essential-crosssells-grid {
        display: flex;
        padding: 0 0 10px 0;
        
    }
    
    .essential-crosssells-grid::-webkit-scrollbar {
        height: 4px;
    }
    
    .essential-crosssells-grid::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    
    .essential-crosssells-grid::-webkit-scrollbar-thumb {
        background: #000c5e;
        border-radius: 10px;
    }
    
    .essential-crosssell-card {
        align-items: flex-start;
    }
    
    .essential-crosssell-left {
        width: 100%;
    }
    
    .essential-crosssell-right {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
    
    .essential-variation-wrapper {
        width: 100%;
        align-items: stretch;
    }
    
    .essential-variation-select {
        width: 100%;
    }
    
    .upsell-products-grid {
        display: flex;
        gap: 16px;
        padding: 0 20px 0 20px;
        margin: 0 -20px 0 -20px;
        position: relative;
    }
    
    .upsell-products-grid::-webkit-scrollbar {
        display: none;
    }
    
    .upsell-products-grid {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    .upsell-product-item {
        flex: 0 0 280px;
     
        min-width: 280px;
    }
    
    .upsell-pagination {
        display: flex !important;
    }
    
    .upsell-popup-actions {
        flex-direction: column;
    }
    
    .upsell-popup-checkout-btn,
    .upsell-popup-cancel-btn {
        width: 100%;
        margin-bottom: 0;
    }
    
    /* Essential Cross-sells Swiper on mobile/tablet */
    .essential-crosssells-grid {
        display: block;
    }
    
    .essential-crosssell-card {
        width: 100%;
    }
}

/* Swiper pagination styling */
.essential-crosssells-section .swiper-pagination {
    position: relative;
    margin-top: 16px;
}

.essential-crosssells-section .swiper-pagination-bullet {
    background: #000c5e;
    opacity: 0.3;
    width: 8px;
    height: 8px;
}

.essential-crosssells-section .swiper-pagination-bullet-active {
    opacity: 1;
}

/* Desktop: Hide pagination, show grid */
@media (min-width: 1025px) {
    .essential-crosssells-section .swiper-pagination {
        display: none;
    }
    
    .essential-crosssells-grid {
        display: grid !important;
    }
}
