@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling for iOS */
}

html {
    direction: rtl;
    scroll-behavior: smooth;
}

:root {
    /* Refined Color Palette for Fatla - Blue, Gold, Off-White */
    --primary-blue: #1a3a6b;
    --dark-blue: #0f1f3d;
    --gold: #d4af37;
    --light-gold: #e8d4a8;
    --off-white: #fffef0;
    --cream: #f5f1e8;
    --text-main: #1a3a6b;
    --white: #ffffff;
    --soft-shadow: 0 10px 30px rgba(26, 58, 107, 0.08);
    --transition: all 0.3s ease-in-out;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--off-white);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    padding: 0 1.5rem;
    margin: 0 auto;
}

/* Preloader - Enhanced Dynamic Effect */
#preloader {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--off-white) 0%, var(--cream) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 1s ease;
}

.loader-text {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary-blue);
    letter-spacing: 2px;
    animation: glowPulse 2s infinite alternate;
    position: relative;
}

.loader-text::after {
    content: 'جاري تجهيز المنتجات الفاخرة...';
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 400;
    white-space: nowrap;
    opacity: 0.8;
}

@keyframes glowPulse {
    from { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 0px var(--primary-blue)); }
    to { opacity: 0.7; transform: scale(1.05); filter: drop-shadow(0 0 10px rgba(26, 58, 107, 0.2)); }
}

/* Header - Glass Effect on Scroll */
header {
    background: var(--white);
    padding: 1rem 0;
    border-bottom: 2px solid var(--gold);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

header.scrolled {
    padding: 0.6rem 0;
    box-shadow: var(--soft-shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
}

.logo-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-blue);
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--primary-blue);
}

.nav-toggle {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-size: 1.8rem;
    cursor: pointer;
}

/* Navigation Overlay */
nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    height: 100vh;
    background: var(--white);
    display: flex;
    flex-direction: column;
    padding: 6rem 2.5rem;
    gap: 2rem;
    z-index: 999;
    transition: 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    box-shadow: -15px 0 40px rgba(0,0,0,0.1);
}

nav.active {
    right: 0;
}

nav a {
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 800;
    border-bottom: 1px solid rgba(26, 58, 107, 0.05);
    padding-bottom: 0.8rem;
    transition: var(--transition);
}

nav a:hover {
    color: var(--gold);
    padding-right: 10px;
}

/* Hero - Dynamic Entrance */
.hero {
    padding: 5rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 80vh;
    justify-content: center;
    background: linear-gradient(135deg, var(--off-white) 0%, var(--cream) 100%);
}

.hero-logo {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    border: 8px solid var(--gold);
    box-shadow: 0 20px 50px rgba(26, 58, 107, 0.12);
    object-fit: cover;
    margin-bottom: 2rem;
    animation: float 6s ease-in-out infinite;
}

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

.hero h1 {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
}

.hero .tagline {
    font-size: 1.5rem;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: 2px;
}

.hero .description {
    font-size: 1.2rem;
    color: var(--primary-blue);
    margin-bottom: 2rem;
}

.hero .warning {
    color: var(--primary-blue);
    font-weight: 800;
    margin-bottom: 3rem;
    font-size: 1.2rem;
    background: rgba(212, 175, 55, 0.05);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
}

.hero-btns {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    width: 100%;
    max-width: 300px;
}

.cta-button {
    padding: 1.2rem;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.1rem;
    text-align: center;
    transition: var(--transition);
}

.cta-button.primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--dark-blue) 100%);
    color: var(--white);
    box-shadow: 0 10px 25px rgba(26, 58, 107, 0.2);
}

.cta-button.primary:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(26, 58, 107, 0.3);
}

.cta-button.secondary {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.cta-button.secondary:hover {
    background: rgba(26, 58, 107, 0.05);
}

.cta-button.large {
    padding: 1.5rem;
    font-size: 1.2rem;
}

/* Product Section */
#product {
    background-color: var(--off-white);
    padding: 5rem 0;
}

.product-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    justify-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.product-card {
    background: var(--white);
    border-radius: 25px;
    overflow: hidden;
    box-shadow: var(--soft-shadow);
    transition: var(--transition);
    border: 2px solid rgba(212, 175, 55, 0.1);
    max-width: 400px;
    width: 100%;
}

.product-card.clickable {
    cursor: pointer;
}

.product-card.clickable:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(26, 58, 107, 0.15);
    border-color: var(--gold);
}

.product-thumbnail {
    width: 100%;
    height: 350px;
    object-fit: cover;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-transform: translateZ(0); /* Force GPU acceleration on iPhone */
    transform: translateZ(0);
}

.product-info-card {
    padding: 2rem;
    text-align: center;
}

.product-info-card h3 {
    font-size: 1.5rem;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
}

.product-desc {
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 1rem;
}

.click-hint {
    display: inline-block;
    color: var(--primary-blue);
    font-size: 0.9rem;
    background: rgba(212, 175, 55, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin-top: 0.5rem;
}

/* Gallery Modal */
.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    overflow-y: auto;
    padding: 1rem;
}

.gallery-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-modal-content {
    background: var(--white);
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.gallery-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--primary-blue);
    color: var(--white);
    border: none;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.gallery-close:hover {
    background: var(--dark-blue);
}

.gallery-main {
    position: relative;
    width: 100%;
    height: 400px;
    background: var(--cream);
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    opacity: 1;
}

.main-image.switching {
    opacity: 0.5;
    transform: scale(0.98);
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(26, 58, 107, 0.7);
    color: var(--white);
    border: none;
    font-size: 2rem;
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 5;
}

.gallery-nav:hover {
    background: var(--primary-blue);
}

.gallery-nav.prev {
    left: 1rem;
}

.gallery-nav.next {
    right: 1rem;
}

.gallery-thumbnails {
    display: flex;
    gap: 0.8rem;
    padding: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    background: var(--off-white);
}

.thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}

.thumbnail:hover {
    border-color: var(--gold);
    transform: scale(1.05);
}

.thumbnail.active {
    border-color: var(--primary-blue);
    box-shadow: 0 5px 15px rgba(26, 58, 107, 0.2);
}

.gallery-info {
    padding: 2rem;
    background: var(--white);
}

.gallery-info h2 {
    font-size: 1.8rem;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
}

.gallery-price {
    font-size: 1.5rem;
    color: var(--gold);
    font-weight: 900;
    margin-bottom: 1rem;
}

.gallery-description {
    color: var(--text-main);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.gallery-features {
    margin-bottom: 2rem;
}

.gallery-features h3 {
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.gallery-features ul {
    list-style: none;
    display: grid;
    gap: 0.5rem;
}

.gallery-features li {
    color: var(--text-main);
}

/* About Section */
.about-combined {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    background: var(--white);
    padding: 2rem;
    border-radius: 25px;
    box-shadow: var(--soft-shadow);
    border: 1px solid rgba(212, 175, 55, 0.1);
}

.about-img {
    width: 100%;
    border-radius: 20px;
    object-fit: cover;
    transition: var(--transition);
    border: 2px solid var(--gold);
}

.about-img:hover {
    transform: scale(1.02);
}

.about-text-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-main);
}

/* Contact Section */
.contact-combined {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-image-section {
    width: 100%;
}

.contact-img {
    width: 100%;
    border-radius: 20px;
    box-shadow: var(--soft-shadow);
}

.contact-info {
    background: var(--white);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--soft-shadow);
}

.contact-info h3 {
    color: var(--primary-blue);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.contact-info p {
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

.contact-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Page Sections Visibility */
.page-section {
    padding: 4rem 0;
    display: none;
}

.page-section.active {
    display: block;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary-blue);
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold) 0%, transparent 100%);
}

footer {
    padding: 5rem 1.5rem 2rem;
    text-align: center;
    background: var(--white);
    margin-top: 4rem;
    border-top: 2px solid var(--gold);
}

footer p {
    color: var(--primary-blue);
    font-weight: 600;
}

.footer-bottom {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--gold);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .gallery-main {
        height: 300px;
    }
    
    .gallery-nav {
        padding: 0.8rem;
        font-size: 1.5rem;
    }
    
    .gallery-thumbnails {
        gap: 0.5rem;
    }
    
    .thumbnail {
        width: 60px;
        height: 60px;
    }
}
/* منع تحديث الصفحة عند السحب وتوسيط الصور */
.gallery-modal {
    overscroll-behavior: contain; /* يمنع الـ Pull-to-refresh */
    display: none;
    align-items: center;
    justify-content: center;
}

.gallery-modal.active {
    display: flex;
}

.gallery-modal-content {
    max-height: 90vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-image {
    width: 100%;
    max-height: 50vh; /* يضمن ظهور الصورة كاملة على الجوال */
    object-fit: contain;
    margin-bottom: 15px;
}
/* تحسين سلاسة التمرير واللمس للجوال */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    /* تفعيل التمرير السلس على آيفون */
    -webkit-overflow-scrolling: touch; 
    /* منع الارتداد المزعج في بعض المتصفحات */
    overscroll-behavior-y: none; 
    /* تحسين أداء الريندر */
    text-rendering: optimizeLegibility;
}

/* إزالة التأخير (300ms) عند الضغط في الجوال */
a, button, .clickable {
    touch-action: manipulation;
    cursor: pointer;
}

/* تسريع الأنميشن باستخدام كرت الشاشة (GPU) */
.page-section, .hero, .product-card, .gallery-modal-content {
    backface-visibility: hidden;
    perspective: 1000px;
    transform: translate3d(0,0,0); /* Hardware Acceleration */
    will-change: transform, opacity;
}

/* تنعيم حركات الـ Hover لتناسب اللمس */
.cta-button, .thumbnail {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
* {
    -webkit-tap-highlight-color: transparent;
}
