/* =========================================
   MODAL & POPUP BASE STYLES
   ========================================= */
.wpb-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6); /* Slightly darker for better focus */
    overflow: auto;
}

.wpb-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.wpb-modal-header {
    padding: 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wpb-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.wpb-modal-close {
    color: #aaa;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.wpb-modal-close:hover {
    color: #000;
}

.wpb-modal-body {
    padding: 20px;
}

.wpb-modal-footer {
    padding: 15px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
    text-align: right;
}

/* =========================================
   NOTE OPTION STYLES
   ========================================= */
.note-custom-title {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.note-textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
}

.note-char-counter {
    text-align: right;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* Shared Note & Exchange Container Styles */
.note-option-container, .exchange-option-container {
    cursor: pointer;
    position: relative;
}

.note-option-container::after, .exchange-option-container::after {
    content: "→";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    font-weight: bold;
    color: #666;
    transition: all 0.2s ease;
}

.note-option-container:hover::after, .exchange-option-container:hover::after {
    transform: translateY(-50%) translateX(3px);
}

.note-option-container:hover, .exchange-option-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.note-option-container.note-added, .exchange-option-container.exchange-added {
    background: rgba(40, 167, 69, 0.2) !important;
    border-color: rgba(40, 167, 69, 0.5) !important;
}

/* =========================================
   EXCHANGE SEARCH STYLES
   ========================================= */
.exchange-search-container {
    margin-bottom: 20px;
}

.exchange-search-wrapper {
    position: relative;
}

.exchange-search-input {
    width: 100%;
    padding: 15px 55px 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 50px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    background-color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.exchange-search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.exchange-search-input::placeholder {
    color: #6c757d;
}

.exchange-search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 20px;
    pointer-events: none;
}

/* =========================================
   EXCHANGE PRODUCT LIST STYLES
   ========================================= */
.exchange-products-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 15px;
}

.exchange-product-item {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.exchange-product-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #28a745, #20c997);
    border-radius: 4px 0 0 4px;
}

.exchange-product-item:hover {
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.exchange-product-item-image {
    width: 100%;
    margin-bottom: 10px;
}

.exchange-product-item-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 8px;
}

.exchange-product-item-info {
    width: 100%;
    margin-bottom: 10px;
}

.exchange-product-item .product-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    height: 2.8em;
}

.exchange-product-item .product-price {
    color: #28a745;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 10px;
}

.exchange-product-item .add-exchange-btn {
    background: linear-gradient(135deg, #00d2d3, #01a3a4);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0, 210, 211, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exchange-product-item .add-exchange-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 210, 211, 0.4);
}

/* =========================================
   EXCHANGE POPUP (PRODUCT DETAILS) STYLES
   ========================================= */
.exchange-product-popup-gallery {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.exchange-product-popup-main-image {
    text-align: center;
    margin-bottom: 15px;
}

.exchange-product-popup-main-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.exchange-product-popup-main-image img:hover {
    transform: scale(1.02);
}

.exchange-product-popup-thumbnails {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.exchange-product-popup-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
}

.exchange-product-popup-thumbnail:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.exchange-product-popup-thumbnail.active {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.exchange-product-popup-details {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.exchange-product-popup-price {
    font-size: 24px;
    font-weight: 700;
    color: #28a745;
    margin-bottom: 15px;
}

.exchange-product-popup-description {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.exchange-product-btn {
    background: linear-gradient(135deg, #00d2d3, #01a3a4);
    color: white;
    border: none;
    padding: 15px 35px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 210, 211, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exchange-product-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 210, 211, 0.5);
}

/* =========================================
   MOBILE EXCHANGE STYLES - FORCED FIX
   ========================================= */

@media (max-width: 768px) {
    
    /* ১. মোডাল সাইজ ফিক্স করা */
    #wpb-exchange-modal .wpb-modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
        height: 90vh !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #wpb-exchange-modal .wpb-modal-body {
        flex: 1 !important;
        padding: 0 !important; 
        overflow-y: hidden !important; 
        display: flex !important;
        flex-direction: column !important;
    }

    /* ২. কন্টেইনার থেকে Inline স্টাইল রিমুভ করা */
    #wpb-exchange-modal .exchange-products-container {
        max-height: none !important; 
        height: 100% !important; 
        padding: 10px !important;
        background: #f8f9fa !important;
        overflow-y: auto !important; 
        border-radius: 0 0 8px 8px !important;
        margin-bottom: 0 !important;
    }

    /* ৩. গ্রিড লেআউট - ২ কলাম ফোর্স করা */
    #wpb-exchange-modal .exchange-products-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 10px !important;
        padding-bottom: 20px !important;
        overflow-y: visible !important;
    }

    /* ৪. এক্সচেঞ্জ আইটেম - বান্ডেল কার্ডের মতো দেখানো */
    #wpb-exchange-modal .exchange-product-item {
        background: #fff !important;
        border: 1px solid #e9ecef !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.08) !important;
        
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 0 !important; 
        transition: transform 0.2s ease !important;
        position: relative !important;
        overflow: hidden !important;
    }

    #wpb-exchange-modal .exchange-product-item::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 3px;
        height: 100%;
        background: linear-gradient(to bottom, #28a745, #20c997);
        border-radius: 4px 0 0 4px;
    }

    /* ইমেজ স্টাইল */
    #wpb-exchange-modal .exchange-product-item-image {
        width: 100% !important;
        margin-bottom: 8px !important;
        background: #fff !important;
    }

    #wpb-exchange-modal .exchange-product-item-image img {
        width: 100% !important;
        aspect-ratio: 1/1 !important;
        object-fit: cover !important;
        border-radius: 8px !important;
        background: #f8f9fa !important;
    }

    /* নাম স্টাইল (২ লাইন) */
    #wpb-exchange-modal .exchange-product-item-info .product-name {
        font-size: 12px !important;
        font-weight: 700 !important;
        margin-bottom: 5px !important;
        color: #333 !important;
        line-height: 1.3 !important;
        height: 2.6em !important; 
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
    }

    /* প্রাইস স্টাইল */
    #wpb-exchange-modal .exchange-product-item .product-price {
        color: #28a745 !important;
        font-weight: 700 !important;
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }

    /* বাটন স্টাইল */
    #wpb-exchange-modal .exchange-product-item .add-exchange-btn {
        background: linear-gradient(135deg, #00d2d3, #01a3a4) !important;
        color: white !important;
        border: none !important;
        padding: 8px 15px !important;
        border-radius: 20px !important;
        font-weight: 600 !important;
        font-size: 11px !important;
        cursor: pointer !important;
        width: 100% !important;
        box-shadow: 0 4px 10px rgba(0, 210, 211, 0.2) !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        margin-top: auto !important; 
    }

    /* স্ক্রলবার স্টাইল */
    #wpb-exchange-modal .exchange-products-container::-webkit-scrollbar {
        width: 4px;
    }
    #wpb-exchange-modal .exchange-products-container::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    #wpb-exchange-modal .exchange-products-container::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 4px;
    }
}