/* Lavi Brand - Customer Storefront CSS v11.0
   CRITICAL FIX: Modal Image Full Visibility & Layout Re-scaling
    соціальна Media Update Included. No lines removed.
*/

/* [نظام الألوان الجديد - مطابق للوجو تماماً] */
:root {
    --logo-pink: #F8C8DC;       /* اللون السيمون الرئيسي من اللوجو */
    --logo-pink-light: #FCE6F0; /* درجة فاتحة للعناصر الثانوية والحدود */
    --gold: #c5a059;            /* اللون الذهبي من الشماعة - ملكي */
    --dark: #111111;            /* الأسود الفخم من كلمة Lavi */
    --dark-ebony: #111111;      /* الأسود الفخم (تسمية بديلة للتوافق) */
    --white: #ffffff;           /* الأبيض الصريح للخلفيات */
    --white-pure: #ffffff;      /* الأبيض الصريح (تسمية بديلة للتوافق) */
    --gray-bg: #f9f9f9;         /* رمادي خفيف جداً للفصل */
    --gray-soft: #fcfcfc;       /* رمادي شبه معدوم */
    --gray: #888;
    --shadow: 0 10px 30px rgba(0,0,0,0.05);
}

/* 1. التنسيقات العامة */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Cairo', sans-serif; 
}

body { 
    background-color: var(--white-pure); 
    color: var(--dark-ebony);
    overflow-x: hidden; 
    direction: rtl; 
    -webkit-tap-highlight-color: transparent;
}

/* منطق الصفحات المنفصلة */
section {
    display: none; 
    min-height: 100vh;
    padding-top: 100px; 
}

section.active {
    display: block; 
    animation: fadeInPage 0.6s ease-out;
}

@keyframes fadeInPage {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

html {
    scroll-behavior: smooth;
}

.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px; 
}

/* 2. الهيدر (Header) */
.main-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 0;
    position: fixed;
    width: 100%;
    top: 0; 
    z-index: 1000;
    border-bottom: 1px solid var(--logo-pink-light); 
    transition: all 0.3s ease;
}

.main-header.scrolled {
    padding: 10px 0;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.main-header .container { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

/* إجبار اللوجو على اللون الأسود الفخم */
.logo { 
    font-size: 28px; 
    letter-spacing: 3px; 
    color: var(--dark-ebony) !important; 
    font-weight: 700; 
    text-transform: none !important; 
    cursor: pointer;
}

.main-nav a { 
    text-decoration: none; 
    color: var(--dark-ebony); 
    margin: 0 10px; 
    font-weight: 400; 
    transition: 0.3s; 
    cursor: pointer;
    padding-bottom: 5px;
}

.main-nav a:hover { 
    color: var(--gold); 
}

/* [تحديث] تنسيق الرابط النشط في الهيدر */
.main-nav a.active-link {
    color: var(--logo-pink) !important;
    font-weight: 700;
    position: relative;
    border-bottom: 2px solid var(--logo-pink);
}

.main-nav a.active-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 100%;
    height: 2px;
    background-color: var(--logo-pink);
    border-radius: 2px;
}

.cart-icon { 
    font-size: 20px; 
    cursor: pointer; 
    position: relative; 
    color: var(--dark-ebony);
}

#cart-count { 
    background: var(--logo-pink); 
    color: var(--dark-ebony); 
    font-size: 10px; 
    padding: 2px 6px; 
    border-radius: 50%; 
    position: absolute; 
    top: -10px; 
    right: -10px; 
    font-weight: bold;
}

/* 3. واجهة الترحيب (Hero Section) */
.hero {
    height: 100vh; 
    background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), 
                url('https://images.unsplash.com/photo-1490481651871-ab68de25d43d?q=80&w=2070') center/cover;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    text-align: center; 
    color: white; 
    margin-top: 0; 
}

.hero-content h1 { 
    font-size: 3.5rem; 
    margin-bottom: 20px; 
    font-weight: 300; 
}

.btn-gold { 
    display: inline-block;
    background: var(--gold); 
    color: white; 
    padding: 12px 40px; 
    text-decoration: none; 
    border-radius: 30px; 
    transition: 0.3s; 
    border: none;
    cursor: pointer;
}

.btn-gold:hover { 
    background: var(--dark-ebony); 
    transform: translateY(-3px);
}

/* 4. عرض المنتجات (Products) */
.collection { 
    padding: 80px 0; 
}

.section-title { 
    text-align: center; 
    margin-bottom: 50px; 
    font-weight: 300; 
    font-size: 2.5rem;
    position: relative;
    color: var(--dark-ebony);
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--logo-pink); 
    margin: 15px auto;
}

.products-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    gap: 20px; 
    padding: 20px 0;
}

.product-card {
    background: var(--white-pure);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    border: 1px solid var(--logo-pink-light);
    position: relative;
}

.product-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 15px 30px rgba(248, 200, 220, 0.2);
}

.product-image-wrapper {
    position: relative;
    padding-bottom: 130%; 
    overflow: hidden;
    background: var(--gray-soft);
}

.product-image-wrapper img { 
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; 
    transition: transform 0.6s;
}

.product-card:hover .product-image-wrapper img {
    transform: scale(1.06);
}

.product-info { 
    padding: 15px; 
    text-align: center; 
}

.product-category {
    font-size: 11px;
    color: var(--logo-pink); 
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    display: block;
}

.product-title { 
    font-size: 16px; 
    font-weight: 700; 
    color: var(--dark-ebony); 
    margin-bottom: 8px;
}

.product-price { 
    font-size: 15px; 
    color: var(--dark-ebony); 
    font-weight: 700; 
}

.add-hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--logo-pink);
    font-weight: 600;
    opacity: 0;
    transform: translateY(10px);
    transition: 0.3s;
}

.product-card:hover .add-hint {
    opacity: 1;
    transform: translateY(0);
}

/* تتبع الطلب (Tracking UI) */
.track-section { 
    padding: 80px 20px; 
    background: var(--white-pure); 
    text-align: center; 
    border-top: 1px solid var(--logo-pink-light); 
}

.track-card { 
    max-width: 700px; 
    margin: 0 auto; 
    padding: 40px; 
    border-radius: 25px; 
    background: white; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.03); 
    border: 1px solid var(--logo-pink-light); 
}

.search-box { display: flex; gap: 10px; margin: 25px 0; }
.search-box input { flex: 1; padding: 15px 20px; border: 1.5px solid var(--logo-pink-light); border-radius: 12px; outline: none; transition: 0.3s; }
.search-box input:focus { border-color: var(--logo-pink); }

.lavi-btn-gold { 
    background: var(--logo-pink); 
    color: var(--dark-ebony); 
    border: none; 
    padding: 15px 30px; 
    border-radius: 12px; 
    cursor: pointer; 
    font-weight: bold; 
    transition: 0.3s; 
}

.lavi-btn-gold:hover { 
    background: var(--dark-ebony); 
    color: white; 
}

.track-timeline { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; position: relative; }
.step { flex: 1; text-align: center; z-index: 2; position: relative; }
.step-icon { width: 45px; height: 45px; background: var(--white-pure); color: #ddd; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; border: 2px solid var(--logo-pink-light); transition: 0.4s; }
.step p { font-size: 12px; color: #999; }

.step-line { display: none; } 

.step.active .step-icon { 
    background: var(--logo-pink); 
    color: var(--dark-ebony); 
    border-color: var(--logo-pink); 
    transform: scale(1.1); 
    box-shadow: 0 0 15px rgba(248, 200, 220, 0.4); 
}
.step.active p { color: var(--dark-ebony); font-weight: bold; }

/* 5. المودال (Order Modal) - **CRITICAL UPDATE FOR IMAGES** */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background-color: rgba(17, 17, 17, 0.9); 
    backdrop-filter: blur(10px);
    align-items: center; 
    justify-content: center;
    overflow-y: auto; /* Allow scrolling on the whole modal on very small screens */
    padding: 20px 0;
}

.modal-content { 
    background: var(--white-pure); 
    width: 90%; 
    max-width: 1000px; /* Increased slightly for better spacing */
    margin: auto; 
    border-radius: 30px; 
    overflow: hidden; 
    display: grid; 
    grid-template-columns: 35% 65%; /* **FIX**: Less space for image, more for data */
    position: relative; 
    animation: modalIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    max-height: 90vh; /* Don't exceed viewport height */
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(50px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.close-modal { 
    position: absolute; 
    top: 20px; left: 20px; 
    font-size: 25px; 
    cursor: pointer; 
    color: var(--logo-pink); 
    transition: 0.3s; 
    z-index: 10;
}

/* **FIX**: This ensures the image container is balanced and doesn't scroll */
.modal-left {
    background: var(--gray-soft);
    display: flex;
    flex-direction: column; /* Stack main image and thumbs */
    align-items: center;
    justify-content: space-between; /* Space main and thumbs */
    padding: 20px;
    height: 100%;
}

.modal-left .main-img-wrapper {
    width: 100%;
    flex: 1; /* Take all available space except thumbs */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 20px;
    border-radius: 15px;
}

/* **FIX**: Make the image fully visible and contained, not covered */
.modal-left img.main-order-img { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; /* **FIX**: Shows full image without cutting */
    background: #fdfdfd; /* Pure background to blend contain */
}

/* **FIX**: Thumbs container with scrolling and small size */
.modal-left .sizes-flex { 
    display: flex; 
    gap: 10px; 
    margin: 0; 
    overflow-x: auto; /* **FIX**: Enables horizontal scrolling for thumbs */
    width: 100%;
    padding: 5px;
    scrollbar-width: thin; /* For Firefox */
}

/* Customize scrollbar for thumbs */
.modal-left .sizes-flex::-webkit-scrollbar {
    height: 4px;
}
.modal-left .sizes-flex::-webkit-scrollbar-thumb {
    background: var(--logo-pink);
    border-radius: 10px;
}

/* **FIX**: Balanced and consistent thumbnail size */
.modal-left .size-option.thumb-img { 
    width: 60px; /* Small and consistent */
    height: 60px;
    border-radius: 8px;
    object-fit: cover; /* Thumbs can be covered for consistency */
    border: 2px solid #eee;
    padding: 0;
    flex-shrink: 0; /* Don't shrink them in the flexbox */
}

.modal-left .size-option.thumb-img.selected { 
    border-color: var(--logo-pink);
    transform: translateY(-2px);
}

.modal-right { 
    padding: 40px; 
    text-align: right; 
    overflow-y: auto; /* **FIX**: Scroll form if data is too long */
}
.modal-right h2 { color: var(--dark-ebony); font-weight: 700; margin-bottom: 10px; }
.modal-price-tag { color: var(--logo-pink); font-size: 22px; font-weight: 700; margin-bottom: 20px; }

.lavi-form input, .lavi-form select, .lavi-form textarea {
    width: 100%; 
    padding: 12px; 
    margin-bottom: 15px; 
    border: 1px solid #eee; 
    border-radius: 8px; 
    outline: none;
    font-size: 14px;
}

.lavi-form input:focus { border-color: var(--logo-pink); }

/* Right side sizes selector */
.sizes-flex.data-sizes { display: flex; gap: 10px; margin: 15px 0; flex-wrap: wrap; }
.size-option.data-size { 
    border: 1px solid #eee; 
    padding: 8px 15px; 
    cursor: pointer; 
    border-radius: 5px; 
    transition: 0.3s;
    background: #fff;
}

.size-option.data-size.selected { 
    background: var(--logo-pink); 
    color: var(--dark-ebony); 
    border-color: var(--logo-pink); 
    font-weight: bold;
}

/* زر التأكيد النهائي */
#main-checkout-form button[type="submit"] {
    background: var(--dark-ebony);
    color: white;
    padding: 18px;
    border-radius: 50px;
    width: 100%;
    border: none;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

#main-checkout-form button[type="submit"]:hover {
    background: var(--logo-pink);
    color: var(--dark-ebony);
}

.payment-info {
    margin-top: 20px;
    padding: 15px;
    background: var(--logo-pink-light);
    border-radius: 10px;
    border: 1px dashed var(--gold);
}

.custom-file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border: 1.5px dashed var(--gold);
    border-radius: 8px;
    cursor: pointer;
    background: white;
    transition: 0.3s;
    color: var(--gold);
    text-align: center;
}

/* 6. سلة المشتريات */
.cart-summary-box { 
    background: var(--white-pure); 
    padding: 25px; 
    border-radius: 20px; 
    border: 1px solid var(--logo-pink-light); 
}

.cart-total { color: var(--logo-pink); font-weight: 700; }

/* 7. الفوتر (Footer) & السوشيال ميديا */
.main-footer {
    padding: 40px 0;
    text-align: center;
    background: var(--white-pure);
    border-top: 1px solid var(--logo-pink-light);
    margin-top: 50px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
}

.social-links a {
    text-decoration: none;
    color: var(--dark-ebony);
    font-size: 26px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-soft);
    border-radius: 50%;
    border: 1px solid var(--logo-pink-light);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 1;
}

/* انميشن واتساب */
.social-links a.whatsapp-link:hover {
    background: #25D366;
    color: white;
    border-color: #25D366;
    transform: scale(1.2) rotate(8deg);
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.3);
}

/* انميشن انستجرام */
.social-links a.instagram-link:hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    border-color: transparent;
    transform: scale(1.2) rotate(-8deg);
    box-shadow: 0 10px 20px rgba(220, 39, 67, 0.3);
}

/* 8. استعلامات الوسائط (Media Queries) */
@media (max-width: 768px) {
    section { padding-top: 80px; }
    .hero h1 { font-size: 2.2rem; }
    
    .products-grid { 
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
        gap: 15px;
    }
    
    .modal-content { 
        grid-template-columns: 1fr; /* Stack on mobile */
        width: 95%; 
        border-radius: 25px;
        max-height: 85vh; /* Less space for mobile navigation bar */
    }

    /* FIX: Proper sizing for mobile image area */
    .modal-left {
        height: 200px; /* Small enough for thumbs and main to fit stacked */
        padding: 10px;
        justify-content: space-around;
    }
    
    .modal-left .main-img-wrapper {
        margin-bottom: 10px;
    }

    .modal-left .size-option.thumb-img {
        width: 50px;
        height: 50px;
    }
    
    .modal-right { padding: 25px; }

    .track-timeline { flex-direction: column; gap: 30px; align-items: flex-start; padding-right: 20px; }
    .step { display: flex; align-items: center; gap: 15px; text-align: right; }
    .step-icon { margin: 0; }
    
    .step-line { display: none; } 
    .search-box { flex-direction: column; }
    
    .social-links { gap: 15px; }
    .social-links a { width: 45px; height: 45px; font-size: 22px; }
}

.sold-out-card {
    opacity: 0.8;
    filter: grayscale(0.5);
    cursor: not-allowed !important;
}

.sold-out-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4757;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
}