/**
 * Product Quick View Styles - WITH RTL SUPPORT
 * ✅ دعم RTL للغة العربية
 * ✅ تصميم متجاوب
 * ✅ تحسينات للعرض بكل اللغات
 * ✅ زر "أضف إلى السلة" داخل تدفق الصفحة — بدون sticky/fixed
 *
 * @package GeneratePress_Child
 * @since 1.0.9
 */

/* ================================== */
/* منع التمرير عند فتح Modal          */
/* ================================== */

body.modal-open {
    overflow: hidden;
}

/* ================================== */
/* Modal Overlay                       */
/* ================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end !important;
    background-color: transparent;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    padding: 0 !important;
    margin: 0 !important;
}

.modal-overlay.is-visible {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

/* ================================== */
/* Product Container — موبايل         */
/* ✅ عرض كامل 100% — لوحة سفلية ممتدة */
/* ================================== */

.gpchild-qv-container {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 90vh !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #ffffff !important;
    border-radius: 20px 20px 0 0 !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    overflow-y: auto !important;
}

.qv-inner-wrapper {
    width: 100%;
    background-color: #ffffff;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-overlay.is-visible .gpchild-qv-container {
    transform: translateY(0);
}

/* scrollbar للحاوية الداخلية في الموبايل */
@media (max-width: 767px) {
    .qv-inner-wrapper::-webkit-scrollbar { display: none; }
    .qv-inner-wrapper { -ms-overflow-style: none; scrollbar-width: none; }
}

/* ================================== */
/* Close Button                        */
/* ================================== */

.close-modal-btn {
    display: block;
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #fff;
    color: #000;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 1001;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    padding: 0;
}

.close-modal-btn:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

[dir="rtl"] .close-modal-btn {
    right: auto;
    left: 10px;
}

/* ================================== */
/* Image Gallery                       */
/* ================================== */

.image-gallery {
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    /* ✅ FIX MOBILE: overflow:visible حتى لا تُقطع/تختفي الصورة */
    /* الـ qv-inner-wrapper يتولى الـ overflow للكل */
    overflow: visible;
    padding-bottom: 0;
    position: relative;
}

/*
 * ✅ FIX MOBILE: ارتفاع صريح بـ vw لضمان ظهور الصورة دائماً
 * - height: 80vw أكبر من 70vw السابقة لملء أكبر مساحة ممكنة
 * - padding داخلي يُبعد الصورة عن الحواف
 * - لا نستخدم aspect-ratio لأنه يعطي نتائج غير متوقعة داخل flex overflow:hidden
 */
.main-image-container {
    width: 100%;
    height: 80vw;
    max-height: 380px;
    min-height: 200px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

/*
 * ✅ الصورة: width و height بـ 100% تملأ الحاوية
 * object-fit: contain تحافظ على النسب بدون قطع
 */
.main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s;
    display: block;
}

.thumbnails {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 0 20px 20px;
    margin-top: 0;
}

.thumbnail-item {
    width: 55px;
    height: 55px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    background-color: #fff;
}

.thumbnail-item:hover,
.thumbnail-item.active {
    border-color: #000;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ================================== */
/* Product Content Wrapper             */
/* ================================== */

.product-content-wrapper {
    display: flex;
    flex-direction: column;
}

/* ================================== */
/* Product Content                     */
/* ================================== */

.product-content {
    padding: 20px 35px 30px;
}

[dir="rtl"] .product-content {
    text-align: right;
}

.product-title {
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
    line-height: 1.2;
}

.product-desc {
    font-size: 0.95rem;
    color: #000;
    margin-bottom: 40px;
    font-weight: 400;
}

/* ================================== */
/* Details Grid                        */
/* ================================== */

.details-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 12px;
    row-gap: 15px;
    font-size: 0.85rem;
    margin-bottom: 40px;
    text-transform: uppercase;
    align-items: center;
}

.detail-label {
    font-weight: bold;
    white-space: nowrap;
}

.detail-value {
    color: #555;
    text-align: left;
}

[dir="rtl"] .details-grid {
    grid-template-columns: max-content 1fr;
    column-gap: 12px;
    direction: rtl;
}

[dir="rtl"] .detail-label {
    text-align: right;
}

[dir="rtl"] .detail-value {
    text-align: left;
}

/* ================================== */
/* Pack Contents                       */
/* ================================== */

.pack-contents {
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
    margin-bottom: 40px;
}

.pack-title {
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 15px;
    display: block;
}

.content-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
}

.content-item {
    display: flex;
    justify-content: space-between;
    color: #555;
}

.content-name {
    font-weight: bold;
    color: #000;
}

[dir="rtl"] .pack-contents {
    text-align: right;
}

[dir="rtl"] .content-item {
    flex-direction: row-reverse;
}

/* ================================== */
/* Size Selector                       */
/* ================================== */

.size-selector {
    margin-bottom: 35px;
}

.size-label {
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 15px;
    display: block;
}

.size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.size-btn {
    padding: 10px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    background-color: #fff;
    color: #555;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.size-btn:hover {
    border-color: #000;
    background-color: #f9f9f9;
}

.size-btn.selected,
.size-btn.active {
    background-color: #000;
    color: #fff;
    border-color: #000;
}

[dir="rtl"] .size-label {
    text-align: right;
}

[dir="rtl"] .size-options {
    justify-content: flex-end;
}

/* ================================== */
/* Price and Quantity                  */
/* ================================== */

.price-qty-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    margin-bottom: 25px;
}

.modal-overlay .quantity-control {
    display: flex;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
}

.modal-overlay .qty-btn {
    background-color: #f0f0f0;
    border: none;
    color: #000;
    font-size: 1rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
    outline: none;
}

.modal-overlay .qty-btn:hover {
    background-color: #ddd;
}

.modal-overlay .qty-value {
    padding: 0 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.current-price {
    font-size: 2rem;
    font-weight: 700;
    color: #000;
}

[dir="rtl"] .price-qty-section {
    flex-direction: row-reverse;
}

/* ================================== */
/* Buttons Wrapper — IN FLOW          */
/* ================================== */

.cart-buttons-wrapper {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-top: 0;
    margin-bottom: 40px;
    position: static;
}

/* ================================== */
/* Add to Cart Button                  */
/* ================================== */

.add-to-cart-btn {
    flex: 1;
    background-color: #000;
    color: #fff;
    border: none;
    padding: 18px 20px;
    border-radius: 35px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
    outline: none;
    position: static;
    width: auto;
    margin-bottom: 0;
}

.add-to-cart-btn:hover {
    opacity: 0.85;
}

.add-to-cart-btn .heart-icon {
    font-size: 1.3rem;
    margin-inline-start: 8px;
}

/* ================================== */
/* Buy Now Button                      */
/* ================================== */

.buy-now-btn {
    flex-shrink: 0;
    background-color: #fff;
    color: #000;
    border: 2px solid #000;
    padding: 18px 22px;
    border-radius: 35px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    outline: none;
    white-space: nowrap;
    position: static;
}

.buy-now-btn:hover {
    background-color: #000;
    color: #fff;
}

[dir="rtl"] .cart-buttons-wrapper {
    flex-direction: row-reverse;
}

[dir="rtl"] .add-to-cart-btn {
    flex-direction: row-reverse;
}

/* ================================== */
/* Accordion                           */
/* ================================== */

.accordion {
    border-top: 1px solid #e0e0e0;
    margin-top: 20px;
}

.modal-overlay .accordion-item {
    border-bottom: 1px solid #e0e0e0;
}

.modal-overlay .accordion-header {
    width: 100%;
    background: none;
    border: none;
    padding: 25px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    text-align: left;
    outline: none;
}

.modal-overlay .accordion-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: bold;
}

.modal-overlay .accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.6;
    padding-right: 20px;
}

.modal-overlay .accordion-content p {
    padding-bottom: 25px;
    margin: 0;
}

[dir="rtl"] .accordion-header {
    text-align: right;
}

[dir="rtl"] .accordion-content {
    padding-right: 0;
    padding-left: 20px;
    text-align: right;
}

/* Scent Details */
.scent-details {
    padding-bottom: 25px;
}

.scent-row {
    display: flex;
    margin-bottom: 8px;
}

.scent-label {
    font-weight: bold;
    min-width: 60px;
    margin-right: 15px;
    font-size: 0.9em;
    color: #333;
}

.scent-value {
    color: #333;
    font-size: 0.9em;
}

[dir="rtl"] .scent-row {
    direction: rtl;
}

[dir="rtl"] .scent-label {
    margin-right: 0;
    margin-left: 15px;
    text-align: right;
}

[dir="rtl"] .scent-value {
    text-align: left;
}

/* Pack Scent Notes */
.scent-trio-notes {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #f0f0f0;
    border-radius: 5px;
}

.scent-name-title {
    font-weight: bold;
    color: #000;
    text-transform: uppercase;
    margin-bottom: 10px;
    border-bottom: 1px dashed #e0e0e0;
    padding-bottom: 5px;
}

.notes-list {
    display: grid;
    grid-template-columns: 80px 1fr;
    row-gap: 5px;
}

.note-cat {
    font-weight: bold;
    color: #000;
}

[dir="rtl"] .scent-name-title {
    text-align: right;
}

[dir="rtl"] .notes-list {
    grid-template-columns: 80px 1fr;
    direction: rtl;
}

[dir="rtl"] .note-cat {
    text-align: right;
}

/* Icon */
.modal-overlay .icon {
    font-size: 24px;
    font-weight: 300;
    display: inline-block;
    transition: transform 0.3s ease;
    line-height: 1;
}

.modal-overlay .accordion-item.open .icon {
    transform: rotate(45deg);
}

/* ================================== */
/* Desktop Styles (≥768px)            */
/* ================================== */

@media (min-width: 768px) {

    .modal-overlay {
        align-items: center;
        justify-content: center;
    }

    .gpchild-qv-container {
        width: 100% !important;
        max-width: 100% !important;
        height: auto;
        max-height: none;
        overflow: visible;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        transform: translateY(0) scale(0.98);
        opacity: 0;
        transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                    opacity 0.35s ease;
    }

    .modal-overlay.is-visible .gpchild-qv-container {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    .qv-inner-wrapper {
        width: 80%;
        max-width: 1200px;
        height: 85vh;
        max-height: 85vh;
        border-radius: 20px;
        overflow: hidden;
        display: flex;
        flex-direction: row;
        align-items: stretch;
    }

    [dir="rtl"] .qv-inner-wrapper {
        flex-direction: row-reverse;
    }

    .close-modal-btn {
        top: 15px;
        right: 15px;
        background: #fff;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    [dir="rtl"] .close-modal-btn {
        right: auto;
        left: 15px;
    }

    /*
     * ✅ ديسكتوب: image-gallery تتكيف مع ارتفاع المحتوى
     * height: auto + align-self: flex-start بدل height: 100%
     * position: sticky تثبتها عند الأعلى عند التمرير
     */
    .image-gallery {
        width: 50%;
        height: auto;
        flex-shrink: 0;
        align-self: flex-start;
        position: sticky;
        top: 0;
        border-radius: 20px 0 0 20px;
        overflow: hidden;
        padding: 25px 25px 15px;
        display: flex;
        flex-direction: column;
    }

    [dir="rtl"] .image-gallery {
        border-radius: 0 20px 20px 0;
    }

    /*
     * ✅ ديسكتوب: main-image-container يأخذ ارتفاعه من JS
     * via CSS variable --sync-image-height
     */
    .main-image-container {
        width: 100%;
        /* ← إلغاء aspect-ratio في الديسكتوب */
        aspect-ratio: unset;
        height: var(--sync-image-height, 340px);
        min-height: 200px;
        max-height: none;
        padding: 15px;
        box-sizing: border-box;
        transition: height 0.25s ease;
    }

    .thumbnails {
        padding: 15px 0 10px;
        margin-top: 0;
        gap: 12px;
        flex-shrink: 0;
    }

    .thumbnail-item {
        width: 65px;
        height: 65px;
    }

    .product-content-wrapper {
        width: 50%;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .product-content {
        padding: 30px 40px 40px;
        flex-shrink: 0;
    }

    .cart-buttons-wrapper {
        gap: 12px;
        margin-bottom: 50px;
    }

    .add-to-cart-btn {
        padding: 18px 22px;
        margin-bottom: 0;
    }

    .buy-now-btn {
        padding: 18px 22px;
    }

    .price-qty-section {
        margin-top: 25px;
    }

    .product-title {
        font-size: 2rem;
    }

    .current-price {
        font-size: 2rem;
    }

    .details-grid {
        grid-template-columns: max-content 1fr;
        column-gap: 12px;
    }

    [dir="rtl"] .details-grid {
        grid-template-columns: max-content 1fr;
        column-gap: 12px;
    }
}

/* ================================== */
/* Scrollbar Styling                   */
/* ================================== */

@media (min-width: 768px) {
    .product-content-wrapper::-webkit-scrollbar {
        width: 8px;
    }

    .product-content-wrapper::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 10px;
    }

    .product-content-wrapper::-webkit-scrollbar-track {
        background: #f5f5f5;
    }
}

@media (max-width: 767px) {
    .gpchild-qv-container::-webkit-scrollbar {
        display: none;
    }

    .gpchild-qv-container {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* ================================== */
/* Toast Notifications                 */
/* ================================== */

.gpchild-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    font-weight: 500;
    animation: slideInRight 0.3s ease;
}

.gpchild-toast.gpchild-toast-error {
    background: #ef4444;
}

[dir="rtl"] .gpchild-toast {
    right: auto;
    left: 20px;
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-100%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100%); }
}

@keyframes slideOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-100%); }
}

/* إخفاء شريط التمرير */
.product-content-wrapper::-webkit-scrollbar {
    display: none;
}

.product-content-wrapper {
    scrollbar-width: none;
    -ms-overflow-style: none;
}