/**
 * Comprehensive Responsive Layout Fixes
 * Mobile-first approach with enhanced breakpoints
 */

/* ========================================
   RESPONSIVE BREAKPOINTS
   - Mobile: < 640px
   - Tablet: 640px - 1023px
   - Desktop: 1024px+
======================================== */

/* ========================================
   CONTAINER FIXES
======================================== */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 640px) {
  .container {
    padding: 0 24px;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 0 32px;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 40px;
  }
}

/* ========================================
   PRODUCT GRID - FULLY RESPONSIVE
======================================== */
.products-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  width: 100%;
}

@media (min-width: 480px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }
}

@media (min-width: 1280px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
  }
}

/* ========================================
   PRODUCT CARD RESPONSIVE
======================================== */
.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 320px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(252, 177, 216, 0.15);
  transition: all 0.3s ease;
}

.product-card:hover,
.product-card:focus-within {
  box-shadow: 0 4px 16px rgba(252, 177, 216, 0.25);
  transform: translateY(-2px);
}

@media (max-width: 639px) {
  .product-card {
    min-height: 280px;
  }
}

.product-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f8f8f8;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.05);
}

.product-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 639px) {
  .product-info {
    padding: 12px;
    gap: 6px;
  }
}

.product-title {
  font-size: 16px;
  font-weight: 600;
  color: #202023;
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 639px) {
  .product-title {
    font-size: 14px;
  }
}

.product-price {
  font-size: 18px;
  font-weight: 700;
  color: #f6ccde;
  margin: 4px 0;
}

@media (max-width: 639px) {
  .product-price {
    font-size: 16px;
  }
}

/* ========================================
   NAVBAR RESPONSIVE
======================================== */
.modern-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
  .modern-navbar {
    padding: 20px 32px;
  }
}

@media (min-width: 1024px) {
  .modern-navbar {
    padding: 24px 40px;
  }
}

.navbar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  color: #202023;
}

@media (max-width: 639px) {
  .navbar-brand {
    font-size: 16px;
  }
  
  .navbar-brand img {
    max-height: 40px;
    width: auto;
  }
}

.navbar-menu {
  display: none;
  gap: 24px;
  align-items: center;
}

@media (min-width: 768px) {
  .navbar-menu {
    display: flex;
  }
}

.navbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

@media (max-width: 639px) {
  .navbar-actions {
    gap: 8px;
  }
}

.mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: #202023;
}

@media (min-width: 768px) {
  .mobile-toggle {
    display: none;
  }
}

/* ========================================
   CART & WISHLIST DROPDOWNS
======================================== */
.cart-dropdown,
.wishlist-dropdown {
  position: fixed;
  right: 0;
  top: 0;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  background: white;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

@media (max-width: 639px) {
  .cart-dropdown,
  .wishlist-dropdown {
    max-width: 100%;
  }
}

.cart-dropdown.active,
.wishlist-dropdown.active {
  transform: translateX(0);
}

.dropdown-header {
  padding: 20px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 639px) {
  .dropdown-header {
    padding: 16px;
  }
}

.dropdown-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

@media (max-width: 639px) {
  .dropdown-content {
    padding: 16px;
  }
}

.cart-item,
.wishlist-item {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;
}

@media (max-width: 639px) {
  .cart-item,
  .wishlist-item {
    gap: 10px;
    padding: 12px 0;
  }
}

.cart-item-image,
.wishlist-item-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

@media (max-width: 639px) {
  .cart-item-image,
  .wishlist-item-image {
    width: 60px;
    height: 60px;
  }
}

/* ========================================
   BUTTONS RESPONSIVE
======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1;
  min-height: 44px; /* Accessibility touch target */
}

@media (max-width: 639px) {
  .btn {
    padding: 10px 20px;
    font-size: 14px;
    min-height: 40px;
  }
}

.btn:focus-visible {
  outline: 2px solid #fcb1d8;
  outline-offset: 2px;
}

.btn-primary {
  background: #fcb1d8;
  color: #202023;
}

.btn-primary:hover {
  background: #f6ccde;
}

.btn-secondary {
  background: white;
  color: #202023;
  border: 2px solid #fcb1d8;
}

.btn-secondary:hover {
  background: #fcb1d8;
}

/* ========================================
   FORMS RESPONSIVE
======================================== */
.form-group {
  margin-bottom: 20px;
}

@media (max-width: 639px) {
  .form-group {
    margin-bottom: 16px;
  }
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s ease;
  min-height: 44px; /* Accessibility */
}

@media (max-width: 639px) {
  .form-control {
    padding: 10px 14px;
    font-size: 14px;
    min-height: 40px;
  }
}

.form-control:focus {
  outline: none;
  border-color: #fcb1d8;
  box-shadow: 0 0 0 3px rgba(252, 177, 216, 0.1);
}

/* ========================================
   LOADING STATES
======================================== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #fcb1d8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@media (max-width: 639px) {
  .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ========================================
   EMPTY STATES
======================================== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

@media (max-width: 639px) {
  .empty-state {
    padding: 32px 16px;
    font-size: 14px;
  }
}

.empty-state i {
  font-size: 48px;
  color: #ddd;
  display: block;
  margin-bottom: 16px;
}

@media (max-width: 639px) {
  .empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
  }
}

/* ========================================
   UTILITY CLASSES
======================================== */
.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;
}

.hide-mobile {
  display: none !important;
}

@media (min-width: 768px) {
  .hide-mobile {
    display: block !important;
  }
}

.hide-desktop {
  display: block !important;
}

@media (min-width: 768px) {
  .hide-desktop {
    display: none !important;
  }
}

/* ========================================
   FOCUS STYLES (Accessibility)
======================================== */
*:focus-visible {
  outline: 2px solid #fcb1d8;
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid #fcb1d8;
  outline-offset: 2px;
}

/* ========================================
   SKIP LINK (Accessibility)
======================================== */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #fcb1d8;
  color: #202023;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10000;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

/* ========================================
   REDUCED MOTION (Accessibility)
======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   HIGH CONTRAST (Accessibility)
======================================== */
@media (prefers-contrast: high) {
  .btn {
    border: 2px solid currentColor;
  }
  
  .product-card {
    border: 2px solid #202023;
  }
}
