/* ==========================================================================
   ARABNUTRA MOBILE EXPERIENCE v2.0
   Creative Mobile-First Design
   ========================================================================== */

/* ==========================================================================
   BASE MOBILE (up to 768px)
   ========================================================================== */
@media screen and (max-width: 768px) {
  
  /* Reset for mobile */
  html {
    font-size: 15px;
  }
  
  body {
    overflow-x: hidden;
  }
  
  /* Container - Full width with proper padding */
  .dh-container,
  [style*="max-width: 1280px"] {
    max-width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    margin: 0 auto !important;
  }
  
  /* ==========================================================================
     HEADER MOBILE - Clean & Compact
     ========================================================================== */
  .dh-header {
    height: 60px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
  }
  
  .dh-header-inner {
    height: 60px !important;
    padding: 0 12px !important;
  }
  
  .dh-logo img {
    height: 32px !important;
  }
  
  /* Hide desktop nav, show hamburger */
  .dh-nav {
    display: none !important;
  }
  
  .dh-header-actions {
    gap: 8px !important;
  }
  
  .dh-icon-btn {
    width: 40px !important;
    height: 44px !important;
    padding: 8px !important;
  }
  
  .dh-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }
  
  /* ==========================================================================
     MOBILE MENU - Slide Panel
     ========================================================================== */
  .dh-mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height */
    background: white;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    overflow-y: auto;
  }
  
  .dh-mobile-menu.active {
    transform: translateX(0);
  }
  
  .dh-mobile-panel {
    padding: 70px 20px 30px !important;
  }
  
  .dh-mobile-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .dh-mobile-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
  }
  
  .dh-mobile-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f3f4f6;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  
  .dh-mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  
  .dh-mobile-link {
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s;
  }
  
  .dh-mobile-link:hover,
  .dh-mobile-link:active {
    background: #f0fdf4;
    color: #10b981;
  }
  
  /* Mobile Menu Overlay */
  .dh-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
  }
  
  .dh-mobile-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  /* Cart Drawer Mobile */
  .dh-cart-drawer {
    width: 100% !important;
    max-width: 400px;
  }
  
  /* ==========================================================================
     HERO SECTION MOBILE - Stunning & Impactful
     ========================================================================== */
  section[style*="padding: 80px 0"],
  section[style*="padding: 100px 0"] {
    padding: 60px 0 !important;
  }
  
  section[style*="padding: 80px 0"]:first-of-type {
    padding-top: 80px !important;
  }
  
  /* Hero grid stack with image below */
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  
  /* Hero section - text first, image second */
  section:first-of-type [style*="display: grid"] {
    display: flex !important;
    flex-direction: column !important;
  }
  
  section:first-of-type [style*="display: grid"] > div:first-child {
    order: 1 !important;
  }
  
  section:first-of-type [style*="display: grid"] > div:last-child {
    order: 2 !important;
    margin-top: 24px !important;
  }
  
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  
  /* Hero text */
  h1[style*="font-size: 48px"],
  h1[style*="font-size: 52px"] {
    font-size: 28px !important;
    line-height: 1.3 !important;
    text-align: center !important;
  }
  
  h2[style*="font-size: 36px"] {
    font-size: 24px !important;
    line-height: 1.3 !important;
  }
  
  h3[style*="font-size: 24px"] {
    font-size: 20px !important;
  }
  
  p[style*="font-size: 18px"] {
    font-size: 15px !important;
    text-align: center !important;
  }
  
  /* Hero badge */
  [style*="border-radius: 999px"] {
    font-size: 12px !important;
    padding: 6px 14px !important;
  }
  
  /* Hero buttons */
  [style*="display: flex"][style*="gap: 16px"] {
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  [style*="display: flex"][style*="gap: 16px"] a,
  [style*="display: inline-flex"] {
    width: 100% !important;
    justify-content: center !important;
    padding: 14px 24px !important;
    font-size: 15px !important;
  }
  
  /* Hero stats */
  [style*="display: flex"][style*="gap: 48px"] {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 24px 32px !important;
  }
  
  [style*="font-size: 32px"] {
    font-size: 24px !important;
  }
  
  /* Hero image mobile - displayed with adjustments */
  section:first-of-type [style*="position: relative"] > div:last-child {
    display: block !important;
    margin-top: 16px !important;
  }
  
  section:first-of-type [style*="position: relative"] > div:last-child > div {
    padding: 1.5rem !important;
    max-width: 320px !important;
    margin: 0 auto !important;
  }
  
  section:first-of-type [style*="position: relative"] > div:last-child img {
    max-height: 240px !important;
    width: 100% !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    border-radius: 16px !important;
  }
  
  /* Currency Symbol Fix for Mobile */
  .sar-currency-symbol,
  .woocommerce-Price-currencySymbol,
  .price .woocommerce-Price-currencySymbol,
  .product-price .woocommerce-Price-currencySymbol {
    font-family: "saudi-riyal-font", "Segoe UI", "Arial", sans-serif !important;
    font-weight: normal !important;
  }
  
  /* ==========================================================================
     TRUST BAR MOBILE - Horizontal Scroll
     ========================================================================== */
  .dh-trust-items,
  [style*="justify-content: space-around"] {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 16px !important;
    padding: 8px 0 !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  
  .dh-trust-items::-webkit-scrollbar {
    display: none;
  }
  
  .dh-trust-item,
  [style*="justify-content: space-around"] > div {
    flex: 0 0 auto !important;
    min-width: 200px !important;
    background: white !important;
    padding: 16px 20px !important;
    border-radius: 12px !important;
    border: 1px solid #e5e7eb;
    font-size: 13px !important;
  }
  
  /* ==========================================================================
     CATEGORY CARDS MOBILE - Beautiful Cards
     ========================================================================== */
  .dh-cat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  .dh-cat-card {
    padding: 20px 16px !important;
    border-radius: 16px !important;
  }
  
  .dh-cat-icon {
    width: 48px !important;
    height: 48px !important;
  }
  
  .dh-cat-icon svg {
    width: 24px !important;
    height: 24px !important;
  }
  
  .dh-cat-title {
    font-size: 14px !important;
    margin-top: 12px !important;
  }
  
  .dh-cat-count {
    font-size: 12px !important;
  }
  
  /* ==========================================================================
     PRODUCT GRID MOBILE - Card Style
     ========================================================================== */
  .products-grid,
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  .product-card {
    border-radius: 12px !important;
    overflow: hidden;
    background: white;
    border: 1px solid #e5e7eb;
  }
  
  .product-card img,
  .product-card .attachment-woocommerce_thumbnail {
    height: 140px !important;
    width: 100% !important;
    object-fit: cover !important;
  }
  
  .product-card h3,
  .product-card h2 {
    font-size: 13px !important;
    line-height: 1.4 !important;
    min-height: 36px !important;
    margin-bottom: 8px !important;
  }
  
  .product-card > div {
    padding: 12px !important;
  }
  
  .product-price,
  .product-card .price {
    margin-bottom: 12px !important;
  }
  
  .product-price del,
  .product-card .price del {
    font-size: 12px !important;
  }
  
  .product-price ins,
  .product-card .price ins {
    font-size: 15px !important;
  }
  
  .product-card a[href*="add-to-cart"],
  .product-card .button {
    padding: 10px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    width: 100% !important;
    text-align: center !important;
  }
  
  /* ==========================================================================
     SHOP PAGE MOBILE
     ========================================================================== */
  .shop-flex {
    flex-direction: column !important;
  }
  
  .shop-sidebar {
    width: 100% !important;
    order: -1 !important;
    margin-bottom: 24px !important;
  }
  
  .products-area {
    width: 100% !important;
  }
  
  .products-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 16px !important;
  }
  
  /* Sidebar as accordion on mobile */
  .shop-sidebar .widget {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
  }
  
  /* ==========================================================================
     SINGLE PRODUCT MOBILE
     ========================================================================== */
  .single-product-page [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  
  .single-product-page .product-gallery {
    max-width: 100% !important;
  }
  
  .single-product-page .product-gallery img {
    max-height: 350px !important;
    object-fit: contain !important;
  }
  
  .single-product-page h1 {
    font-size: 22px !important;
    line-height: 1.4 !important;
  }
  
  .single-product-price del {
    font-size: 14px !important;
  }
  
  .single-product-price ins {
    font-size: 26px !important;
  }
  
  .single-product-page .quantity {
    width: 100% !important;
  }
  
  .single-product-page .single_add_to_cart_button {
    width: 100% !important;
    padding: 16px !important;
    font-size: 16px !important;
  }
  
  /* Product tabs */
  .wc-tabs {
    flex-direction: column !important;
    border: none !important;
  }
  
  .wc-tabs li {
    width: 100% !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    margin-bottom: 8px !important;
  }
  
  /* Related products */
  .related.products .products {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  /* ==========================================================================
     FEATURES & BENEFITS MOBILE
     ========================================================================== */
  .dh-features-grid,
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  .dh-feature,
  [style*="text-align: center"][style*="padding: 32px"] {
    padding: 24px !important;
    border-radius: 16px !important;
    background: white;
    border: 1px solid #e5e7eb;
  }
  
  .dh-feature-icon {
    width: 56px !important;
    height: 56px !important;
  }
  
  /* ==========================================================================
     NEWSLETTER MOBILE
     ========================================================================== */
  .dh-newsletter-form,
  form[style*="display: flex"] {
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  .dh-newsletter-form input,
  form[style*="display: flex"] input,
  .dh-newsletter-form button,
  form[style*="display: flex"] button {
    width: 100% !important;
    border-radius: 10px !important;
    padding: 14px 20px !important;
  }
  
  /* ==========================================================================
     ABOUT PAGE MOBILE
     ========================================================================== */
  /* Timeline */
  [style*="position: absolute; right: 50%"] {
    right: 20px !important;
  }
  
  [style*="display: flex"][style*="margin-bottom: 48px"] {
    flex-direction: column !important;
    gap: 16px !important;
    padding-right: 60px !important;
  }
  
  [style*="width: 64px; height: 64px"] {
    width: 48px !important;
    height: 48px !important;
    font-size: 14px !important;
  }
  
  /* Team cards */
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  [style*="width: 100px; height: 100px"] {
    width: 80px !important;
    height: 80px !important;
  }
  
  /* Testimonials */
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
  }
  
  /* ==========================================================================
     FOOTER MOBILE
     ========================================================================== */
  footer [style*="grid"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  
  footer {
    text-align: center !important;
  }
  
  .dh-footer-social {
    justify-content: center !important;
  }
  
  .dh-footer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  /* ==========================================================================
     PAGINATION MOBILE
     ========================================================================== */
  .pagination,
  .page-numbers {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  
  .page-numbers a,
  .page-numbers span {
    min-width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px !important;
    font-size: 14px !important;
  }
  
  /* ==========================================================================
     UTILITY CLASSES
     ========================================================================== */
  .hide-mobile {
    display: none !important;
  }
  
  .text-center-mobile {
    text-align: center !important;
  }
  
  .full-width-mobile {
    width: 100% !important;
  }
  
  /* Touch-friendly buttons */
  button,
  .button,
  .dh-btn,
  input[type="submit"] {
    min-height: 48px !important;
    min-width: 48px !important;
  }
  
  /* Better form inputs */
  input,
  textarea,
  select {
    font-size: 16px !important; /* Prevents zoom on iOS */
    padding: 12px 16px !important;
    border-radius: 10px !important;
  }
  
  /* Images */
  img {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* ==========================================================================
   SMALL MOBILE (up to 480px)
   ========================================================================== */
@media screen and (max-width: 480px) {
  
  html {
    font-size: 14px;
  }
  
  /* Single column products */
  .products-grid,
  [style*="grid-template-columns: repeat(2"] {
    grid-template-columns: 1fr !important;
  }
  
  .product-card img {
    height: 200px !important;
  }
  
  /* Hero smaller */
  h1[style*="font-size: 28px"] {
    font-size: 24px !important;
  }
  
  h2[style*="font-size: 24px"] {
    font-size: 20px !important;
  }
  
  /* Stats */
  [style*="font-size: 48px"] {
    font-size: 32px !important;
  }
  
  /* Categories single column */
  .dh-cat-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Team single column */
  [style*="grid-template-columns: repeat(2"] {
    grid-template-columns: 1fr !important;
  }
  
  /* Trust items */
  .dh-trust-item {
    min-width: 160px !important;
    padding: 12px 16px !important;
  }
  
  /* More compact buttons */
  [style*="padding: 16px 32px"] {
    padding: 12px 20px !important;
  }
}

/* ==========================================================================
   TOUCH OPTIMIZATION
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
  
  /* Larger touch targets */
  a, button, .dh-btn, .dh-icon-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Remove hover effects, keep active state */
  .product-card:hover,
  .dh-cat-card:hover,
  .dh-feature:hover {
    transform: none !important;
    box-shadow: none !important;
  }
  
  .product-card:active,
  .dh-cat-card:active,
  .dh-btn:active {
    transform: scale(0.98) !important;
    opacity: 0.9;
  }
  
  /* Smooth scrolling */
  html {
    scroll-behavior: smooth;
  }
}

/* ==========================================================================
   SAFARI IOS FIXES
   ========================================================================== */
@supports (-webkit-touch-callout: none) {
  
  /* Prevent font size adjustment */
  body {
    -webkit-text-size-adjust: 100%;
  }
  
  /* Fix for 100vh on iOS */
  .dh-mobile-menu,
  .dh-cart-drawer {
    height: -webkit-fill-available !important;
  }
  
  /* Smooth header */
  .dh-header {
    position: -webkit-sticky;
    top: 0;
  }
  
  /* Fix for rounded inputs */
  input, textarea {
    -webkit-appearance: none;
    border-radius: 10px;
  }
}

/* ==========================================================================
   LANDSCAPE MODE
   ========================================================================== */
@media screen and (max-width: 768px) and (orientation: landscape) {
  
  .dh-header {
    height: 50px !important;
  }
  
  .dh-header-inner {
    height: 50px !important;
  }
  
  section:first-of-type {
    padding-top: 60px !important;
  }
  
  /* Two columns in landscape for products */
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@media screen and (max-width: 768px) {
  
  /* Smooth transitions */
  .product-card,
  .dh-cat-card,
  .dh-feature {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  /* Subtle entrance animation */
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .product-card {
    animation: fadeInUp 0.4s ease forwards;
  }
  
  /* Stagger animation for cards */
  .product-card:nth-child(1) { animation-delay: 0.05s; }
  .product-card:nth-child(2) { animation-delay: 0.1s; }
  .product-card:nth-child(3) { animation-delay: 0.15s; }
  .product-card:nth-child(4) { animation-delay: 0.2s; }
}
