/* Balanced mobile shopping-app UI — clear, readable, not stripped */

@media (max-width: 767px) {
  :root {
    --app-tab: 70px;
    --app-safe: env(safe-area-inset-bottom, 0px);
    --app-pad: 1rem;
  }

  body {
    background: #f3f8fc;
    font-size: 15px;
  }

  body > div.min-h-screen,
  body > div[dir="rtl"] {
    background: #f3f8fc;
  }

  /* Hide only true noise */
  .fixed.inset-0.pointer-events-none,
  header .absolute.-bottom-3,
  header [class*="-bottom-3"],
  main > nav.flex.items-center.gap-2.text-xs,
  div[class*="fixed"][class*="bottom-24"]:not(.sea-help) {
    display: none !important;
  }

  /* Guest banner → compact chip strip */
  .bg-secondary.text-secondary-foreground.text-sm.font-bold.relative.z-50,
  body > div[dir="rtl"] > div.bg-secondary {
    position: relative;
    z-index: 40;
  }

  .bg-secondary .container {
    padding-block: 0.55rem !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 0.5rem !important;
  }

  /* Header: logo + name + cart + menu */
  header {
    border-bottom: 0 !important;
    background: #fff !important;
    box-shadow: 0 1px 0 rgb(15 23 42 / 6%) !important;
  }

  header > .container > div[class*="justify-between"],
  header .container > div[class*="py-4"][class*="flex"],
  header .container > div[class*="py-3"][class*="flex"] {
    min-height: 56px;
    padding-block: 0.55rem !important;
    gap: 0.5rem !important;
  }

  header a[href="home.html"] img[alt="النون"] {
    height: 40px !important;
  }

  header a[href="home.html"] .text-2xl,
  header a[href="home.html"] .text-xl {
    font-size: 1.15rem !important;
  }

  header a[href="home.html"] .text-xs {
    display: none !important;
  }

  header a[href="wishlist.html"] {
    display: none !important; /* exists in tab bar */
  }

  header a[href="cart.html"] {
    min-width: 44px;
    min-height: 44px;
    padding-inline: 0.55rem !important;
    border-radius: 999px !important;
  }

  .app-mobile-search {
    display: block !important;
    padding: 0 1rem 0.75rem;
  }

  .app-mobile-search form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.2rem 0.3rem 0.2rem 0.9rem;
    border-radius: 999px;
    background: #eef3f9;
    border: 1px solid rgb(203 213 225 / 55%);
  }

  .app-mobile-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 700;
  }

  .app-mobile-search button {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: var(--primary, #0077b6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .container {
    padding-inline: var(--app-pad) !important;
  }

  main.container,
  main.relative.z-10,
  main.home-main {
    padding-top: 0.5rem !important;
    padding-bottom: calc(var(--app-tab) + var(--app-safe) + 1.25rem) !important;
  }

  /* Page back bar */
  .app-page-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1rem;
  }

  .app-page-bar__back {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    background: #fff;
    border: 1px solid rgb(203 213 225 / 60%);
    flex-shrink: 0;
  }

  .app-page-bar__title {
    font-family: var(--font-heading, Cairo, sans-serif);
    font-size: 1.2rem;
    font-weight: 900;
  }

  .app-page-bar__sub {
    display: none;
  }

  /* Bottom tabs */
  div[class*="md:hidden"][class*="fixed"][class*="bottom-0"] {
    min-height: calc(var(--app-tab) + var(--app-safe));
    padding: 0.4rem 0.75rem calc(0.4rem + var(--app-safe)) !important;
    border-radius: 1.15rem 1.15rem 0 0 !important;
    background: rgb(255 255 255 / 97%) !important;
    border-top: 1px solid rgb(203 213 225 / 50%) !important;
    backdrop-filter: blur(16px);
    box-shadow: 0 -8px 28px rgb(15 23 42 / 8%) !important;
  }

  div[class*="md:hidden"][class*="fixed"][class*="bottom-0"] > a {
    min-width: 52px;
    min-height: 48px;
    justify-content: center;
    border-radius: 0.85rem;
  }

  div[class*="md:hidden"][class*="fixed"][class*="bottom-0"] > a[aria-current="page"],
  div[class*="md:hidden"][class*="fixed"][class*="bottom-0"] > a.text-primary {
    background: color-mix(in srgb, var(--primary, #0077b6) 10%, transparent);
  }

  div[class*="md:hidden"][class*="fixed"][class*="bottom-0"] .text-xs {
    font-size: 0.7rem !important;
    font-weight: 800;
  }

  div[class*="md:hidden"][class*="fixed"][class*="bottom-0"] > div.relative {
    top: -1.1rem;
  }

  div[class*="md:hidden"][class*="fixed"][class*="bottom-0"] > div.relative > a {
    width: 54px;
    height: 54px;
  }

  /* Footer: compact, not deleted */
  footer {
    margin-top: 1.5rem !important;
    padding: 1.75rem var(--app-pad) calc(var(--app-tab) + var(--app-safe) + 1rem) !important;
    border-radius: 1.5rem 1.5rem 0 0;
  }

  footer .grid[class*="grid-cols"] > div:not(.col-span-2) {
    display: none !important;
  }

  footer .col-span-2,
  footer .sm\:col-span-2 {
    grid-column: 1 / -1 !important;
  }

  footer h3,
  footer h4 {
    font-size: 1rem !important;
  }

  footer .flex.bg-white.rounded-full {
    max-width: 100%;
  }

  footer .border-t {
    margin-top: 1rem;
    padding-top: 1rem !important;
  }

  /* ========== HOME: natural order, readable ========== */
  .page-home .home-main {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
  }

  .page-home .home-main > section {
    margin: 0 !important;
    order: unset !important;
  }

  /* Hero: full, clear, brand-forward */
  .page-home section[aria-label="العروض الرئيسية"] {
    padding-inline: var(--app-pad);
  }

  .page-home section[aria-label="العروض الرئيسية"] > div {
    min-height: 320px !important;
    max-height: none;
    border-radius: 1.35rem !important;
    border: 0 !important;
    box-shadow: 0 14px 36px rgb(0 119 182 / 16%);
    align-items: flex-end !important;
  }

  .page-home section[aria-label="العروض الرئيسية"] [class*="z-20"] {
    width: 100% !important;
    padding: 1.25rem !important;
    gap: 0.65rem !important;
  }

  .page-home section[aria-label="العروض الرئيسية"] span[class*="rounded-full"] {
    display: inline-block !important;
    font-size: 0.7rem !important;
    padding: 0.35rem 0.7rem !important;
    transform: none !important;
  }

  .page-home section[aria-label="العروض الرئيسية"] h1 {
    font-size: 1.65rem !important;
    line-height: 1.3 !important;
    display: block !important;
  }

  .page-home section[aria-label="العروض الرئيسية"] h1 svg {
    display: none !important;
  }

  .page-home section[aria-label="العروض الرئيسية"] p {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.875rem !important;
    margin: 0 !important;
  }

  .page-home section[aria-label="العروض الرئيسية"] a[href="products.html"] {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 1rem !important;
    padding-block: 0.85rem !important;
  }

  /* Categories */
  .page-home .home-section-head {
    margin-bottom: 0.85rem;
  }

  .page-home .home-section-head h2 {
    font-size: 1.15rem !important;
  }

  .page-home .home-cats__rail {
    grid-auto-columns: 88px;
    gap: 0.75rem;
    margin-inline: calc(-1 * var(--app-pad));
    padding-inline: var(--app-pad);
  }

  .page-home .home-cat__label {
    font-size: 0.72rem;
    font-weight: 800;
  }

  /* Products: readable 2-col */
  .page-home .home-products {
    gap: 0.75rem;
  }

  .page-home .home-product {
    padding: 0.7rem;
    border-radius: 1.1rem;
    background: #fff;
    border: 1px solid rgb(203 213 225 / 50%);
    box-shadow: 0 8px 20px rgb(15 23 42 / 5%);
  }

  .page-home .home-product__brand {
    display: block;
    font-size: 0.65rem;
  }

  .page-home .home-product__title {
    font-size: 0.8rem;
    min-height: 2.4rem;
  }

  .page-home .home-product__meta {
    display: flex;
    margin-bottom: 0.4rem;
  }

  .page-home .home-product__meta iconify-icon:nth-child(n + 4),
  .page-home .home-product__meta span {
    display: none;
  }

  .page-home .home-product__price {
    font-size: 0.95rem;
  }

  .page-home .home-product__cart {
    width: 40px;
    height: 40px;
  }

  .page-home .home-product__wish {
    width: 34px;
    height: 34px;
  }

  /* Promo */
  .page-home .home-promo {
    min-height: 180px;
    border-radius: 1.25rem;
  }

  .page-home .home-promo__content {
    padding: 1.15rem;
  }

  .page-home .home-promo__copy {
    display: block;
    font-size: 0.8125rem;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .page-home .home-promo__cta {
    width: 100%;
    min-height: 44px;
  }

  /* Trust: keep, compact 2x2 */
  .page-home .home-trust {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .page-home .home-trust__item {
    padding: 0.85rem 0.5rem;
  }

  .page-home .home-trust__item span {
    font-size: 0.65rem;
  }

  /* Request */
  .page-home .home-request {
    padding: 1rem;
    gap: 0.85rem;
  }

  .page-home .home-request__cta {
    width: 100%;
    min-height: 46px;
  }

  /* ========== Account / rewards ========== */
  .page-account .app-desktop-only {
    display: none !important;
  }

  .page-account .app-mobile-only {
    display: block !important;
  }

  .page-account .app-profile-hero {
    margin-bottom: 1rem;
  }

  .page-rewards main .text-center.mb-10 p {
    display: block;
  }

  /* Forms / cards */
  main .bg-card[class*="rounded"] {
    border-radius: 1.15rem !important;
    border-width: 1px !important;
    box-shadow: 0 8px 20px rgb(15 23 42 / 4%);
  }

  main input,
  main select,
  main textarea {
    min-height: 48px;
    font-size: 16px !important;
    border-radius: 0.85rem !important;
  }

  .page-products aside {
    display: none !important;
  }

  /* ========== Product detail ========== */
  .page-product-detail header a[href="wishlist.html"] {
    display: none !important;
  }

  .page-product-detail .pdp-main {
    padding-top: 0.35rem !important;
  }

  .page-product-detail .pdp-gallery {
    border-radius: 1.25rem !important;
    background: #fff;
  }

  .page-product-detail .pdp-info h1 {
    font-size: 1.35rem !important;
    line-height: 1.35 !important;
  }

  .page-product-detail .pdp-points p.text-xs {
    display: none;
  }

  .page-product-detail .pdp-perks {
    gap: 0.65rem;
  }

  .page-product-detail .pdp-details {
    margin-top: 1.75rem !important;
  }

  .page-product-detail .order-sticky {
    gap: 0.45rem;
  }

  .page-product-detail .order-sticky__cta.is-primary {
    padding-inline: 0.85rem;
    min-width: 3rem;
  }

  .page-product-detail .pdp-sticky-label {
    display: none;
  }

  .page-product-detail .order-sticky__cta:last-child {
    flex: 1;
  }

  .page-product-detail footer .grid[class*="grid-cols"] > div:not(.sm\:col-span-2):not(.col-span-2) {
    display: none !important;
  }

  .site-toast-region {
    bottom: calc(var(--app-tab) + var(--app-safe) + 0.85rem) !important;
  }
}

@media (min-width: 768px) {
  .app-page-bar,
  .app-mobile-search {
    display: none !important;
  }

  .page-account .app-mobile-only {
    display: none !important;
  }

  .page-account .app-desktop-only {
    display: block !important;
  }
}
