/**
 * Main Stylesheet — الأساس المشترك لكل الصفحات
 *
 * ما أُزيل من النسخة السابقة ولماذا:
 *  - :root فارغ تماماً بينما الملف يستعمل var(--primary-color) و
 *    var(--text-primary) و var(--shadow-medium) وغيرها — وكلها لم تكن
 *    معرّفة في أي مكان في الموقع. الآن كلها من tokens.css.
 *  - قاعدة `* {}` فارغة.
 *  - أربعون سطراً لتنسيق .gpchild-quick-view-btn يعلوها
 *    `display: none !important` لنفس العنصر.
 *  - تعريفات .perfume-product-card المكرّرة (موجودة في product-card.css).
 *
 * @package GeneratePress_Child
 */

/* ================================== */
/* Base                                */
/* ================================== */

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

/* منع التمرير الأفقي — كان مكتوباً في «CSS إضافي» داخل لوحة ووردبريس */
html,
body {
    overflow-x: hidden;
}

/*
 * خلفية بيضاء للصفحة كلها.
 *
 * جينيريت‌برس يضع body { background: var(--base-2) } وهو رمادي فاتح،
 * وبطاقات المنتجات بيضاء. فكل بطاقة تظهر كمستطيل أبيض على أرضية
 * رمادية — وحين يقلّ محتوى بطاقة (منتج بلا سعر أو بلا أحجام) يقصر
 * مستطيلها فيبدو الصف غير مستوٍ.
 *
 * بخلفية بيضاء تذوب البطاقات في الصفحة ويختفي الفرق.
 *
 * ⚠️ للعودة إلى رمادي جينيريت‌برس: احذف هذه القاعدة وحدها.
 */
body {
    background-color: var(--gp-surface);
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/*
 * box-sizing عام بدل قائمة يدوية بخمسة كلاسات كانت تتكرر مع
 * التعريفات الأصلية في product-card.css و cart.css و top-bar.css.
 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* أداة مساعدة: نص لقارئ الشاشة فقط */
.gp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ================================== */
/* Loading                             */
/* ================================== */

/*
 * ⚠️ إصلاح: كان المؤشر `border: 2px solid #fff` — دائرة بيضاء فوق
 * خلفية المودال البيضاء، أي غير مرئية إطلاقاً. هذا سبب «المربع الأبيض»
 * الذي يراه الزبون أثناء انتظار بيانات المنتج.
 */
.is-loading {
    position: relative;
    pointer-events: none;
}

.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid var(--gp-border);
    border-top-color: var(--gp-brand);
    border-radius: 50%;
    animation: gp-rotate .7s linear infinite;
    z-index: var(--gp-z-badge);
}

@keyframes gp-rotate {
    to { transform: rotate(360deg); }
}

/* ================================== */
/* Skeleton — بديل الفراغ الأبيض       */
/* ================================== */

/*
 * يُعرض بحجم المحتوى الحقيقي أثناء الجلب، فيختفي الإحساس بالانتظار
 * ولا تحدث قفزة تخطيط (CLS) عند وصول البيانات.
 */
.gp-skeleton {
    background: linear-gradient(
        90deg,
        var(--gp-surface-sunken) 25%,
        var(--gp-surface-alt) 37%,
        var(--gp-surface-sunken) 63%
    );
    background-size: 400% 100%;
    animation: gp-shimmer 1.2s ease-in-out infinite;
    border-radius: var(--gp-radius-sm);
}

@keyframes gp-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.gp-skeleton--img   { aspect-ratio: 1 / 1; width: 100%; border-radius: var(--gp-radius); }
.gp-skeleton--line  { height: 14px; margin-bottom: var(--gp-space-2); }
.gp-skeleton--line.is-short { width: 55%; }
.gp-skeleton--btn   { height: 46px; border-radius: var(--gp-radius-pill); margin-top: var(--gp-space-4); }

@media (prefers-reduced-motion: reduce) {
    .gp-skeleton { animation: none; }
}

/* ================================== */
/* Cart Icon                           */
/* ================================== */

.gpchild-cart-icon-wrapper {
    position: fixed;
    top: var(--gp-space-5);
    inset-inline-start: var(--gp-space-5);
    z-index: var(--gp-z-sticky);
}

.gpchild-cart-icon {
    background: var(--gp-surface);
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--gp-text);
    position: relative;
    padding: var(--gp-space-3);
    border-radius: 50%;
    box-shadow: var(--gp-shadow-md);
    transition: color var(--gp-transition), transform var(--gp-transition);
}

.gpchild-cart-icon:hover {
    color: var(--gp-brand);
    transform: scale(1.08);
}

.gpchild-cart-count {
    position: absolute;
    top: -5px;
    inset-inline-end: -5px;
    background-color: var(--gp-brand);
    color: var(--gp-text-invert);
    font-size: .7rem;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--gp-radius-pill);
    padding: 0 6px;
    box-shadow: var(--gp-shadow-sm);
}

/* ================================== */
/* تغذية راجعة — بديل الإشعارات العائمة */
/* ================================== */

/*
 * ⚠️ أُزيلت ‎.gpchild-toast‎ و ‎.gpchild-notification‎ من المشروع.
 *
 * الإشعار العائم في زاوية الشاشة يفشل في ثلاثة أمور:
 *   ١. يظهر بعيداً عن الزر الذي نظر إليه الزبون وضغطه
 *   ٢. يغطّي محتوى الصفحة (وعلى الموبايل يغطّي جزءاً كبيراً)
 *   ٣. يختفي بعد ٣ ثوانٍ — من نظر بعيداً لا يراه إطلاقاً
 *
 * البديل هنا: الزر نفسه يتكلّم، والخطأ يُكتب تحته مباشرة.
 */

/* ── حالة الانتظار: مؤشّر صغير بجانب النص، بلا قفزة تخطيط ── */
button.is-busy {
    opacity: .8;
    cursor: progress;
}

button.is-busy::after {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-inline-start: .6em;
    vertical-align: -.15em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: gp-rotate .7s linear infinite;
}

/*
 * !important مقصود: أزرار السلة تحمل تنسيقات متخصّصة عالية الأولوية
 * في product-quick-view.css و seo-product-page.css. حالة النجاح يجب
 * أن تُرى مهما كان الزر.
 */
button.is-success {
    background: var(--gp-success) !important;
    border-color: var(--gp-success) !important;
    color: var(--gp-text-invert) !important;
}

button.is-error {
    background: var(--gp-danger) !important;
    border-color: var(--gp-danger) !important;
    color: var(--gp-text-invert) !important;
}

@media (prefers-reduced-motion: reduce) {
    button.is-busy::after { animation: none; }
}

/* ── الرسالة السياقية: تحت الأزرار، داخل بطاقة السلة، تحت حقل الخصم ── */
.gp-feedback {
    flex: 0 0 100%;
    width: 100%;
    margin: var(--gp-space-2) 0 0;
    font-size: .875rem;
    line-height: 1.45;
    font-weight: 500;
}

.gp-feedback.is-error   { color: var(--gp-danger); }
.gp-feedback.is-success { color: var(--gp-success); }
.gp-feedback[hidden]    { display: none; }

/* ── نبضة أيقونة السلة: يرى الزبون أين ذهب المنتج ── */
@keyframes gp-cart-bump {
    0%, 100% { transform: scale(1); }
    30%      { transform: scale(1.18); }
    60%      { transform: scale(.94); }
}

.hd-cart-icon.is-bumped,
.gpchild-cart-icon.is-bumped {
    animation: gp-cart-bump .5s ease;
}

@media (prefers-reduced-motion: reduce) {
    .hd-cart-icon.is-bumped,
    .gpchild-cart-icon.is-bumped { animation: none; }
}

/* ================================== */
/* Responsive                          */
/* ================================== */

@media (max-width: 768px) {
    .gpchild-cart-icon-wrapper {
        top: var(--gp-space-3);
        inset-inline-start: var(--gp-space-3);
    }

    .gpchild-cart-icon {
        font-size: 1.3rem;
        padding: var(--gp-space-3);
    }
}

/* ============================================
   حجز مساحة الصور الأجنبية
   ============================================
   ثلاث صور في الصفحة الرئيسية مستضافة على نطاق آخر، فلا يمكن قياس
   أبعادها من السيرفر (القياس يعني طلب شبكة داخل توليد الصفحة).
   وبلا أبعاد يحسب المتصفح ارتفاعها صفراً حتى تصل، ثم يقفز التخطيط.
   نسبها الحقيقية مقيسة: 1328×800 و 1376×768. */
.offers-container-hdo .card-image-hdo,
.banner-img {
    aspect-ratio: 5 / 3;
    width: 100%;
    height: auto;
    object-fit: cover;
}
