/* =========================================================
   Product Quick-View Modal — White Theme
   ========================================================= */

/* ---------- Overlay ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    opacity: 0;
    visibility: hidden;
    z-index: 2500;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

/* ---------- Modal shell ---------- */
.product-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -46%) scale(0.96);
    width: min(1200px, calc(100vw - 40px));
    max-height: 90vh;
    z-index: 2600;
    background: #ffffff;
    border: 1px solid rgba(20, 22, 26, 0.12);
    border-radius: 24px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04) inset;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition:
        opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.45s;
}

.product-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.product-modal::before { display: none; }

/* ---------- Close ---------- */
.modal-close {
    position: absolute;
    top: 16px;
    inset-inline-start: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(20, 22, 26, 0.15);
    background: #f1f2f4;
    color: #4a4d52;
    font-size: 0.95rem;
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 10;
    transition: all var(--transition-base);
}

.modal-close:hover {
    border-color: #000000;
    color: #ffffff;
    background: #000000;
    transform: rotate(90deg);
}

/* ---------- Body grid ---------- */
.modal-body {
    display: grid;
    grid-template-columns: 45% 55%;
    gap: 0;
    max-height: 90vh;
    overflow: hidden;
}

.modal-body > .modal-image {
    overflow: hidden;
}

/* ---------- Image stage ---------- */
.modal-image {
    position: relative;
    min-height: 520px;
    display: grid;
    place-items: center;
    padding: 40px 32px;
    background: #ffffff;
    overflow: hidden;
    isolation: isolate;
}

.modal-image::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 70%;
    background: radial-gradient(ellipse at center, rgba(20, 22, 26, 0.04), transparent 60%);
    filter: blur(30px);
    pointer-events: none;
    z-index: 0;
}

.modal-image::after {
    content: '';
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 24px;
    background: radial-gradient(ellipse at center, rgba(20, 22, 26, 0.08), transparent 70%);
    filter: blur(14px);
    pointer-events: none;
    z-index: 0;
}

.modal-image img {
    position: relative;
    z-index: 1;
    max-width: 78%;
    max-height: 440px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.15));
    animation: modalImgFloat 6s ease-in-out infinite;
}

@keyframes modalImgFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

/* ---------- Info column ---------- */
.modal-info {
    padding: 44px 40px 36px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #4a4d52 transparent;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: #ffffff;
}

.modal-info::-webkit-scrollbar { width: 5px; }
.modal-info::-webkit-scrollbar-thumb { background: #4a4d52; border-radius: 3px; }

.modal-info::before {
    content: '';
    display: block;
    width: 52px;
    height: 1px;
    background: linear-gradient(90deg, #14161a, transparent);
    margin-bottom: 4px;
}

.modal-brand {
    display: none;
}

.modal-info h2 {
    font-family: var(--font-arabic);
    font-size: clamp(1.5rem, 2vw + 1rem, 2.1rem);
    font-weight: 800;
    line-height: 1.25;
    color: #14161a;
    margin: 0;
    letter-spacing: -0.5px;
}

.modal-gender {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(20, 22, 26, 0.15);
    background: rgba(20, 22, 26, 0.05);
    color: #4a4d52;
    font-family: var(--font-arabic);
    font-size: 0.82rem;
    font-weight: 500;
}

.modal-gender i { color: #14161a; font-size: 0.78rem; }

/* Divider */
.modal-info .modal-sizes::before,
.modal-info .modal-quantity::before {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(20, 22, 26, 0.12), transparent);
    margin-bottom: 16px;
}

/* ---------- Sizes ---------- */
.modal-sizes h4,
.modal-quantity h4 {
    font-family: var(--font-arabic);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #8b8e93;
    margin: 0 0 12px;
}

.size-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.size-btn {
    position: relative;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    min-width: 140px;
    padding: 12px 20px;
    border-radius: 14px;
    border: 1px solid rgba(20, 22, 26, 0.15);
    background: #f1f2f4;
    color: #4a4d52;
    font-family: var(--font-arabic);
    cursor: pointer;
    transition: all var(--transition-base);
    overflow: hidden;
}

.size-btn:hover {
    border-color: rgba(20, 22, 26, 0.4);
    color: #14161a;
    transform: translateY(-2px);
    background: #e4e5e7;
}

.size-btn.active {
    border-color: #000000;
    background: #000000;
    color: #ffffff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.15);
}

.size-btn.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 4px;
    inset-inline-end: 6px;
    font-size: 0.55rem;
    color: #ffffff;
}

.size-label {
    font-weight: 700;
    font-size: 0.95rem;
}

.size-price {
    font-weight: 800;
    font-size: 0.95rem;
    color: inherit;
    padding-inline-start: 10px;
    border-inline-start: 1px solid rgba(20, 22, 26, 0.18);
}

/* ---------- Quantity ---------- */
.quantity-control {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 4px;
    border-radius: 14px;
    border: 1px solid rgba(20, 22, 26, 0.15);
    background: #f1f2f4;
    width: max-content;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #4a4d52;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.qty-btn:hover {
    background: #000000;
    color: #ffffff;
}

.qty-value {
    min-width: 48px;
    text-align: center;
    font-family: var(--font-arabic);
    font-weight: 800;
    font-size: 1.05rem;
    color: #14161a;
}

/* ---------- Add to Cart ---------- */
.btn-add-to-cart {
    position: relative;
    margin-top: 6px;
    padding: 16px 24px;
    border: none;
    border-radius: 16px;
    font-family: var(--font-arabic);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #ffffff;
    background: #000000;
    cursor: pointer;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-base);
    z-index: 1;
}

.btn-add-to-cart i { font-size: 1rem; }

.btn-add-to-cart::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.12) 50%, transparent 80%);
    transform: translateX(-100%);
    transition: transform 0.7s ease;
    z-index: -1;
}

.btn-add-to-cart:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.25);
    background: #1a1a1a;
}

.btn-add-to-cart:hover::before { transform: translateX(100%); }

.btn-add-to-cart:active { transform: translateY(-1px); }

/* ---------- Trust row ---------- */
.modal-trust {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 14px;
    padding-top: 16px;
    border-top: 1px dashed rgba(20, 22, 26, 0.12);
}

.modal-trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    color: #8b8e93;
    font-family: var(--font-arabic);
    font-size: 0.72rem;
    line-height: 1.4;
    min-width: 0;
}

.modal-trust-item span {
    display: block;
    white-space: normal;
    word-break: keep-all;
}

.modal-trust-item i {
    color: #14161a;
    font-size: 0.95rem;
}

/* ---------- Mobile (bottom sheet) ---------- */
@media (max-width: 768px) {
    .product-modal {
        top: auto;
        bottom: 0;
        left: 0;
        transform: translateY(100%);
        width: 100%;
        max-width: 100%;
        max-height: 92dvh;
        border-radius: 28px 28px 0 0;
        border-bottom: 0;
    }

    .product-modal.active {
        transform: translateY(0);
    }

    .product-modal::after {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 44px;
        height: 4px;
        border-radius: 999px;
        background: rgba(20, 22, 26, 0.2);
        z-index: 5;
    }

    .modal-body {
        grid-template-columns: 1fr;
        max-height: 92dvh;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .modal-close {
        top: 22px;
        inset-inline-start: 14px;
        width: 40px;
        height: 40px;
    }

    .modal-image {
        min-height: 0;
        aspect-ratio: 6 / 4;
        max-height: 300px;
        padding: 30px 24px 26px;
    }

    .modal-image img {
        max-width: 62%;
        max-height: 240px;
    }

    .modal-info {
        padding: 26px 26px 32px;
        gap: 16px;
    }

    .modal-info h2 {
        font-size: 1.6rem;
    }

    .modal-gender {
        font-size: 0.92rem;
        padding: 8px 16px;
    }

    .modal-sizes h4,
    .modal-quantity h4 {
        font-size: 0.9rem;
    }

    .size-btn {
        min-width: 100%;
        padding: 14px 22px;
        border-radius: 16px;
    }

    .size-label { font-size: 1.05rem; }
    .size-price { font-size: 1.05rem; }

    .quantity-control { padding: 6px; }

    .qty-btn {
        width: 44px;
        height: 44px;
    }

    .qty-value {
        font-size: 1.15rem;
        min-width: 52px;
    }

    .btn-add-to-cart {
        padding: 16px 24px;
        font-size: 1.1rem;
        border-radius: 18px;
    }

    .modal-trust {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding-top: 16px;
        margin-top: 12px;
    }

    .modal-trust-item {
        font-size: 0.78rem;
        gap: 6px;
    }

    .modal-trust-item i { font-size: 1.05rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .product-modal,
    .modal-overlay,
    .modal-image img,
    .btn-add-to-cart,
    .btn-add-to-cart::before {
        transition: none;
        animation: none;
    }
}
