/* search.css - Final version for GoEnjoy search page */
/* Modern, clean, and responsive design with consistent typography and spacing */

:root {
  --primary: #1d4ed8;
  --primary-600: #2563eb;
  --primary-500: #3b82f6;
  --primary-100: #dbeafe;
  --ring: #93c5fd;
  --bg: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --card: #ffffff;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(2, 6, 23, 0.08);
  --shadow-hover: 0 10px 28px rgba(2, 6, 23, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary);
  text-decoration: underline;
}

main {
  max-width: 1200px;
  margin: 18px auto;
  padding: 0 16px 30px;
}

/* Toolbar (Search and Filter Form) */
.toolbar {
  display: grid;
  gap: 10px;
  grid-template-columns: 1.4fr 0.9fr 0.9fr 0.9fr 0.9fr auto;
  margin: 8px 0 14px;
}

@media (max-width: 1100px) {
  .toolbar {
    grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr auto;
  }
}

@media (max-width: 900px) {
  .toolbar {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .toolbar {
    grid-template-columns: 1fr;
  }
}

.input, .select, .btn {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: #0b1324;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05) inset;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus, .select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

.btn {
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--primary-600);
  border-color: #1e40af;
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary);
  border-color: #1e3a8a;
}

.btn-ghost {
  background: #fff;
  color: var(--primary-600);
  border-color: #93c5fd;
}

.btn-ghost:hover {
  background: var(--primary-100);
  border-color: var(--primary-500);
}

/* Stats/Chips */
.stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  color: #0b1324;
  font-size: 13px;
}

.chip b {
  font-weight: 700;
}

/* Product Grid */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.thumb {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  background: var(--primary-100);
  display: block;
}

.content {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.title {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.price {
  font-weight: 800;
  font-size: 16px;
  color: #0b1324;
}

.old {
  text-decoration: line-through;
  color: #94a3b8;
  font-size: 13px;
}

/* Pagination */
.pager {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.page {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  color: #0b1324;
  font-size: 14px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.page.active {
  background: var(--primary-600);
  border-color: #1e40af;
  color: #fff;
  font-weight: 700;
}

.page:hover {
  border-color: var(--primary-500);
  background: var(--primary-100);
}

/* Empty State */
.empty {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.empty h3 {
  margin: 0 0 6px;
  color: var(--primary-600);
  font-size: 20px;
}

/* Fallback Header */
.header-fallback {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.header-fallback a {
  font-weight: 800;
  color: var(--primary-600);
  text-decoration: none;
}

/* Accessibility Enhancements */
[aria-label] {
  position: relative;
}

[aria-label]:focus::after {
  content: attr(aria-label);
  position: absolute;
  top: -30px;
  left: 0;
  background: #0b1324;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 10;
}

/* Smooth Scroll Behavior */
html {
  scroll-behavior: smooth;
}

/* Ensure images don't overflow */
img {
  max-width: 100%;
  height: auto;
}

/* Consistent Focus States */
:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}