/* Mobile stylesheet (fresh rebuild) */
@media (max-width: 992px) {
  :root {
    --m-gap: 12px;
    --m-radius: 12px;
  }
  * {
    box-sizing: border-box;
  }
  html,
  body {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }
  body {
    font-size: 16px;
    line-height: 1.6;
    background: var(--surface, #111);
    color: var(--text, #f4f4f4);
  }

  /* Header + navigation */
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3400;
    background: var(--surface, #111);
    overflow: visible;
  }
  body {
    padding-top: 76px;
  }
  body.header-compact {
    padding-top: 60px;
  }
  .site-header.compact {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  }
  .site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
  }
  .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    flex: 1 1 auto;
  }
  .site-name {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60vw;
  }
  .site-header .site-name {
    text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 16%, transparent);
    animation-duration: 4.2s;
  }
  .site-header .site-name::after {
    bottom: -5px;
    opacity: 0.45;
    animation-duration: 4.2s;
  }
  .site-header.compact .site-name {
    font-size: 0.85rem;
  }
  .site-header.compact .site-name {
    text-shadow: none;
  }
  .site-header.compact .site-name::after {
    display: none;
  }
  .site-header.compact .container {
    padding: 6px 10px;
  }
  .site-logo {
    width: 60px;
    height: 60px;
  }
  .site-header .site-logo {
    animation-duration: 4.2s;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.22))
      drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 18%, transparent));
  }
  .site-header.compact .site-logo {
    width: 40px;
    height: 40px;
  }
  .site-header.compact .site-logo {
    filter: none;
  }
  .site-header .logo {
    font-size: 1.05rem;
  }
  .site-title {
    font-size: 0.95rem;
  }
  .site-header.compact .site-title {
    font-size: 0.85rem;
  }
  .nav-toggle {
    font-size: 1.35rem;
    padding: 8px 10px;
    position: relative;
    z-index: 4010;
  }
  .header-social {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .social-link {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface, #111);
    color: inherit;
    text-decoration: none;
  }
  .site-header.compact .social-link {
    width: 30px;
    height: 30px;
  }
  .social-link svg {
    width: 18px;
    height: 18px;
    display: block;
  }
  .site-header.compact .social-link svg {
    width: 16px;
    height: 16px;
  }
  .nav {
    display: none;
  }
  .nav.open {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 4000;
    padding: calc(env(safe-area-inset-top, 0px) + 64px) 18px
      calc(env(safe-area-inset-bottom, 0px) + 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface, #111);
    color: var(--text, #f4f4f4);
    overscroll-behavior: contain;
  }
  body.nav-open {
    overflow: hidden;
  }
  .nav a,
  .nav button {
    display: block;
    padding: 12px 8px;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--border);
    color: inherit;
  }
  .nav .nav-close {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 4010;
    background: rgba(0, 0, 0, 0.35);
    color: inherit;
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  body[dir="rtl"] .nav {
    text-align: right;
  }

  /* Search bar */
  .main-search-bar {
    padding: 10px 12px;
  }

  /* Footer socials */
  .site-footer .footer-content {
    justify-content: center;
    text-align: center;
  }
  .site-footer .footer-copy {
    width: 100%;
  }
  .footer-social {
    justify-content: center;
    width: 100%;
  }
  .main-search-bar form {
    max-width: 100%;
    height: 46px;
  }
  .main-search-bar input[type="text"] {
    height: 46px;
    font-size: 1rem;
  }
  .main-search-bar button {
    height: 46px;
    padding: 0 18px;
  }

  /* Layout stacking */
  .main-container {
    display: block;
    padding: 12px;
  }
  main.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
  .container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }
  .product-row-wrap,
  .product-layout,
  .image-col,
  .product-meta,
  .meta-card,
  .compatible-devices-section {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box;
    align-self: stretch;
  }
  .product-container,
  .product-row-wrap,
  .product-layout,
  .product-meta,
  .meta-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box;
  }
  .compatible-devices-section {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .row {
    display: block;
  }
  .col {
    width: 100%;
  }

  /* Product grid */
  .product-listing,
  .products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .product-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    padding: 8px 6px;
    border-radius: var(--m-radius);
    overflow: hidden;
  }
  .product-card img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    border-radius: 10px;
    background: transparent;
    padding: 6px;
    margin: 0;
  }
  .product-card .meta {
    width: 100%;
    text-align: center;
  }

  /* Cart drawer */
  #cartDrawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 88vh;
    width: 100%;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
    transition: transform 0.28s ease;
    z-index: 3500;
  }
  #cartDrawer.open {
    transform: translateY(0);
  }
  #cartDrawer .drawer-header {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
  }
  #cartDrawer .drawer-body {
    padding: 12px;
    overflow: auto;
    height: calc(88vh - 64px);
  }
  @media (max-width: 768px) {
    #cartDrawer,
    #cartDrawerOverlay {
      display: none !important;
    }
  }

  /* Reels */
  .home-reels {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .home-reels .reel {
    flex: 0 0 46%;
    max-width: 46%;
    border-radius: 10px;
    height: 52vw;
  }

  /* Floating sidebar hidden */
  .floating-sidebar {
    display: none !important;
  }

  /* Product detail (mobile) */
  .product-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
  .product-layout {
    display: block;
    gap: 12px;
  }
  .image-col,
  .product-meta {
    width: 100%;
  }
  .image-inner {
    display: block;
  }
  .product-image,
  .product-thumbs {
    display: none !important;
  }
  .video-container {
    display: block !important;
    position: static !important;
    left: auto;
    right: auto;
    top: auto;
    width: 100%;
    margin-top: 12px;
  }
  .video-card {
    border-radius: 12px;
    overflow: hidden;
    background: #000;
  }
  .video-frame {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
  }
  .video-container video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
  }
  .mobile-carousel {
    display: block !important;
    width: 100%;
    height: auto;
    max-height: 60vh;
    min-height: 200px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface, #111);
  }
  .mobile-carousel .carousel-track {
    height: auto;
  }
  .mobile-carousel .carousel-slide {
    height: auto;
    padding: 0;
  }
  .mobile-carousel .carousel-slide img {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
  }
  .mobile-carousel .carousel-arrow {
    background: rgba(0, 0, 0, 0.45);
  }
  .meta-card {
    padding: 0;
    border-radius: 12px;
  }
  .product-meta h2 {
    font-size: 1.2rem;
  }
  .base-price {
    font-size: 0.95rem;
  }
  /* Checkout (mobile) */
  .checkout {
    display: block;
    padding: 12px;
    gap: 12px;
    border-radius: 12px;
  }
  .checkout > div,
  .summary-box {
    width: 100% !important;
    max-width: 100% !important;
  }
  .inline-field {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .payment-option {
    flex-direction: column;
    align-items: flex-start;
  }
  .summary-box {
    margin-top: 12px;
    padding: 12px;
  }
  .summary-box .table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .summary-box .table th,
  .summary-box .table td {
    white-space: nowrap;
    font-size: 12px;
    padding: 8px 6px;
  }
  .checkout-product-image {
    width: 56px;
    height: 56px;
  }
  .checkout-phone-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
  }
  .checkout-phone-row label {
    margin: 0;
    white-space: nowrap;
  }
  /* Compatible devices (mobile layout) */
  .compatible-devices-section,
  .compatible-devices-wrap {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  .compatible-table {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: fixed;
  }
  .compatible-table thead {
    display: none;
  }
  .compatible-table,
  .compatible-table tbody,
  .compatible-table tr,
  .compatible-table td {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  .compatible-table tr {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr 1fr;
    grid-template-areas: "name price qty" "name subtotal qty";
    gap: 8px;
    margin: 0 0 12px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--surface);
    box-shadow: 0 8px 18px rgba(2, 8, 20, 0.06);
  }
  .compatible-table td {
    padding: 0;
    border: 0;
  }
  .td-device-name {
    grid-area: name;
  }
  .td-unit-price {
    grid-area: price;
  }
  .td-qty {
    grid-area: qty;
  }
  .td-subtotal {
    grid-area: subtotal;
  }
  .td-subtotal {
    display: none !important;
  }
  .td-device-name::before {
    display: none;
  }
  .compatible-device-name {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-weight: 800;
    font-size: 15px;
  }
  .td-unit-price,
  .td-qty,
  .td-subtotal {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
  }
  .td-unit-price::before,
  .td-qty::before,
  .td-subtotal::before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
  }
  .price-inline {
    white-space: normal;
    display: block;
    font-weight: 700;
  }
  .td-qty .qty-control {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .td-qty .compatible-qty {
    width: 86px;
    max-width: 96px;
  }
  .qty-control .qty-btn {
    min-width: 32px;
    height: 32px;
    font-size: 16px;
  }
  /* Compatible devices: full width on mobile */
  .compatible-devices-section,
  .compatible-devices-wrap {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  .compatible-table,
  .compatible-table tbody,
  .compatible-table tr,
  .compatible-table td {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* Buttons */
  .btn,
  button {
    min-height: 44px;
    padding: 10px 14px;
  }
  .color-swatch {
    width: 36px !important;
    height: 36px !important;
    min-height: 0 !important;
    padding: 0 !important;
    border-radius: 50% !important;
  }
  .view-btn {
    display: none !important;
  }
  .card-actions .btn.small {
    padding: 8px 10px;
    font-size: 0.95rem;
    min-height: 36px;
  }
  .card-actions .link {
    font-size: 0.9rem;
  }
  .products-grid .product-card .card-actions .btn.small,
  .products-grid .product-card .card-actions .buy-now,
  .products-grid .product-card .card-actions .add-to-cart {
    display: none !important;
  }

  /* Utility */
  .hidden-phone {
    display: none !important;
  }
}

@media (max-width: 360px) {
  body {
    font-size: 15px;
  }
  .home-reels .reel {
    height: 60vw;
  }
}
