/* =================================================================== */
/* ==   ✨ QUICK VIEW MODAL - ZERO SPACE Premium Design ✨   == */
/* =================================================================== */


/* Overlay */
#quick-view-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}


#quick-view-modal.show-modal {
    opacity: 1;
    visibility: visible;
}


/* Modal Wrapper */
#modal-content {
    width: 100%;
    max-width: 500px;
    height: 75vh;
    max-height: 700px;
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: #0a0a0a; /* ⭐ خلفية موحدة */
}


#quick-view-modal.show-modal #modal-content {
    transform: scale(1);
}


/* ⭐ Close Button - فوق الصورة */
#modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}


#modal-close-btn:hover {
    background: var(--primary-color, #FF6B6B);
    transform: rotate(90deg) scale(1.05);
}


/* ⭐ Image Background - SMART COVER - NO SPACE */
#modal-image-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 30%; /* ⭐ يغطي كل المساحة إلا الـ panel */
    z-index: 1;
    width: 100%;
    background-size: cover; /* ⭐ cover عشان يملي المساحة */
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #0a0a0a;
    filter: brightness(1.08) contrast(1.03) saturate(1.08);
}


/* ⭐ Elegant Gradient - من النص للأسفل */
#modal-image-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 40%,
        rgba(0, 0, 0, 0.1) 60%,
        rgba(0, 0, 0, 0.4) 80%,
        rgba(0, 0, 0, 0.75) 95%,
        rgba(0, 0, 0, 0.9) 100%
    );
    pointer-events: none;
    z-index: 2;
}


/* إخفاء الـ Layout Container القديم */
#modal-layout-container {
    display: contents;
}


/* ⭐ Content Panel - في الأسفل 30% فقط */
#modal-content-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 4;
    height: 30%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(
        to top,
        rgba(10, 10, 15, 0.98) 35%,
        rgba(10, 10, 15, 0.88) 65%,
        transparent 100%
    );
    padding: 0 28px 24px 28px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}


/* إعادة تنظيم الـ Inner Content */
#modal-content-panel > div:first-child {
    flex-grow: 0 !important;
    overflow-y: visible !important;
    padding: 0 !important;
    margin-bottom: 12px;
}


/* ⭐ Title - Premium */
#modal-title {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    margin: 0 0 8px 0 !important;
    line-height: 1.2 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    letter-spacing: -0.02em;
}


/* ⭐ Description */
#modal-description {
    font-size: 0.875rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
    line-height: 1.5 !important;
    margin: 0 0 12px 0 !important;
    max-height: 60px !important;
    overflow-y: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}


/* Scrollbar */
#modal-description::-webkit-scrollbar {
    width: 4px;
}


#modal-description::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}


#modal-description::-webkit-scrollbar-thumb {
    background: var(--primary-color, #FF6B6B);
    border-radius: 2px;
}


#modal-description::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--primary-color, #FF6B6B) 80%, white);
}


/* ⭐ Add-ons Container */
#modal-addons-container {
    margin-bottom: 12px;
    max-height: 90px;
    overflow-y: auto;
    display: block !important;
    visibility: visible !important;
}


#modal-addons-container::-webkit-scrollbar {
    width: 4px;
}


#modal-addons-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}


#modal-addons-container::-webkit-scrollbar-thumb {
    background: var(--primary-color, #FF6B6B);
    border-radius: 2px;
}


/* ⭐ Footer Section */
#modal-content-panel > div:last-child {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 0 0 0 !important;
    margin: 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent !important;
}


/* Price Section */
#modal-content-panel > div:last-child > div:first-child {
    flex: 1;
}


/* ⭐ Price */
#modal-final-price {
    font-size: 1.625rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    margin: 0 !important;
    display: block !important;
    visibility: visible !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    letter-spacing: -0.01em;
}


/* =================================================================== */
/* ==   ✨ ADD TO CART BUTTON ✨   == */
/* =================================================================== */


#add-to-cart-modal-btn,
.add-to-cart-modal-btn {
    height: 50px;
    padding: 0 1.75rem !important;
    border-radius: 12px !important;
    border: none;
    background: linear-gradient(135deg, var(--primary-color, #FF6B6B) 0%, color-mix(in srgb, var(--primary-color, #FF6B6B) 85%, black) 100%) !important;
    background-image: linear-gradient(135deg, var(--primary-color, #FF6B6B) 0%, color-mix(in srgb, var(--primary-color, #FF6B6B) 85%, black) 100%) !important;
    color: white !important;
    font-size: 0.9375rem !important;
    font-weight: 700 !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}


#add-to-cart-modal-btn:hover,
.add-to-cart-modal-btn:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}


#add-to-cart-modal-btn.added,
.add-to-cart-modal-btn.added {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%) !important;
    background-image: linear-gradient(135deg, #28a745 0%, #1e7e34 100%) !important;
    transform: scale(1.08) !important;
    box-shadow: 0 12px 35px rgba(40, 167, 69, 0.6) !important;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}


#add-to-cart-modal-btn.added::after,
.add-to-cart-modal-btn.added::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
    animation: ripple-success 0.6s ease-out forwards;
    pointer-events: none;
}


@keyframes ripple-success {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}


@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}


#add-to-cart-modal-btn.added,
.add-to-cart-modal-btn.added {
    animation: pulse-green 0.8s ease-out !important;
}


#add-to-cart-modal-btn:disabled,
.add-to-cart-modal-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}


#add-to-cart-modal-btn.error,
.add-to-cart-modal-btn.error {
    background: linear-gradient(135deg, #dc3545 0%, #a71d2a 100%) !important;
    background-image: linear-gradient(135deg, #dc3545 0%, #a71d2a 100%) !important;
    animation: shake 0.5s ease !important;
}


@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-5px); }
}


#add-to-cart-modal-btn i,
.add-to-cart-modal-btn i {
    font-size: 1rem;
    transition: all 0.3s ease;
}


#add-to-cart-modal-btn.added i,
.add-to-cart-modal-btn.added i {
    animation: icon-bounce 0.5s ease;
}


@keyframes icon-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}


/* =================================================================== */
/* ==   Light Mode Support   == */
/* =================================================================== */


body.light-mode #modal-content {
    background: #f5f5f5;
}


body.light-mode #modal-image-container {
    background-color: #f5f5f5;
}


body.light-mode #modal-image-container::after {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 40%,
        rgba(255, 255, 255, 0.15) 60%,
        rgba(255, 255, 255, 0.5) 80%,
        rgba(255, 255, 255, 0.85) 95%,
        rgba(255, 255, 255, 0.95) 100%
    );
}


body.light-mode #modal-content-panel {
    background: linear-gradient(
        to top,
        rgba(255, 255, 255, 0.98) 35%,
        rgba(255, 255, 255, 0.88) 65%,
        transparent 100%
    );
}


body.light-mode #modal-title {
    color: #111 !important;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
}


body.light-mode #modal-final-price {
    color: #111 !important;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
}


body.light-mode #modal-description {
    color: rgba(0, 0, 0, 0.9) !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}


body.light-mode #modal-close-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #111;
    border: 1px solid rgba(0, 0, 0, 0.1);
}


body.light-mode #modal-close-btn:hover {
    background: var(--primary-color, #FF6B6B);
    color: white;
}


body.light-mode #add-to-cart-modal-btn.added,
body.light-mode .add-to-cart-modal-btn.added {
    background: linear-gradient(135deg, #218838 0%, #155724 100%) !important;
    background-image: linear-gradient(135deg, #218838 0%, #155724 100%) !important;
    color: white !important;
}


/* =================================================================== */
/* ==   Body Lock   == */
/* =================================================================== */


body.modal-open {
    overflow: hidden;
}


/* =================================================================== */
/* ==   ⭐ RESPONSIVE   == */
/* =================================================================== */


@media (max-width: 480px) {
    #modal-content {
        max-width: 95%;
        height: 70vh;
        max-height: 650px;
    }
    
    #modal-image-container {
        bottom: 32%; /* ⭐ يتناسب مع الـ panel */
    }
    
    #modal-content-panel {
        height: 32%;
        padding: 0 20px 20px 20px;
    }
    
    #modal-close-btn {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    #modal-title {
        font-size: 1.1875rem !important;
        margin: 0 0 6px 0 !important;
    }
    
    #modal-description {
        font-size: 0.8125rem !important;
        max-height: 55px !important;
        line-height: 1.45 !important;
    }
    
    #modal-addons-container {
        max-height: 75px !important;
    }
    
    #modal-final-price {
        font-size: 1.375rem !important;
    }
    
    #modal-content-panel > div:last-child {
        flex-direction: column;
        gap: 12px;
        padding: 10px 0 0 0 !important;
    }
    
    #add-to-cart-modal-btn,
    .add-to-cart-modal-btn {
        width: 100%;
        justify-content: center;
        height: 48px;
    }
}


@media (min-width: 481px) and (max-width: 768px) {
    #modal-content {
        max-width: 85%;
        height: 72vh;
    }
    
    #modal-image-container {
        bottom: 30%;
    }
    
    #modal-content-panel {
        height: 30%;
    }
    
    #modal-close-btn {
        top: 14px;
        right: 14px;
    }
    
    #modal-title {
        font-size: 1.3125rem !important;
    }
    
    #modal-description {
        font-size: 0.8125rem !important;
    }
}


@media (min-width: 769px) and (max-width: 1024px) {
    #modal-content {
        max-width: 520px;
        height: 74vh;
    }
    
    #modal-image-container {
        bottom: 30%;
    }
    
    #modal-content-panel {
        height: 30%;
    }
}


@media (min-width: 1025px) {
    #modal-content {
        max-width: 550px;
        height: 75vh;
        max-height: 720px;
    }
    
    #modal-image-container {
        bottom: 30%;
    }
    
    #modal-content-panel {
        height: 30%;
    }
}


@media (max-width: 360px) {
    #modal-image-container {
        bottom: 34%;
    }
    
    #modal-content-panel {
        height: 34%;
        padding: 0 16px 18px 16px;
    }
    
    #modal-close-btn {
        top: 10px;
        right: 10px;
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }
    
    #modal-title {
        font-size: 1.0625rem !important;
    }
    
    #modal-description {
        font-size: 0.75rem !important;
        max-height: 50px !important;
    }
}

/* =================================================================== */
/* ==   ⭐ NAVIGATION ARROWS - Swipe Indicators   == */
/* =================================================================== */


/* أسهم التنقل */
.modal-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.7;
}


.modal-nav-arrow:hover {
    opacity: 1;
    background: var(--primary-color, #FF6B6B);
    transform: translateY(-50%) scale(1.1);
}


.modal-nav-arrow:active {
    transform: translateY(-50%) scale(0.95);
}


.modal-nav-arrow.left {
    left: 16px;
}


.modal-nav-arrow.right {
    right: 16px;
}


/* Light Mode */
body.light-mode .modal-nav-arrow {
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    border: 1px solid rgba(0, 0, 0, 0.1);
}


body.light-mode .modal-nav-arrow:hover {
    background: var(--primary-color, #FF6B6B);
    color: white;
}


/* Mobile - أصغر شوية */
@media (max-width: 480px) {
    .modal-nav-arrow {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .modal-nav-arrow.left {
        left: 10px;
    }
    
    .modal-nav-arrow.right {
        right: 10px;
    }
}


/* =================================================================== */
/* ==   ⭐ SWIPE CURSOR   == */
/* =================================================================== */


#modal-content {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}


#modal-content:active {
    cursor: grabbing;
}
