/**
 * ag-front-v7.0.css
 * PRESTIGE UI: Apple Glassmorphism + 3D Physics + Liquid Motion
 * نسخة محسّنة للأداء والوضوح على الشاشات المختلفة (ستايل فاتح)
 */

/* ==========================================================================
   1. RESET & GLOBAL
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body.apple-glass-ui {
    margin: 0;
    font-family: var(--ag-font-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    line-height: var(--ag-line-height-md, 1.6);
    color: var(--ag-text-main, #111827);
    background-color: var(--ag-bg-body, #f3f4f6);
}

.ag-container {
    max-width: var(--ag-container-max, 1280px);
    margin-inline: auto;
    padding-inline: clamp(16px, 4vw, 24px);
}

/* ==========================================================================
   2. HERO – Dynamic Ambient Light
   ========================================================================== */
.ag-hero {
    min-height: 100vh;
    background: radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.12), transparent 55%),
                radial-gradient(circle at 100% 100%, rgba(244, 114, 182, 0.16), transparent 55%),
                #f3f4f6;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    color: var(--ag-text-main, #111827);
}

/* Grid layout for hero */
.ag-hero-container {
    position: relative;
    z-index: 1;
}

.ag-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    align-items: center;
    gap: 40px;
    padding-block: clamp(72px, 12vw, 120px);
}

/* Text column */
.ag-hero-text {
    text-align: start;
}

/* Image column */
.ag-hero-image {
    display: flex;
    justify-content: center;
}

/* Hero image glass frame */
.ag-hero-image-inner {
    position: relative;
    max-width: 420px;
    width: 100%;
    border-radius: 30px;
    padding: 18px;
    background:
        radial-gradient(circle at 0 0, rgba(148, 163, 255, 0.32), transparent 60%),
        radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.30), transparent 60%),
        rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.55);
    box-shadow: 0 32px 70px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    overflow: hidden;
}

.ag-hero-image-inner img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #ffffff;
    transform: translate3d(0,0,0);
    transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

.ag-hero-image-inner:hover img {
    transform: scale(1.06) translate3d(0, -6px, 0);
}

/* badges فوق الصورة */
.ag-hero-image-badges {
    position: absolute;
    inset-inline: 18px;
    top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
}

.ag-hero-badge-exclusive,
.ag-hero-badge-sale {
    pointer-events: auto;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #111827;
    background: #f9fafb;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
}

.ag-hero-badge-sale {
    background: linear-gradient(135deg, #ef4444, #fb7185);
    color: #ffffff;
}

/* floating orbs */
.ag-hero::before,
.ag-hero::after {
    content: "";
    position: absolute;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.22;
    z-index: 0;
    animation: ag-orb-float 20s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
    will-change: transform;
}

.ag-hero::before {
    background: radial-gradient(circle, var(--ag-primary, #6366f1) 0%, transparent 70%);
    top: -10%;
    left: -10%;
}

.ag-hero::after {
    background: radial-gradient(circle, var(--ag-accent, #ec4899) 0%, transparent 70%);
    bottom: -10%;
    right: -10%;
    animation-delay: -10s;
}

@keyframes ag-orb-float {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(15vw, 10vh, 0) scale(1.15); }
}

/* hero content blur wrapper (لو مستخدم في الهيدر القديم) */
.ag-hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
    padding-block: clamp(60px, 15vw, 120px);
    backdrop-filter: blur(var(--ag-glass-blur-md, 18px)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--ag-glass-blur-md, 18px)) saturate(160%);
}

/* Hero typography */
.ag-hero-title {
    font-size: clamp(2.5rem, 6.5vw, 4.5rem);
    font-weight: 900;
    line-height: 1.1;
    background: linear-gradient(to bottom, #111827 10%, #4b5563 65%, #9ca3af 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
    margin-bottom: 18px;
}

.ag-hero-title .highlight {
    background: linear-gradient(135deg, #f59e0b, #fde68a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ag-hero-subtitle {
    max-width: 640px;
    margin: 0 auto 28px;
    font-size: var(--ag-font-size-lg, 1.125rem);
    color: #4b5563;
}

/* Hero CTA buttons */
.ag-hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 22px;
}

.ag-btn-hero {
    min-height: 48px;
    padding-inline: 22px;
    border-radius: 999px;
    font-weight: 700;
}

.ag-btn-hero i {
    font-size: 0.9rem;
}

.ag-btn-primary.ag-btn-hero {
    min-width: 210px;
    justify-content: center;
}

.ag-btn-secondary.ag-btn-hero {
    background: rgba(255, 255, 255, 0.85);
    color: #111827;
    border: 1px solid rgba(148, 163, 184, 0.6);
}

.ag-btn-secondary.ag-btn-hero:hover {
    background: #ffffff;
}

/* ==========================================================================
   3. BUTTONS – Liquid Buttons (عام)
   ========================================================================== */
.ag-btn {
    padding: 0.95rem 2.4rem;
    border-radius: var(--ag-radius-pill, 999px);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--ag-transition-smooth, all 0.6s cubic-bezier(0.16, 1, 0.3, 1));
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.ag-btn-primary {
    background-image: linear-gradient(var(--ag-primary-gradient, 135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%));
    color: #ffffff;
    box-shadow: 0 14px 35px rgba(99, 102, 241, 0.45);
}

.ag-btn-primary::after {
    content: "";
    position: absolute;
    inset: -10%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.30), transparent);
    transform: skewX(-20deg) translateX(-160%);
    transition: 0.55s ease-out;
}

.ag-btn-primary:hover::after {
    transform: skewX(-20deg) translateX(160%);
}

.ag-btn-primary:hover {
    transform: translateY(-4px) scale(1.03);
    filter: brightness(1.05);
    box-shadow: 0 22px 55px rgba(99, 102, 241, 0.55);
}

.ag-btn-secondary {
    background: rgba(255, 255, 255, 0.85);
    color: #111827;
    border: 1px solid rgba(148, 163, 184, 0.55);
    backdrop-filter: blur(14px);
}

.ag-btn-secondary:hover {
    background: #ffffff;
    transform: translateY(-3px);
}

/* ==========================================================================
   4. FEATURED SECTION & PRODUCT CARDS (3D Glass)
   ========================================================================== */
.ag-section-featured {
    padding-block: clamp(72px, 11vw, 120px);
    background:
        radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.18), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(244, 114, 182, 0.22), transparent 55%),
        #f3f4f6;
    color: var(--ag-text-main, #111827);
}

.ag-section-title {
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    font-weight: 800;
    background-image: linear-gradient(var(--ag-primary-gradient, 135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin-bottom: 3rem;
}

.ag-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

/* Product card */
.ag-product-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.45);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    border-radius: 22px;
    padding: 20px;
    transition: var(--ag-transition-smooth, all 0.6s cubic-bezier(0.16, 1, 0.3, 1));
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--ag-shadow-soft, 0 10px 25px rgba(15, 23, 42, 0.08));
    isolation: isolate;
}

.ag-product-card::before {
    content: "";
    position: absolute;
    inset: -30%;
    background:
        radial-gradient(circle at 0 0, rgba(99, 102, 241, 0.18), transparent 60%),
        radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.18), transparent 60%);
    opacity: 0;
    transition: opacity 0.6s ease-out;
    z-index: -1;
}

.ag-product-card:hover {
    transform: translateY(-14px);
    border-color: rgba(99, 102, 241, 0.65);
    box-shadow: var(--ag-shadow-strong, 0 22px 45px rgba(15, 23, 42, 0.16));
}

.ag-product-card:hover::before {
    opacity: 1;
}

/* Product image */
.ag-product-image {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 18px;
    background: #ffffff;
}

.ag-product-image img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #ffffff;
    transition: transform 0.7s ease-out;
}

.ag-product-card:hover .ag-product-image img {
    transform: scale(1.08) translate3d(0, -4px, 0);
}

/* titles & price */
.ag-product-title {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--ag-text-main, #111827);
}

.ag-product-title a {
    color: inherit;
    text-decoration: none;
}

.ag-product-title a:hover {
    text-decoration: underline;
}

.ag-product-meta {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.ag-product-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: #22c55e;
    margin-top: auto;
}

/* ==========================================================================
   5. CATEGORIES
   ========================================================================== */
.ag-category-card {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.45);
    transition: var(--ag-transition-smooth, all 0.6s cubic-bezier(0.16, 1, 0.3, 1));
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.ag-category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--ag-shadow-md, 0 20px 60px rgba(15, 23, 42, 0.12));
}

.ag-category-media img {
    width: 100%;
    height: 230px;
    object-fit: cover;
    transition: 0.6s ease-out;
}

.ag-category-card:hover .ag-category-media img {
    filter: brightness(0.9) saturate(115%);
}

/* ==========================================================================
   6. MOBILE OPTIMIZATION (RTL Focus)
   ========================================================================== */

/* Hero + Products – Mobile */
@media (max-width: 900px) {
    /* Hero */
    .ag-hero {
        text-align: center;
    }

    .ag-hero-inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        text-align: center;
        padding-block: 72px;
    }

    .ag-hero-text {
        order: 1;
        text-align: center;
    }

    .ag-hero-image {
        order: 0;
    }

    .ag-hero-image-inner {
        max-width: 320px;
        margin-inline: auto;
        padding: 14px;
        border-radius: 24px;
    }

    .ag-hero-title {
        font-size: 2.2rem;
    }

    .ag-hero-subtitle {
        font-size: 0.95rem;
    }

    .ag-hero-cta {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .ag-btn-hero {
        width: 100%;
        justify-content: center;
    }

    .ag-hero-image-badges {
        inset-inline: 12px;
        top: 12px;
    }

    /* Products grid */
    .ag-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .ag-product-card {
        padding: 14px;
        border-radius: 18px;
    }

    .ag-product-title {
        font-size: 0.92rem;
        font-weight: 500;
        height: 2.7em;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .ag-product-price {
        font-size: 1.05rem;
    }
}

@media (max-width: 600px) {
    .ag-hero-title {
        font-size: 2rem;
    }

    .ag-hero-image-inner {
        max-width: 280px;
    }

    .ag-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
}
