/* Store — Mobile & Responsive */

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */
@media (max-width: 768px) {
  .store-container {
    padding: var(--space-4);
    gap: var(--space-7);
  }

  .store-header {
    padding: var(--space-10) var(--space-6);
    border-radius: var(--radius-lg);
  }

  .store-name {
    font-size: var(--text-2xl);
  }

  .store-description {
    font-size: var(--text-base);
  }

  .cart-icon {
    width: 60px;
    height: 60px;
    bottom: 20px;
    right: 20px;
  }

  /* Categories Navigation - Tablet */
  .categories-nav {
    padding: var(--space-4) var(--space-4);
    gap: var(--space-3);
    margin: 0 -16px;
  }

  .categories-nav::before,
  .categories-nav::after {
    width: 30px;
    margin-right: -30px;
  }

  .categories-nav::after {
    margin-left: -30px;
    margin-right: 0;
  }

  .category-btn {
    padding: 11px 18px;
    font-size: var(--text-sm);
  }

  .products-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }

  .product-image {
    height: 220px;
  }

  .product-info {
    padding: var(--space-5);
  }

  .product-name {
    font-size: var(--text-lg);
  }

  .product-price {
    font-size: var(--text-2xl);
  }

  /* Cart Modal Mobile */
  .modal-content {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-top: auto;
  }

  .modal-header {
    padding: var(--space-6) var(--space-5) var(--space-5);
  }

  .modal-header h2 {
    font-size: var(--text-lg);
  }

  .cart-item {
    grid-template-columns: 64px 1fr;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
  }

  .cart-item-image {
    width: 64px;
    height: 64px;
  }

  .cart-item-info h4 {
    font-size: var(--text-sm);
  }

  .cart-item-quantity {
    grid-column: 1 / -1;
    justify-content: space-between;
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
  }

  .cart-item-total {
    display: none;
  }

  .remove-item {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
  }

  .cart-summary {
    padding: var(--space-5);
  }

  .cart-total {
    margin-bottom: var(--space-5);
  }

  .total-amount {
    font-size: var(--text-2xl);
  }

  .cart-actions {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .cart-actions .btn {
    padding: var(--space-4);
  }

  /* Payment Modal Mobile */
  .payment-methods {
    padding: var(--space-5);
    gap: var(--space-3);
  }

  .payment-option {
    padding: var(--space-4);
  }

  .payment-option-icon {
    width: 48px;
    height: 48px;
    font-size: var(--text-2xl);
    margin-right: var(--space-4);
  }

  .payment-option-info h4 {
    font-size: var(--text-base);
  }

  .payment-option-info p {
    font-size: var(--text-xs);
  }

  .notification {
    left: 16px;
    right: 16px;
    max-width: none;
    top: auto;
    bottom: 24px;
    transform: translateY(calc(100% + 40px));
  }

  .notification.show {
    transform: translateY(0);
  }
}

@media (max-width: 480px) {

  /* Store Header - Compact for small screens */
  .store-header {
    padding: var(--space-8) var(--space-4);
    margin: var(--space-2);
    border-radius: var(--radius);
  }

  .store-name {
    font-size: var(--text-xl);
    margin-bottom: var(--space-3);
  }

  .store-description {
    font-size: var(--text-sm);
    margin-bottom: var(--space-5);
    line-height: var(--leading-normal);
  }

  .contact-link {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    gap: var(--space-3);
  }

  .contact-link i {
    font-size: var(--text-lg);
  }

  /* Categories - Sticky Horizontal Scroll on Small Screens */
  .categories-nav {
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
    background: var(--background-color);
    padding: var(--space-3) var(--space-4);
    margin: 0 -8px;
    box-shadow: var(--shadow-soft);
  }

  .category-btn {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    min-height: 40px;
    gap: var(--space-2);
    border-width: 1.5px;
  }

  .category-btn i {
    font-size: var(--text-sm);
  }

  .category-btn .category-count {
    font-size: var(--text-xs);
    padding: 2px 5px;
    min-width: 18px;
    height: 18px;
  }

  /* Products Grid - Card style adjustments */
  .products-grid {
    gap: var(--space-4);
    padding: 0 var(--space-1);
  }

  .product-card {
    border-radius: var(--radius);
  }

  .product-image {
    height: 180px;
  }

  .product-info {
    padding: var(--space-4);
  }

  .product-name {
    font-size: var(--text-base);
    margin-bottom: var(--space-2);
  }

  .product-category {
    font-size: var(--text-xs);
    margin-bottom: var(--space-2);
  }

  .product-description {
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .product-price {
    font-size: var(--text-xl);
    margin-bottom: var(--space-4);
  }

  .btn {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
  }

  /* Search bar mobile */
  .store-search-container {
    padding: 0 var(--space-2);
    margin-bottom: var(--space-4);
  }

  .store-search-box input {
    font-size: var(--text-base);
    /* Prevents iOS zoom */
  }

  /* View toggle */
  .view-toggle-container {
    padding: var(--space-3) var(--space-2);
  }

  /* Featured section */
  .featured-section {
    padding: 0 var(--space-1);
  }

  .section-header {
    padding: 0 var(--space-2);
  }
}

/* Dark mode is handled exclusively via [data-theme="dark"] selectors
   in css/store/dark-mode.css. Do not use prefers-color-scheme here
   to avoid conflicts with the JS-toggled dark mode system. */

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

  .cart-icon,
  .modal,
  .notification,
  .store-footer {
    display: none !important;
  }

  .store-header {
    background: var(--bg-muted);
    color: #0f172a;
    print-color-adjust: exact;
  }

  .product-card {
    break-inside: avoid;
  }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */
/* prefers-reduced-motion is handled globally in css/reset.css */

.cart-icon:focus-visible,
.payment-option:focus-visible,
.category-btn:focus-visible,
.close-modal:focus-visible,
.product-card:focus-visible,
.quantity-btn:focus-visible,
.mobile-nav-item:focus-visible,
.view-toggle-btn:focus-visible,
.share-store-btn:focus-visible,
.store-dark-mode-toggle:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 2px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
/* .hidden is defined globally in css/reset.css */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


/* ============================================
   STORE QR CODE SHARE BUTTON & MODAL
   ============================================ */

/* Floating Share Store Button */
.share-store-btn {
  position: fixed;
  right: 20px;
  top: 100px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: var(--z-modal);
  transition: var(--transition-bounce);
  color: var(--primary-color);
  font-size: var(--text-xl);
}

.share-store-btn:hover {
  transform: translateY(-4px) scale(1.1);
  box-shadow: var(--shadow-xl);
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
}

.share-store-btn:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .share-store-btn {
    width: 50px;
    height: 50px;
    right: 16px;
    top: auto;
    bottom: 90px;
    font-size: var(--text-xl);
  }
}

/* Store QR Modal */
.store-qr-modal-content {
  max-width: 380px;
  text-align: center;
  border-radius: var(--radius-xl);
}

.store-qr-body {
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.store-qr-display {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-body) 0%, var(--bg-muted) 100%);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  min-height: 220px;
  min-width: 220px;
}

.store-qr-display canvas {
  animation: qrZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes qrZoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.store-qr-info {
  text-align: center;
}

.store-qr-info h3 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: var(--space-2);
}

.store-qr-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: 0;
}

.store-qr-hint i {
  color: var(--success-color);
}

.store-qr-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  padding: var(--space-5) var(--space-6);
  background: linear-gradient(180deg, var(--background-color) 0%, var(--bg-muted) 100%);
  border-top: 1px solid var(--border-light);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.store-qr-footer .btn {
  flex: 1;
  padding: 0.85rem var(--space-5);
}

@media (max-width: 480px) {
  .store-qr-modal-content {
    margin: var(--space-4);
    max-width: calc(100vw - 2rem);
  }

  .store-qr-body {
    padding: var(--space-5);
  }

  .store-qr-display {
    min-height: 200px;
    min-width: 200px;
    padding: var(--space-4);
  }

  .store-qr-footer {
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4);
  }

  .store-qr-footer .btn {
    width: 100%;
  }
}


/* ============================================
   BOTTOM MOBILE NAVIGATION - App Style
   ============================================ */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-light);
  display: none;
  z-index: var(--z-modal);
  padding: var(--space-2) 0 env(safe-area-inset-bottom, 8px);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  .store-footer {
    padding-bottom: 100px;
  }

  .cart-icon {
    bottom: 90px;
  }

  .share-store-btn {
    bottom: 160px;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 600;
  transition: var(--transition);
  border-radius: var(--radius);
  position: relative;
}

.mobile-nav-item i {
  font-size: var(--text-xl);
  transition: var(--transition);
}

.mobile-nav-item.active {
  color: var(--primary-color);
}

.mobile-nav-item.active i {
  transform: scale(1.1);
}

.mobile-nav-item.active::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--primary-gradient);
  border-radius: 3px;
}

.mobile-nav-item:active {
  transform: scale(0.95);
}

.nav-cart-badge {
  position: absolute;
  top: 2px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--primary-gradient);
  color: white;
  font-size: var(--text-xs);
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ============================================
   iOS & ANDROID MOBILE OPTIMIZATIONS
   ============================================ */

/* Safe area support for iOS notch and Android gesture navigation */
@supports (padding: max(0px)) {
  .store-container {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(100px, calc(80px + env(safe-area-inset-bottom)));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .cart-icon {
    bottom: max(20px, calc(20px + env(safe-area-inset-bottom)));
  }

  .modal-content {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

/* Enhanced touch targets for mobile */
@media (max-width: 768px) {

  /* Minimum touch target sizes (44x44 per iOS Human Interface Guidelines) */
  .btn,
  .category-btn,
  .close-modal,
  .quantity-btn,
  .payment-option {
    min-height: 44px;
    min-width: 44px;
  }

  /* Improved tap states for mobile */
  .btn:active,
  .category-btn:active,
  .payment-option:active,
  .product-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  /* Prevent text selection during fast taps */
  .btn,
  .category-btn,
  .payment-option {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  /* Better form inputs for mobile */
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: var(--text-base);
    /* Prevents iOS zoom on focus */
    -webkit-appearance: none;
    appearance: none;
    border-radius: var(--radius);
  }

  /* Smooth scrolling for iOS */
  .cart-items,
  .modal-body {
    scroll-behavior: smooth;
  }

  /* Modal improvements for mobile */
  .modal-content {
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 90vh;
    max-height: 90dvh;
    /* Dynamic viewport height for mobile browsers */
  }

  /* Customer info modal mobile optimizations */
  .customer-info-content,
  .order-confirm-content {
    max-width: 100%;
    width: 100%;
  }

  /* Improve product card touch experience */
  .product-card {
    -webkit-tap-highlight-color: transparent;
  }

  /* Notifications at bottom on mobile */
  .notification {
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 24px));
    left: 16px;
    right: 16px;
    max-width: none;
  }
}

/* Extra small screens (iPhone SE, small Android phones) */
@media (max-width: 375px) {
  .store-name {
    font-size: var(--text-xl);
  }

  .store-description {
    font-size: var(--text-sm);
  }

  .category-btn {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
  }

  .product-info {
    padding: var(--space-4);
  }

  .product-name {
    font-size: var(--text-base);
  }

  .product-price {
    font-size: var(--text-xl);
  }

  .delivery-type-selector {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .delivery-option-content {
    flex-direction: row;
    justify-content: flex-start;
    padding: var(--space-3) var(--space-4);
  }

  .checkout-progress {
    padding: var(--space-4) var(--space-2);
  }

  .progress-step .step-number {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
  }

  .progress-line {
    width: 20px;
  }
}

/* Landscape mode optimizations */
@media (max-height: 500px) and (orientation: landscape) {
  .modal-content {
    max-height: 95vh;
    overflow-y: auto;
  }

  .customer-form-section form {
    padding: var(--space-4);
  }

  .form-group {
    margin-bottom: var(--space-3);
  }

  .checkout-progress {
    padding: var(--space-3) var(--space-2);
  }

  .progress-step .step-number {
    width: 30px;
    height: 30px;
    font-size: var(--text-xs);
  }

  .order-preview {
    padding: var(--space-3);
    margin-top: var(--space-4);
  }
}

/* ============================================
   ADDITIONAL MOBILE POLISH
   ============================================ */

/* Touch device specific improvements */
@media (hover: none) and (pointer: coarse) {

  /* Disable hover transforms for touch - use active states instead */
  .product-card:hover {
    transform: none;
  }

  .product-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .category-btn:hover {
    transform: none;
  }

  .btn:hover {
    transform: none;
  }

  .btn:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  /* Enhanced touch feedback */
  .payment-option:active {
    background: var(--primary-bg-hover);
    border-color: var(--primary-color);
  }
}

/* ============================================
   MOBILE PRODUCT CARDS - Delivery App Style
   Clean horizontal layout with image on left.
   Uses .store-container ancestor for specificity
   instead of !important.
   ============================================ */

@media (max-width: 768px) {

  .store-container .products-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: 0 var(--space-2);
  }

  .store-container .product-card {
    display: flex;
    flex-direction: row;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
    box-shadow: var(--shadow);
    border: 1px solid var(--tint-black-6);
    min-height: 130px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .store-container .product-card:active {
    transform: scale(0.98);
  }

  .store-container .product-card .product-image {
    width: 130px;
    min-width: 130px;
    height: 130px;
    flex-shrink: 0;
    border-radius: 16px 0 0 16px;
  }

  .store-container .product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .store-container .product-card .product-info {
    flex: 1;
    padding: var(--space-4) var(--space-4);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
  }

  .store-container .product-card .product-name {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-1);
    line-height: var(--leading-snug);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-color);
  }

  .store-container .product-card .product-category {
    font-size: var(--text-xs);
    margin-bottom: var(--space-2);
    color: var(--primary-color);
    opacity: 1;
  }

  .store-container .product-card .product-category::before {
    width: 6px;
    height: 6px;
  }

  .store-container .product-card .product-description {
    display: none;
  }

  .store-container .product-card .product-price {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-3);
    color: var(--text-color);
  }

  .store-container .product-card .product-actions {
    position: static;
    opacity: 1;
    transform: none;
    display: flex;
    flex-direction: row;
    gap: var(--space-2);
    margin-top: auto;
  }

  .store-container .product-card .product-actions .btn {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    border-radius: var(--radius);
    flex: 1;
  }

  .store-container .product-card .product-actions .add-to-cart-btn {
    order: -1;
  }

  .store-container .product-card .product-actions .whatsapp-order-btn {
    display: none;
  }

  .store-container .product-card .product-badges,
  .store-container .product-card .product-badge {
    top: 8px;
    left: 8px;
    right: auto;
  }

  .store-container .product-card .product-badge,
  .store-container .product-card .badge {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
  }

  .store-container .quick-add-floating,
  .store-container .product-image-actions {
    display: none;
  }

  .store-container .featured-carousel {
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3) var(--space-4);
  }

  .store-container .featured-card {
    flex: 0 0 200px;
    border-radius: var(--radius-md);
  }

  .store-container .featured-card .product-image {
    height: 140px;
    width: 100%;
    border-radius: 16px 16px 0 0;
  }

  .store-container .featured-card .featured-overlay {
    padding: 50px 14px 14px;
  }

  .store-container .featured-card .featured-overlay h3 {
    font-size: var(--text-sm);
  }

  .store-container .featured-card .featured-overlay .price {
    font-size: var(--text-lg);
  }

  .store-container .featured-card .quick-add-btn {
    width: 40px;
    height: 40px;
    font-size: var(--text-lg);
    bottom: 14px;
    right: 14px;
  }
}

/* Small phones */
@media (max-width: 400px) {
  .store-container .products-grid {
    gap: var(--space-3);
    padding: 0 6px;
  }

  .store-container .product-card .product-image {
    width: 110px;
    min-width: 110px;
    height: 110px;
  }

  .store-container .product-card {
    min-height: 110px;
  }

  .store-container .product-card .product-info {
    padding: var(--space-3) var(--space-4);
  }

  .store-container .product-card .product-name {
    font-size: var(--text-sm);
  }

  .store-container .product-card .product-price {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
  }

  .store-container .product-card .product-actions .btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }

  .store-container .product-card .product-category {
    display: none;
  }

  .store-container .featured-card {
    flex: 0 0 160px;
  }

  .store-container .featured-card .product-image {
    height: 110px;
  }
}

/* List view on mobile - same horizontal style */
@media (max-width: 768px) {
  .store-container .products-grid.list-view {
    display: flex;
    flex-direction: column;
  }

  .store-container .products-grid.list-view .product-card {
    display: flex;
    flex-direction: row;
  }
}

