/* ═══════════════════════════════════════
   iFix Electronics Store — Styles
   ═══════════════════════════════════════ */

:root {
  --nav-bg: #1a1a2e;
  --primary: #F2B637;
  --primary-hover: #d9a02f;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-dim: #9ca3af;
  --bg: #ffffff;
  --bg-alt: #f8f9fa;
  --border: #e5e7eb;
  --green: #10b981;
  --star: #f59e0b;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --max-width: 1200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

h1, h2, h3, h4, h5 { font-family: 'Poppins', system-ui, sans-serif; font-weight: 700; line-height: 1.3; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* ── Nav ── */
.nav {
  background: var(--nav-bg);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}
.nav-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.nav-logo span { color: var(--primary); }
.nav-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.nav-search input {
  width: 100%;
  padding: 8px 16px 8px 40px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 24px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.nav-search input::placeholder { color: rgba(255,255,255,0.4); }
.nav-search input:focus { border-color: var(--primary); background: rgba(255,255,255,0.12); }
.nav-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}
.nav-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}
.nav-search-results.open { display: block; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-alt); }
.search-result-item img { width: 36px; height: 36px; object-fit: contain; border-radius: 4px; }
.search-result-item .sr-title { font-weight: 600; }
.search-result-item .sr-cat { color: var(--text-dim); font-size: 0.72rem; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
  margin-left: auto;
}
.nav-links a {
  color: rgba(255,255,255,0.75);
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}
.nav-links a:hover { color: #fff; }
.nav-categories-dropdown { position: relative; }
.nav-categories-dropdown > a { cursor: pointer; }
.nav-cat-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: -20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 8px 0;
  z-index: 200;
}
.nav-categories-dropdown:hover .nav-cat-menu { display: block; }
.nav-cat-menu a {
  display: block;
  padding: 8px 20px;
  color: var(--text);
  font-size: 0.82rem;
  transition: background 0.15s;
}
.nav-cat-menu a:hover { background: var(--bg-alt); color: var(--text); }
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 5px 0;
  transition: transform 0.2s;
}

/* ── Hero ── */
.hero {
  background: var(--nav-bg);
  padding: 60px 20px;
  text-align: center;
  color: #fff;
}
.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 8px;
}
.hero h1 span { color: var(--primary); }
.hero p {
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 24px;
}
.hero-search {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}
.hero-search input {
  width: 100%;
  padding: 14px 24px 14px 48px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 32px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.hero-search input::placeholder { color: rgba(255,255,255,0.4); }
.hero-search input:focus { border-color: var(--primary); }
.hero-search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}

/* ── Category Grid ── */
.section { padding: 48px 20px; }
.section-alt { background: var(--bg-alt); }
.section-title {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 32px;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  max-width: var(--max-width);
  margin: 0 auto;
}
.category-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 12px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.category-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.category-card-icon {
  font-size: 1.8rem;
}
.category-card-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
}
.category-card-count {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ── Product Grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.product-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.product-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 16px;
  background: var(--bg-alt);
}
.product-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.product-card-brand { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.product-card-title { font-weight: 600; font-size: 0.85rem; margin-bottom: 8px; line-height: 1.4; flex: 1; }
.product-card-rating { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 0.75rem; }
.product-card-stars { color: var(--star); letter-spacing: -1px; }
.product-card-reviews { color: var(--text-dim); }
.product-card-price { font-weight: 800; font-size: 1.1rem; color: var(--text); }
.product-card-view { font-size: 0.78rem; color: var(--primary); font-weight: 600; margin-top: 8px; }

/* ── Product Detail ── */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  padding: 40px 0;
}
.product-detail-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.product-detail-info h1 { font-size: 1.6rem; margin-bottom: 8px; }
.product-detail-brand { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 16px; }
.product-detail-rating { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.product-detail-rating .stars { color: var(--star); font-size: 1.1rem; letter-spacing: -1px; }
.product-detail-rating .count { color: var(--text-secondary); font-size: 0.85rem; }
.product-detail-price {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.product-detail-price-note {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.btn-amazon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--primary);
  color: #000;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
}
.btn-amazon:hover { background: var(--primary-hover); color: #000; transform: translateY(-1px); }
.product-features { margin-top: 28px; }
.product-features h3 { font-size: 0.95rem; margin-bottom: 12px; }
.product-features ul { list-style: none; }
.product-features li {
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  padding-left: 20px;
  position: relative;
}
.product-features li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

/* ── Breadcrumbs ── */
.breadcrumbs {
  padding: 16px 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.breadcrumbs a { color: var(--text-secondary); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span { margin: 0 6px; }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-count { font-size: 0.82rem; color: var(--text-dim); }
.sort-select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  background: var(--bg);
  cursor: pointer;
}
.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover, .filter-btn.active { background: var(--primary); color: #000; border-color: var(--primary); font-weight: 600; }

/* ── Trending ── */
.trending-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  max-width: var(--max-width);
  margin: 0 auto;
}
.trending-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.trending-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.trending-card img { width: 100%; aspect-ratio: 1; object-fit: contain; margin-bottom: 8px; }
.trending-card .tc-title { font-size: 0.72rem; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.trending-card .tc-price { font-size: 0.85rem; font-weight: 800; }

/* ── Related ── */
.related-section { padding: 48px 0; border-top: 1px solid var(--border); margin-top: 48px; }
.related-section h2 { font-size: 1.2rem; margin-bottom: 24px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ── Footer ── */
.footer {
  background: var(--nav-bg);
  color: rgba(255,255,255,0.7);
  padding: 48px 20px 24px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 40px;
}
.footer h4 {
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.footer a { color: rgba(255,255,255,0.6); font-size: 0.8rem; display: block; margin-bottom: 8px; text-decoration: none; }
.footer a:hover { color: var(--primary); }
.footer-bottom {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
}
.footer-affiliate {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.3);
  margin-top: 8px;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .category-grid { grid-template-columns: repeat(4, 1fr); }
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .trending-grid { grid-template-columns: repeat(3, 1fr); }
  .related-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    padding: 16px 20px;
    gap: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .nav-search { max-width: none; }
  .hero h1 { font-size: 1.6rem; }
  .hero { padding: 40px 20px; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .product-detail { grid-template-columns: 1fr; gap: 24px; }
  .trending-grid { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .toolbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .category-card { padding: 14px 10px; }
  .category-card-icon { font-size: 1.4rem; }
  .category-card-name { font-size: 0.78rem; }
}
