/* ═══════════════════════════════════════════════════════════
   home.css — الصفحة الرئيسية (Mobile-first)
   يعتمد على متغيرات --fp-* من app-shell.css + theme-obsidian.css
   ═══════════════════════════════════════════════════════════ */

.fp-home { --pad: 16px; }
@media (max-width: 380px) { .fp-home { --pad: 14px; } }

.fp-home .fp-container { padding-inline: var(--pad); }
.fp-home a { color: inherit; text-decoration: none; }
.fp-home img { display: block; max-width: 100%; }

/* عنصر يخرج لحافة الشاشة (للسلايدرز الأفقية) */
.fp-bleed {
    margin-inline: calc(var(--pad) * -1);
    padding-inline: var(--pad);
    scroll-padding-inline: var(--pad);
}

.fp-home :focus-visible { outline: 2px solid var(--fp-primary); outline-offset: 2px; border-radius: 8px; }

/* ═══════════ Hero ═══════════ */
.fp-hero { position: relative; z-index: 2; padding: 14px 0 4px; }
.fp-hero::before {
    content: "";
    position: absolute; inset: 0 0 auto 0; height: 280px;
    background: radial-gradient(120% 100% at 88% 0%, rgba(207, 162, 77, 0.22), transparent 62%);
    pointer-events: none;
}
.fp-hero > .fp-container { position: relative; }

.fp-locate {
    display: flex; align-items: center; gap: 10px;
    width: 100%; max-width: 340px; min-height: 46px;
    padding: 6px 8px 6px 14px;
    background: rgba(21, 24, 36, 0.72);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius-full);
    color: var(--fp-text); font: inherit; text-align: right; cursor: pointer;
    transition: transform .15s, border-color .2s;
}
.fp-locate:active { transform: scale(0.97); }
.fp-locate:disabled { opacity: .6; }
.fp-locate-ico {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--fp-primary-light); color: var(--fp-primary); font-size: 13px;
}
.fp-locate-body { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.fp-locate-label { font-size: 10.5px; color: var(--fp-text-3); font-weight: 600; }
.fp-locate-name { font-size: 13px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-locate-chev { font-size: 10px; color: var(--fp-text-3); }

.fp-hero-hello { margin: 20px 0 0; font-size: 13.5px; font-weight: 600; color: var(--fp-text-2); }
.fp-hero-title {
    margin: 4px 0 0;
    font-family: var(--fp-font-display, 'Tajawal', sans-serif);
    font-size: clamp(27px, 7.6vw, 40px);
    line-height: 1.2; font-weight: 700; letter-spacing: 0;
    color: var(--fp-text);
}

/* ═══════════ Search ═══════════ */
.fp-search {
    position: relative; display: flex; align-items: center; gap: 10px;
    margin-top: 16px; padding: 5px;
    padding-inline-start: 16px;
    background: var(--fp-surface);
    border: 1px solid var(--fp-border-dark);
    border-radius: var(--fp-radius-full);
    box-shadow: var(--fp-shadow);
    transition: border-color .2s, box-shadow .2s;
}
.fp-search:focus-within { border-color: var(--fp-primary); box-shadow: 0 0 0 4px var(--fp-primary-light); }
.fp-search-icon { color: var(--fp-text-3); font-size: 15px; flex-shrink: 0; }
.fp-search input {
    flex: 1; min-width: 0; padding: 11px 0;
    background: transparent; border: 0; outline: 0;
    color: var(--fp-text); /* 16px يمنع زوم iOS */
    font-family: inherit; font-size: 16px; font-weight: 500; line-height: 1.4;
}
.fp-search input::placeholder { color: var(--fp-text-3); }
.fp-search-btn {
    width: 42px; height: 42px; flex-shrink: 0; border: 0; border-radius: 50%;
    display: grid; place-items: center; cursor: pointer;
    background: var(--fp-gold-grad, var(--fp-primary)); color: var(--fp-on-primary, #fff);
    font-size: 14px; box-shadow: 0 4px 14px rgba(207, 162, 77, 0.3);
    transition: transform .15s;
}
.fp-search-btn:active { transform: scale(0.9); }

.fp-sr {
    position: absolute; z-index: 60; top: calc(100% + 8px); inset-inline: 0;
    display: none; max-height: min(60vh, 380px); overflow-y: auto;
    background: var(--fp-surface-2); border: 1px solid var(--fp-border-dark);
    border-radius: 20px; box-shadow: var(--fp-shadow-lg);
}
.fp-sr.active { display: block; }
.fp-sr-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--fp-border);
}
.fp-sr-item:last-child { border-bottom: 0; }
.fp-sr-item:active { background: var(--fp-primary-light); }
.fp-sr-img { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; background: var(--fp-surface); flex-shrink: 0; }
.fp-sr-body { flex: 1; min-width: 0; }
.fp-sr-name { font-size: 14px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-sr-sub { font-size: 11.5px; color: var(--fp-text-3); font-weight: 600; margin-top: 1px; }
.fp-sr-price { font-size: 14px; font-weight: 800; color: var(--fp-primary); flex-shrink: 0; }
.fp-sr-price small { font-size: 10.5px; color: var(--fp-text-3); font-weight: 600; }
.fp-sr-msg { padding: 22px; text-align: center; color: var(--fp-text-3); font-size: 14px; font-weight: 600; }
.fp-sr-msg.err { color: var(--fp-danger); }

/* ═══════════ Quick actions ═══════════ */
.fp-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding-top: 18px; }
.fp-quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; min-height: 44px; }
.fp-quick-ico {
    width: 54px; height: 54px; border-radius: 18px;
    display: grid; place-items: center; font-size: 20px;
    background: var(--fp-surface); border: 1px solid var(--fp-border);
    color: var(--fp-primary); transition: transform .15s, border-color .2s;
}
.fp-quick a:active .fp-quick-ico { transform: scale(0.92); }
.fp-quick-label { font-size: 12px; font-weight: 700; color: var(--fp-text-2); }

/* ═══════════ Sections ═══════════ */
.fp-sec { padding-top: 26px; }
.fp-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.fp-sec-titlebox { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fp-sec-ico {
    width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0;
    display: grid; place-items: center; font-size: 15px;
    background: var(--fp-primary-light); color: var(--fp-primary);
}
.fp-sec-title { margin: 0; font-family: var(--fp-font-display, 'Tajawal', sans-serif); font-size: 21px; line-height: 1.2; font-weight: 700; }
.fp-sec-sub { margin: 2px 0 0; font-size: 12px; color: var(--fp-text-3); font-weight: 600; }
.fp-more {
    display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
    min-height: 40px; padding: 0 12px;
    font-size: 13px; font-weight: 700; color: var(--fp-primary);
    border-radius: var(--fp-radius-full);
}
.fp-more i { font-size: 10px; }
.fp-more:active { background: var(--fp-primary-light); }

/* ═══════════ Ads ═══════════ */
.fp-ads { padding-top: 22px; }
.fp-ads-track {
    display: flex; overflow-x: auto; direction: ltr; /* الحركة الأفقية متسقة مع JS */
    scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    border-radius: 22px; box-shadow: var(--fp-shadow-md);
}
.fp-ads-track::-webkit-scrollbar { display: none; }
.fp-ad { position: relative; flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 16 / 7; min-height: 150px; max-height: 320px; background: var(--fp-surface-2); }
.fp-ad > a, .fp-ad > div { display: block; width: 100%; height: 100%; }
.fp-ad img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fp-ad-overlay {
    position: absolute; inset: 0; direction: rtl; text-align: right;
    display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 8px;
    padding: 16px 18px;
    background: linear-gradient(0deg, rgba(10, 11, 16, 0.88) 0%, rgba(10, 11, 16, 0.25) 55%, transparent 100%);
}
.fp-ad-tag {
    padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 800;
    background: var(--fp-gold-grad, var(--fp-primary)); color: var(--fp-on-primary, #fff);
}
.fp-ad-title { margin: 0; font-family: var(--fp-font-display, 'Tajawal', sans-serif); font-size: 21px; font-weight: 700; line-height: 1.2; color: #fff; }
.fp-ads-dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; direction: ltr; }
.fp-ads-dot { width: 6px; height: 6px; padding: 0; border: 0; border-radius: 999px; background: var(--fp-text-light); cursor: pointer; transition: width .25s, background .25s; }
.fp-ads-dot.active { width: 22px; background: var(--fp-primary); }

/* ═══════════ Categories ═══════════ */
.fp-cats { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; padding-block: 2px 6px; }
.fp-cats::-webkit-scrollbar { display: none; }
.fp-cat {
    flex: 0 0 auto; min-width: 86px; scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; gap: 7px;
    padding: 12px 10px 10px; border-radius: 18px;
    background: var(--fp-surface); border: 1px solid var(--fp-border);
    transition: transform .15s, border-color .2s, background .2s;
}
.fp-cat:active { transform: scale(0.95); }
.fp-cat-ico { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 18px; background: var(--fp-primary-light); color: var(--fp-primary); }
.fp-cat-name { font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.fp-cat-count { font-size: 10.5px; font-weight: 600; color: var(--fp-text-3); }
.fp-cat.active { background: var(--fp-gold-grad, var(--fp-primary)); border-color: transparent; color: var(--fp-on-primary, #fff); box-shadow: 0 8px 22px rgba(207, 162, 77, 0.28); }
.fp-cat.active .fp-cat-ico { background: rgba(10, 11, 16, 0.16); color: var(--fp-on-primary, #fff); }
.fp-cat.active .fp-cat-count { color: rgba(10, 11, 16, 0.7); }

/* ═══════════ Product / Offer cards ═══════════ */
.fp-rail { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; padding-block: 2px 8px; }
.fp-rail::-webkit-scrollbar { display: none; }

.fp-pcard {
    position: relative; flex: 0 0 164px; scroll-snap-align: start;
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--fp-surface); border: 1px solid var(--fp-border); border-radius: 20px;
    transition: transform .15s, border-color .2s;
}
.fp-pcard:active { transform: scale(0.98); }
.fp-pcard--offer { flex-basis: 214px; }
.fp-pcard-link { display: block; flex: 1; }
.fp-pcard-img { position: relative; aspect-ratio: 4 / 3; background: var(--fp-surface-2); overflow: hidden; }
.fp-pcard-img img { width: 100%; height: 100%; object-fit: cover; }
.fp-pcard-badge {
    position: absolute; top: 8px; inset-inline-start: 8px;
    padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800;
    background: var(--fp-danger); color: #1A0505;
}
.fp-pcard-body { padding: 10px 12px 4px; }
.fp-pcard-name { margin: 0 0 2px; font-size: 13.5px; font-weight: 800; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-pcard-store { display: block; font-size: 11px; color: var(--fp-text-3); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-pcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px 12px; }
.fp-price { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.fp-price-old { font-size: 11px; color: var(--fp-text-3); text-decoration: line-through; }
.fp-price-now { font-size: 16px; font-weight: 800; color: var(--fp-primary); }
.fp-price-now small { font-size: 10px; font-weight: 700; color: var(--fp-text-3); margin-inline-start: 2px; }
.fp-add-btn {
    width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 14px; cursor: pointer;
    display: grid; place-items: center; font-size: 14px;
    background: var(--fp-gold-grad, var(--fp-primary)); color: var(--fp-on-primary, #fff);
    box-shadow: 0 4px 12px rgba(207, 162, 77, 0.28);
    transition: transform .15s;
}
.fp-add-btn:active { transform: scale(0.88); }
.fp-add-btn:disabled { opacity: .65; cursor: not-allowed; }

/* ═══════════ Stores ═══════════ */
.fp-stores { display: grid; grid-template-columns: 1fr; gap: 12px; }
.fp-store {
    display: flex; gap: 14px; align-items: center; padding: 10px;
    background: var(--fp-surface); border: 1px solid var(--fp-border); border-radius: 22px;
    transition: transform .15s, border-color .2s;
}
.fp-store:active { transform: scale(0.98); }
.fp-store-img { width: 96px; height: 96px; flex-shrink: 0; border-radius: 16px; overflow: hidden; background: var(--fp-surface-2); }
.fp-store-img img { width: 100%; height: 100%; object-fit: cover; }
.fp-store-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fp-store-name { margin: 0; font-size: 16px; font-weight: 800; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-store-desc { margin: 0; font-size: 12px; color: var(--fp-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-store-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; font-size: 11.5px; font-weight: 600; color: var(--fp-text-2); }
.fp-store-meta span { display: inline-flex; align-items: center; gap: 4px; }
.fp-store-meta i { font-size: 11px; color: var(--fp-primary); }
.fp-rating { padding: 2px 8px; border-radius: 999px; background: var(--fp-warning-bg); color: var(--fp-warning); font-weight: 800; }
.fp-rating i { color: inherit !important; font-size: 10px !important; }

/* ═══════════ Empty ═══════════ */
.fp-home .fp-empty { background: var(--fp-surface); border: 1px dashed var(--fp-border-dark); }

.fp-home-end { height: 24px; }

/* ═══════════ Hover (أجهزة بماوس فقط) ═══════════ */
@media (hover: hover) {
    .fp-pcard:hover, .fp-store:hover, .fp-cat:not(.active):hover { border-color: var(--fp-primary); }
    .fp-quick a:hover .fp-quick-ico { border-color: var(--fp-primary); }
    .fp-more:hover { background: var(--fp-primary-light); }
}

/* ═══════════ Tablet / Desktop ═══════════ */
@media (min-width: 720px) {
    .fp-stores { grid-template-columns: repeat(2, 1fr); }
    .fp-quick { max-width: 520px; }
    .fp-hero-title { max-width: 14em; }
    .fp-search { max-width: 640px; }
    .fp-locate { max-width: 360px; }
}
@media (min-width: 1024px) {
    .fp-home { --pad: 24px; }
    .fp-home .fp-container { padding-inline: var(--pad); }
    .fp-hero { padding-top: 28px; }
    .fp-sec { padding-top: 40px; }
    .fp-ads-track { border-radius: 28px; }
    /* السلايدرز تتحول لشبكة */
    .fp-bleed--grid { margin-inline: 0; padding-inline: 0; }
    .fp-rail--products { display: grid; grid-template-columns: repeat(5, 1fr); overflow: visible; }
    .fp-rail--offers   { display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; }
    .fp-rail--products .fp-pcard, .fp-rail--offers .fp-pcard { flex-basis: auto; }
    .fp-cats { flex-wrap: wrap; overflow: visible; }
}
@media (min-width: 1200px) {
    .fp-stores { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .fp-home *, .fp-home *::before, .fp-home *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
