/* Complete Mobile Responsive Design for Google Pixel 8a and similar devices */
/* Target dimensions: 393px × 851px and similar modern phones */

/* Base mobile styles - applies to all screens 480px and below */
@media (max-width: 480px) {
  
  /* Reset and base styles */
  * {
    box-sizing: border-box !important;
  }
  
  html {
    font-size: 14px !important;
    -webkit-text-size-adjust: 100% !important;
    -ms-text-size-adjust: 100% !important;
  }
  
  body {
    overflow-x: hidden !important;
    min-width: 320px !important;
    padding-top: 60px !important; /* Account for fixed nav */
    margin: 0 !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
  }
  
  /* NAVIGATION - UNIFORM ACROSS ALL PAGES */
  .nav {
    height: 60px !important;
    padding: 8px 15px !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1000 !important;
    background: white !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  }
  
  .nav-wrapper {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 44px !important;
  }
  
  /* Logo */
  .logo {
    flex: 0 0 auto !important;
    margin: 0 !important;
  }
  
  .logo img {
    height: 28px !important;
    width: auto !important;
  }
  
  /* Hide desktop user actions */
  .user-actions,
  .auth-buttons,
  .user-menu {
    display: none !important;
  }
  
  /* Mobile menu toggle */
  .menu-toggle {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    width: 24px !important;
    height: 18px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    z-index: 1001 !important;
  }
  
  .menu-toggle span {
    width: 24px !important;
    height: 2px !important;
    background-color: #333 !important;
    transition: all 0.3s ease !important;
    display: block !important;
  }
  
  /* Mobile dropdown menu */
  .nav-links {
    position: fixed !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: white !important;
    flex-direction: column !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    transform: translateY(-100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: all 0.3s ease !important;
    z-index: 999 !important;
    max-height: calc(100vh - 60px) !important;
    overflow-y: auto !important;
  }
  
  .nav-links.active {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: all !important;
  }
  
  .nav-links a {
    padding: 14px 20px !important;
    border-bottom: 1px solid #f0f0f0 !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #333 !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    transition: background-color 0.2s ease !important;
  }
  
  .nav-links a:hover,
  .nav-links a.active {
    background-color: #f8f9fa !important;
    color: var(--accent, #2c5aa0) !important;
  }
  
  /* HERO SECTIONS - ALL PAGES */
  .hero,
  .faq-hero,
  .about-hero,
  .contact-hero,
  .sell-hero {
    padding: 30px 15px !important;
    text-align: center !important;
    min-height: auto !important;
  }
  
  .hero h1,
  .faq-hero h1,
  .about-hero h1,
  .contact-hero h1,
  .sell-hero h1 {
    font-size: 24px !important;
    line-height: 1.3 !important;
    margin-bottom: 12px !important;
    padding: 0 10px !important;
  }
  
  .hero p,
  .faq-hero p,
  .about-hero p,
  .contact-hero p,
  .sell-hero p {
    font-size: 14px !important;
    line-height: 1.5 !important;
    margin-bottom: 20px !important;
    padding: 0 10px !important;
  }
  
  /* BUTTONS - UNIFORM SIZING */
  .btn-primary,
  .btn-secondary,
  .btn-sell,
  .action-btn,
  button[type="submit"] {
    padding: 12px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    width: auto !important;
    min-width: 120px !important;
    text-align: center !important;
    display: inline-block !important;
    margin: 5px !important;
  }
  
  /* SELL PAGE - PRODUCT GRID */
  .product-grid,
  .brand-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 15px !important;
    padding: 0 15px !important;
    margin: 20px 0 !important;
  }
  
  .product-card,
  .brand-card {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 15px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    background: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
  }
  
  .product-card img,
  .brand-card img {
    width: 100% !important;
    height: 150px !important;
    object-fit: contain !important;
    margin-bottom: 10px !important;
  }
  
  .product-card h3,
  .brand-card h3 {
    font-size: 16px !important;
    margin-bottom: 8px !important;
    line-height: 1.3 !important;
  }
  
  .product-card p,
  .brand-card p {
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin-bottom: 10px !important;
  }
  
  .product-card .price,
  .brand-card .price {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--accent, #2c5aa0) !important;
    margin-bottom: 10px !important;
  }
  
  /* FORMS - ALL PAGES */
  .form-group {
    margin-bottom: 15px !important;
    width: 100% !important;
  }
  
  .form-group label {
    display: block !important;
    margin-bottom: 5px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100% !important;
    padding: 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
  }
  
  /* CONTAINERS AND SECTIONS */
  .container,
  .dashboard-container,
  .checkout-container {
    max-width: 100% !important;
    padding: 0 15px !important;
    margin: 0 auto !important;
  }
  
  section {
    padding: 30px 15px !important;
  }
  
  /* TABLES - RESPONSIVE */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  table {
    min-width: 100% !important;
    font-size: 12px !important;
  }
  
  table th,
  table td {
    padding: 8px 6px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }
  
  /* DASHBOARD SPECIFIC */
  .dashboard-stats {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin: 20px 0 !important;
  }
  
  .stat-card {
    padding: 15px !important;
    text-align: center !important;
  }
  
  .stat-card h3 {
    font-size: 18px !important;
    margin-bottom: 5px !important;
  }
  
  .stat-card p {
    font-size: 12px !important;
    margin: 0 !important;
  }
  
  /* CHECKOUT SPECIFIC */
  .checkout-progress {
    padding: 15px !important;
    overflow-x: auto !important;
  }
  
  .progress-step {
    min-width: 60px !important;
    font-size: 11px !important;
  }
  
  .checkout-step {
    padding: 20px 15px !important;
  }
  
  /* CART SPECIFIC */
  .cart-item {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 15px !important;
    border-bottom: 1px solid #eee !important;
  }
  
  .cart-item img {
    width: 80px !important;
    height: 80px !important;
    margin-bottom: 10px !important;
  }
  
  .cart-item-details {
    width: 100% !important;
  }
  
  .cart-item-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    margin-bottom: 5px !important;
  }
  
  .cart-item-price {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--accent, #2c5aa0) !important;
  }
  
  /* FOOTER */
  footer {
    padding: 30px 15px !important;
  }
  
  .footer-container {
    display: block !important;
  }
  
  .footer-column {
    margin-bottom: 20px !important;
    width: 100% !important;
  }
  
  .footer-column h4 {
    font-size: 16px !important;
    margin-bottom: 10px !important;
  }
  
  .footer-column ul li {
    margin-bottom: 8px !important;
  }
  
  .footer-column ul li a {
    font-size: 14px !important;
  }
}

/* Medium mobile screens (up to 600px) */
@media (max-width: 600px) and (min-width: 481px) {
  
  .product-grid,
  .brand-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }
  
  .dashboard-stats {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* Large mobile screens and small tablets (up to 768px) */
@media (max-width: 768px) and (min-width: 601px) {
  
  .product-grid,
  .brand-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px !important;
  }
  
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Tablet screens (up to 992px) */
@media (max-width: 992px) and (min-width: 769px) {
  
  .product-grid,
  .brand-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  
  .dashboard-stats {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  
  /* Still hide desktop user actions */
  .user-actions {
    display: none !important;
  }
  
  .menu-toggle {
    display: flex !important;
  }
}

/* Mobile user actions in dropdown */
.mobile-user-actions {
  border-top: 2px solid #eee !important;
  margin-top: 10px !important;
}

.mobile-user-actions a,
.mobile-user-actions button {
  padding: 14px 20px !important;
  border-bottom: 1px solid #f0f0f0 !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  color: #333 !important;
  text-decoration: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  background: none !important;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  width: 100% !important;
  text-align: left !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease !important;
}

.mobile-user-actions a:hover,
.mobile-user-actions button:hover {
  background-color: #f8f9fa !important;
  color: var(--accent, #2c5aa0) !important;
}

.mobile-user-actions button {
  color: #dc3545 !important;
}

.mobile-user-actions button:hover {
  background-color: #fff5f5 !important;
  color: #dc3545 !important;
}

.mobile-cart-count {
  background-color: var(--accent, #2c5aa0) !important;
  color: white !important;
  border-radius: 50% !important;
  width: 20px !important;
  height: 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  min-width: 20px !important;
  margin-left: auto !important;
}

/* Hamburger menu animation */
.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px) !important;
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0 !important;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px) !important;
}

/* Prevent horizontal scroll on all mobile devices */
@media (max-width: 992px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100% !important;
  }
  
  * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Specific fixes for very small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
  .hero h1,
  .faq-hero h1,
  .about-hero h1,
  .contact-hero h1,
  .sell-hero h1 {
    font-size: 20px !important;
  }
  
  .product-card,
  .brand-card {
    padding: 12px !important;
  }
  
  .btn-primary,
  .btn-secondary,
  .btn-sell {
    padding: 10px 16px !important;
    font-size: 13px !important;
  }
}

/* Loading states and animations */
.loading {
  opacity: 0.7 !important;
  pointer-events: none !important;
}

/* Ensure images don't break layout */
img {
  max-width: 100% !important;
  height: auto !important;
}

/* Fix for any absolute positioned elements */
@media (max-width: 480px) {
  .absolute,
  [style*="position: absolute"] {
    position: relative !important;
  }
}