/* ============================================
   PRODUCT DETAIL PAGE MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
  /* Product Detail Container */
  .product-detail-container,
  .product-page-wrapper,
  [class*="product-detail"] {
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Product Image Gallery */
  .product-image-gallery,
  .product-images-container {
    width: 100% !important;
    margin-bottom: 20px !important;
  }

  .product-main-image {
    width: 100% !important;
    height: auto !important;
    max-height: 400px !important;
    object-fit: contain !important;
    border-radius: 12px !important;
  }

  .product-thumbnails {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 12px 0 !important;
    scroll-snap-type: x mandatory !important;
  }

  .product-thumbnail {
    flex: 0 0 80px !important;
    width: 80px !important;
    height: 80px !important;
    border-radius: 8px !important;
    scroll-snap-align: start !important;
  }

  /* Product Info Section */
  .product-info-section,
  .product-details {
    padding: 16px 12px !important;
  }

  .product-title {
    font-size: 22px !important;
    line-height: 1.3 !important;
    margin-bottom: 12px !important;
  }

  .product-price {
    font-size: 28px !important;
    margin-bottom: 16px !important;
  }

  .product-description {
    font-size: 14px !important;
    line-height: 1.7 !important;
    padding: 16px !important;
    border-radius: 12px !important;
  }

  /* Product Actions - Sticky Bottom Bar */
  .product-actions,
  .product-buttons {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    position: sticky !important;
    bottom: 0 !important;
    background: var(--bg-primary) !important;
    padding: 16px 12px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3) !important;
    z-index: 100 !important;
  }

  .btn-add-to-cart,
  .btn-buy-now,
  .product-action-btn {
    width: 100% !important;
    padding: 16px !important;
    font-size: 16px !important;
    min-height: 52px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
  }

  /* Product Meta Info */
  .product-meta-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding: 16px !important;
    background: var(--bg-secondary) !important;
    border-radius: 12px !important;
    margin-bottom: 16px !important;
  }

  .product-meta-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  }

  .product-meta-item:last-child {
    border-bottom: none !important;
  }

  /* Seller Info */
  .seller-info-card {
    padding: 16px !important;
    border-radius: 12px !important;
    margin-bottom: 16px !important;
  }

  /* Related Products */
  .related-products,
  .similar-products {
    padding: 20px 12px !important;
  }

  .related-products-title {
    font-size: 20px !important;
    margin-bottom: 16px !important;
  }

  .related-products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
}

/* ============================================
   CART PAGE MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
  /* Cart Container */
  .cart-container,
  .cart-page-wrapper {
    padding: 12px !important;
  }

  /* Cart Items */
  .cart-item,
  .cart-product-item {
    flex-direction: column !important;
    gap: 12px !important;
    padding: 16px !important;
    border-radius: 12px !important;
    margin-bottom: 12px !important;
  }

  .cart-item-image {
    width: 100% !important;
    max-width: 200px !important;
    height: auto !important;
    aspect-ratio: 1 !important;
    border-radius: 10px !important;
  }

  .cart-item-info {
    width: 100% !important;
  }

  .cart-item-title {
    font-size: 16px !important;
    margin-bottom: 8px !important;
    line-height: 1.4 !important;
  }

  .cart-item-price {
    font-size: 18px !important;
    margin-bottom: 12px !important;
  }

  /* Quantity Selector */
  .cart-quantity-selector,
  .quantity-controls {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    justify-content: space-between !important;
  }

  .quantity-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 10px !important;
    font-size: 18px !important;
  }

  .quantity-input {
    width: 60px !important;
    text-align: center !important;
    padding: 8px !important;
    font-size: 16px !important;
  }

  .cart-item-remove {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    padding: 14px 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
  }

  .cart-item-remove i,
  .cart-item-remove span {
    display: inline-block !important;
  }

  /* Cart Summary - Sticky Bottom */
  .cart-summary,
  .cart-totals {
    position: sticky !important;
    bottom: 0 !important;
    padding: 16px !important;
    background: var(--bg-primary) !important;
    border-top: 2px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3) !important;
    z-index: 100 !important;
    margin-top: 20px !important;
  }

  .cart-summary-row {
    display: flex !important;
    justify-content: space-between !important;
    padding: 12px 0 !important;
    font-size: 14px !important;
  }

  .cart-total {
    font-size: 24px !important;
    font-weight: 700 !important;
    padding: 16px 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  }

  .cart-checkout-btn {
    width: 100% !important;
    padding: 18px !important;
    font-size: 16px !important;
    min-height: 54px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    margin-top: 16px !important;
  }

  /* Empty Cart */
  .empty-cart {
    padding: 40px 20px !important;
    text-align: center !important;
  }

  .empty-cart-icon {
    font-size: 64px !important;
    margin-bottom: 20px !important;
  }

  .empty-cart-title {
    font-size: 20px !important;
    margin-bottom: 12px !important;
  }

  .empty-cart-text {
    font-size: 14px !important;
    margin-bottom: 24px !important;
  }
}

/* ============================================
   SEARCH PAGE MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
  /* Search Container */
  .search-container,
  .search-page-wrapper {
    padding: 12px !important;
  }

  /* Search Bar */
  .search-bar-container,
  .search-form {
    margin-bottom: 16px !important;
  }

  .search-input-wrapper {
    display: flex !important;
    gap: 8px !important;
  }

  .search-input {
    flex: 1 !important;
    padding: 14px 18px !important;
    font-size: 16px !important;
    border-radius: 12px !important;
    min-height: 48px !important;
  }

  .search-submit-btn {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    border-radius: 12px !important;
    padding: 0 !important;
  }

  /* Search Filters */
  .search-filters {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding: 16px !important;
    background: var(--bg-secondary) !important;
    border-radius: 12px !important;
    margin-bottom: 16px !important;
  }

  .filter-group {
    width: 100% !important;
  }

  .filter-label {
    font-size: 14px !important;
    margin-bottom: 8px !important;
  }

  .filter-select,
  .filter-input {
    width: 100% !important;
    padding: 12px !important;
    font-size: 14px !important;
    border-radius: 10px !important;
    min-height: 44px !important;
  }

  /* Search Results */
  .search-results-header {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }

  .search-results-count {
    font-size: 14px !important;
  }

  .search-sort-options {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 4px !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .search-sort-options::-webkit-scrollbar {
    display: none !important;
  }

  .sort-option {
    flex-shrink: 0 !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
    border-radius: 10px !important;
    min-height: 44px !important;
  }
}

/* ============================================
   ENHANCED TOUCH FEEDBACK & GESTURES
   ============================================ */

@media (max-width: 768px) {
  /* Enhanced Touch Targets */
  .product-card,
  .category-card,
  .btn,
  button,
  a.clickable {
    position: relative !important;
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2) !important;
    touch-action: manipulation !important;
  }

  /* Active State Animation */
  .product-card:active {
    transform: scale(0.97) !important;
    transition: transform 0.1s ease !important;
  }

  .category-card:active {
    transform: scale(0.96) !important;
    transition: transform 0.1s ease !important;
  }

  /* Image Touch Optimization */
  img {
    touch-action: manipulation !important;
    -webkit-user-drag: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
  }

  /* Swipeable Cards */
  .swipeable-card {
    position: relative !important;
    overflow: hidden !important;
  }

  /* Long Press Feedback */
  .long-pressable {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
  }
}

/* ============================================
   IMAGE LAZY LOADING OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
  img[loading="lazy"],
  img[data-src] {
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
  }

  img[loading="lazy"].loaded,
  img[data-src].loaded {
    opacity: 1 !important;
  }

  /* Placeholder shimmer for lazy images */
  img[loading="lazy"]::before,
  img[data-src]::before {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 0%,
      rgba(255, 255, 255, 0.1) 50%,
      rgba(255, 255, 255, 0.05) 100%
    ) !important;
    background-size: 200% 100% !important;
    animation: shimmer 1.5s infinite !important;
    z-index: -1 !important;
  }

  @keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
  }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
  /* Reduce animations on low-end devices */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* GPU Acceleration - .mobile-menu hariç (translateX(-100%) override edilmesin) */
  .product-card,
  .category-card,
  .header-main {
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    will-change: transform !important;
  }

  /* Optimize scrolling */
  .container,
  .content-wrapper,
  main {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
  /* Larger touch targets - WCAG 2.1 Level AAA */
  button,
  a,
  input[type="button"],
  input[type="submit"],
  .btn,
  .clickable {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  /* Better focus indicators */
  button:focus,
  a:focus,
  input:focus,
  select:focus,
  textarea:focus {
    outline: 2px solid var(--primary-blue) !important;
    outline-offset: 2px !important;
    border-radius: 4px !important;
  }

  /* Better text contrast */
  body {
    -webkit-text-size-adjust: 100% !important;
    -ms-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
  }

  /* Skip to content link for screen readers */
  .skip-to-content {
    position: absolute !important;
    top: -40px !important;
    left: 0 !important;
    background: var(--primary-blue) !important;
    color: white !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    z-index: 10000 !important;
    text-decoration: none !important;
  }

  .skip-to-content:focus {
    top: 0 !important;
  }
}
