/* responsive.css - Responsive Design */

/* Single column layout for products grid */
.products-grid.single-column .product-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.products-grid.single-column .product-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background-color: var(--surface);
  width: 100%;
}

.products-grid.single-column .product-card-image,
.products-grid.single-column .product-card-image-placeholder {
  width: 80px;
  height: 80px;
  margin-right: 1rem;
  flex-shrink: 0;
}

.products-grid.single-column .product-card-info {
  flex: 1;
  text-align: left;
}

.products-grid.single-column .product-card-name {
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.products-grid.single-column .product-card-price {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.products-grid.single-column .product-card-button {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Small devices (mobile) */
@media (max-width: 1024px) {
  .hide-mobile {
    display: none !important;
  }

  html {
    font-size: 14px;
  }

  .container-mobile {
    padding: 1rem;
  }

  .grid-mobile-1 {
    grid-template-columns: 1fr !important;
  }

  .text-mobile-sm {
    font-size: 0.875rem;
  }

  .p-mobile-4 {
    padding: 1rem !important;
  }

  /* Favorite button - reduce size for mobile */
  .product-card-favorite {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    top: 8px;
    right: 8px;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1;
  }

  .product-card-favorite svg {
    width: 14px !important;
    height: 12px !important;
    flex-shrink: 0;
    display: block;
  }

  .product-card-favorite svg path {
    vector-effect: non-scaling-stroke;
  }

  /* Table view on mobile - hide images and adjust layout */
  .products-grid.table-view .product-card-image,
  .products-grid.table-view .product-card-image-placeholder {
    width: 0;
    height: 0;
    margin-right: 0;
    display: none;
  }

  .products-grid.table-view .product-card-info {
    margin-right: 0.5rem;
  }

  .products-grid.table-view .product-card-name {
    font-size: 0.75rem;
    margin-bottom: 0.125rem;
  }

  .products-grid.table-view .product-card-price {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
  }

  .products-grid.table-view .product-card-button {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    min-width: 70px;
  }

  .products-grid.table-view .product-card {
    padding: 0.5rem;
    border-radius: 0.25rem;
  }

  .products-grid.table-view .product-grid {
    gap: 0.5rem;
  }

  .products-grid.table-view .product-group {
    margin-bottom: 0.75rem;
  }

  .products-grid.table-view .product-group-title {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
  }
}

/* Medium devices (tablet) - 1025px to 1200px */
@media (min-width: 1025px) and (max-width: 1200px) {
  .hide-tablet {
    display: none !important;
  }

  .grid-tablet-2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  #groups {
    display: grid;
    gap: 1.5rem;
  }

  /* Table view maintains single column layout on tablet */
  #groups.table-view .product-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  /* Ensure search input container wraps properly at 1115px */
  .search-input-container {
    flex: 1 1 auto;
    min-width: 0;
  }

  .search-section>div:first-child {
    flex: 1 1 100%;
    min-width: 0;
  }

  .search-section>div:last-child {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0.75rem 0 0 0;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .search-section {
    flex-wrap: wrap;
    max-width: 100%;
  }
}



/* Large devices (desktop) - 1201px+ */
@media (min-width: 1201px) {
  .hide-desktop {
    display: none !important;
  }

  .grid-desktop-3 {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  /* Product cards fit width on desktop - use more specific selector */
  #groups .product-group {
    display: block;
  }

  #groups .product-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
  }

  /* Table view maintains single column layout on desktop */
  #groups.table-view .product-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
}

/* Extra Large devices (large desktop) - 1440px+ */
@media (min-width: 1440px) {
  #groups .product-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
  }

  /* Table view maintains single column layout on extra large screens */
  #groups.table-view .product-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
  button {
    padding: 0.75rem 1.25rem;
    min-height: 44px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
    /* Prevents zoom on iOS */
  }
}

/* Landscape mode */
@media (max-height: 500px) and (orientation: landscape) {
  header {
    padding: 0.5rem;
  }

  main {
    padding: 1rem 0;
  }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
  * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Accessibility - Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }

  body {
    background-color: #0f172a;
    color: #e2e8f0;
  }

  input,
  select,
  textarea {
    background-color: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
  }
}