/* php/style.css */

:root {
  /* Simplified Light Palette */
  --bg-white: #ffffff;
  --bg-gray: #f8f9fa;
  --text-main: #1a1a1a;
  --text-muted: #666666;
  --accent-blue: #0066cc;
  --accent-blue-hover: #004499;
  --border-color: #dddddd;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Spacing */
  --container-max-width: 1100px;
}

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

body {
  background-color: var(--bg-white);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  color: #000;
  font-weight: 700;
  margin-bottom: 1rem;
}

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

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue);
  background: white;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn:hover {
  background: #f0f7ff;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-blue-hover);
  color: white;
}

/* Header & Footer */
.site-header {
  padding: 15px 0;
  border-bottom: 2px solid #000;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.search-form {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.search-form input {
  border: none;
  padding: 8px 12px;
  width: 200px;
  font-size: 14px;
}

.search-form input:focus {
  outline: none;
}

.search-form button {
  background: #eee;
  border: none;
  padding: 8px 15px;
  border-left: 1px solid var(--border-color);
  cursor: pointer;
}

.logo a {
  font-size: 28px;
  font-weight: 800;
  color: #000;
  text-transform: uppercase;
  letter-spacing: -1px;
}

.logo span {
  color: var(--accent-blue);
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 20px;
}

.main-nav a {
  font-weight: 600;
  color: #333;
}

.main-nav a:hover {
  color: var(--accent-blue);
  text-decoration: none;
}

.site-footer {
  padding: 40px 0;
  margin-top: 60px;
  border-top: 1px solid var(--border-color);
  background: #f9f9f9;
  color: var(--text-muted);
  text-align: center;
}

.footer-logo {
  font-size: 18px;
  font-weight: 700;
  color: #000;
  margin-bottom: 10px;
}

/* Glassmorphism class from Next.js styling */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* --- HOME/HERO STYLES (from page.module.css) --- */
.heroSection {
  min-height: 80vh;
  display: flex;
  align-items: center;
  background: radial-gradient(circle at top right, var(--navy-light), var(--navy));
  position: relative;
  overflow: hidden;
}

.heroSection::before {
  content: "";
  position: absolute;
  top: -10%;
  right: -10%;
  width: 40%;
  height: 60%;
  background: var(--teal-tint);
  filter: blur(100px);
  border-radius: 50%;
  z-index: 0;
}

.heroContent {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.heroTitle {
  font-size: clamp(40px, 8vw, 80px);
  line-height: 1.1;
  margin-bottom: 20px;
  color: var(--slate-lighter);
}

.heroTitle span {
  color: var(--teal);
}

.heroSubtitle {
  font-size: 18px;
  color: var(--slate-light);
  max-width: 540px;
  margin-bottom: 40px;
}

.heroActions {
  display: flex;
  gap: 20px;
}

/* --- CATALOG STYLES (from catalog.module.css) --- */
.catalogPage {
  padding-top: 40px;
}
.pageHeader {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
}
.pageHeader h1 {
  font-size: 36px;
  margin-bottom: 5px;
}
.pageHeader h1 span {
  color: var(--accent-blue);
}
.catalogIntro { color: var(--text-muted); }
.catalogIntro p { margin: 0; }
.catalogIntro a { color: var(--accent-blue); font-weight: 700; }
.aboutPage { max-width: 800px; padding-top: clamp(48px, 8vw, 80px); padding-bottom: clamp(48px, 8vw, 80px); }
.aboutCopy { color: var(--text-main); font-size: clamp(1rem, 1.4vw, 1.1rem); line-height: 1.8; }
.aboutCopy::after { content: ""; display: table; clear: both; }
.aboutCopy p { margin: 0 0 1.5rem; }
.aboutCopy a { font-weight: 700; }
.aboutPhoto {
  float: left;
  width: 148px;
  height: 148px;
  margin: 0.15rem 1.15rem 0.75rem 0;
  object-fit: cover;
  object-position: 30% 42%;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #f4f4f4;
}
.aboutSignoff { clear: both; margin-top: 2rem !important; font-style: italic; font-weight: 700; }
.aboutByline {
  display: block;
  margin-top: 0.35rem;
  font-style: normal;
  font-weight: 600;
  color: var(--text-muted);
}
@media (max-width: 600px) {
  .aboutPhoto {
    float: none;
    display: block;
    width: 120px;
    height: 120px;
    margin: 0 0 0.85rem;
  }
}
.categoriesGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.categoryCard {
  display: flex;
  height: 100%;
  min-height: 390px;
  padding: 25px;
  text-decoration: none;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #fff;
  transition: background 0.2s;
}
.categoryCard:hover {
  background: var(--bg-gray);
  border-color: var(--accent-blue);
}
.categoryCard h3 {
  margin-bottom: 10px;
  color: #000;
}
.categoryCard .cardContent {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
}
.categoryCard p {
  font-size: 14px;
  margin-bottom: 20px;
  color: var(--text-muted);
}
.categoryExample {
  display: flex;
  flex: 0 0 190px;
  flex-direction: column;
  justify-content: space-between;
  margin: 4px 0 18px !important;
  padding: 10px;
  border: 1px solid #d8e0e8;
  border-radius: 7px;
  background: #f8fafc;
  box-shadow: inset 0 1px 3px rgba(20, 45, 70, 0.08), 0 2px 5px rgba(20, 45, 70, 0.08);
}
.categoryExampleImage {
  display: flex;
  height: 140px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  background: #fff;
}
.categoryExampleImage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.categoryExamplePlaceholder {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.categoryExampleTitle {
  margin: 8px 4px 0 !important;
  overflow: hidden;
  color: var(--text-main) !important;
  font-size: 0.92rem !important;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.categoryCard .viewLink { margin-top: auto; }
.adminFilterBar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 20px; }
.adminHelp { color: var(--text-muted); margin: 0 0 16px; }
.adminFilters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.adminFilters label { display: grid; gap: 5px; font-size: 0.85rem; font-weight: 700; }
.adminFilters input, .adminFilters select { min-height: 38px; padding: 7px 9px; }
.adminQuickFilters { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.adminQuickFilters a { border: 1px solid var(--border-color); border-radius: 999px; color: var(--accent-blue); font-size: .9rem; font-weight: 700; padding: 6px 10px; text-decoration: none; }
.adminQuickFilters a.is-current { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
.bulkPartsActions { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 0 0 16px; }
.bulkPartsActions label { display: grid; gap: 5px; font-size: .85rem; font-weight: 700; }
.bulkPartsActions [data-bulk-category][hidden] { display: none; }
.bulkPartsActions select { min-height: 38px; padding: 7px 9px; }
.bulkPartsActions .deleteConfirm { display: flex; align-items: center; font-weight: 600; }
.categoryOrderInput { width: 5.5rem; padding: 0.45rem; }
.viewLink {
  color: var(--accent-blue);
  font-size: 14px;
  font-weight: 600;
}

.backLink {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--accent-blue);
  font-weight: 600;
}
.partsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.categoryTitleRow { display: flex; align-items: baseline; gap: 14px 18px; }
.categoryTitleRow h1 { margin: 0; }
.categorySubtitle { color: var(--text-muted); }
.catalogResults { padding-bottom: 0; }
.catalogToolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding: 12px 0; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.catalogFilterPanel { width: min(100%, 500px); margin-left: auto; }
.catalogFilterPanel summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 44px; padding: 10px 13px; border: 1px solid var(--border-color); border-radius: 6px; color: var(--accent-blue); cursor: pointer; font-weight: 700; list-style: none; }
.catalogFilterPanel summary::-webkit-details-marker { display: none; }
.catalogFilterPanel summary::after { content: '+'; font-size: 1.25rem; line-height: 1; }
.catalogFilterPanel[open] summary { border-color: var(--accent-blue); border-bottom-right-radius: 0; border-bottom-left-radius: 0; }
.catalogFilterPanel[open] summary::after { content: '−'; }
.catalogFilterSummary { color: var(--text-muted); font-size: .85rem; font-weight: 600; text-align: right; }
.catalogControls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 16px; border: 1px solid var(--border-color); border-top: 0; border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; background: var(--bg-gray); }
.catalogControls label {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}
.catalogControls select {
  min-height: 42px;
  padding: 8px 10px;
  color: var(--text-main);
  font: inherit;
}
.catalogResultCount { color: var(--text-muted); }
.cardImageWrapper { aspect-ratio: 4 / 3; background: #f9f9f9; }
.cardImage { width: 100%; height: 100%; object-fit: contain; display: block; }
.listingStatus { color: var(--text-muted); font-size: 0.85rem; margin: -3px 0 10px; text-transform: capitalize; }
.catalogPagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 32px; }
.catalogPagination a { min-width: 42px; padding: 9px 12px; border: 1px solid var(--border-color); border-radius: 4px; color: var(--accent-blue); text-align: center; text-decoration: none; }
.catalogPagination a.is-current { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
.partCard {
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #fff;
  text-decoration: none;
}
.partCard:hover {
  border-color: var(--accent-blue);
  text-decoration: none;
}
.imagePlaceholder {
  width: 100%;
  height: 200px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-color);
}
.placeholderBox {
  color: #999;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
}
.partInfo {
  padding: 20px;
}
.partHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.partHeader h3 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}
.sku {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.price {
  font-size: 18px;
  color: #000;
  font-weight: 700;
  margin-bottom: 10px;
}
.priceWithBadge,
.detailPriceWithBadge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.priceWithBadge {
  margin-bottom: 10px;
}
.priceWithBadge .price,
.detailPriceWithBadge .detailPrice {
  margin-bottom: 0;
}
.soldBadge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 3px;
  background: #c81919;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
}
.pendingBadge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 3px;
  background: #e3b505;
  color: #1a1a1a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
}
.soldPrice {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: currentColor;
}
.excerpt {
  font-size: 13px;
  margin-bottom: 15px;
  line-height: 1.5;
  color: var(--text-muted);
}

.partDetailLayout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 30px;
}
@media (max-width: 768px) {
  .partDetailLayout {
    grid-template-columns: 1fr;
  }
}
.mainImageWrapper {
  width: 100%;
  height: 400px;
  margin-bottom: 15px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #f9f9f9;
}
.mainImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cardImageWrapper {
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
  background: #fff;
}
.cardImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.thumbnailGrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.thumbnailWrapper {
  aspect-ratio: 1;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  cursor: pointer;
}
.thumbnailWrapper:hover {
  border-color: var(--accent-blue);
}
.thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detailSku {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  display: block;
  margin-bottom: 5px;
}
.detailTitle {
  font-size: 32px;
  margin-bottom: 10px;
  line-height: 1.2;
}
.detailPrice {
  font-size: 24px;
  color: #d00;
  font-weight: 700;
  margin-bottom: 30px;
}
.detailPriceWithBadge {
  margin-bottom: 30px;
}
.descriptionBox {
  margin-bottom: 30px;
}
.descriptionBox h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: #000;
  border-bottom: 1px solid #000;
  padding-bottom: 5px;
  margin-bottom: 15px;
}
.descriptionBox p {
  line-height: 1.6;
  color: #333;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}
.contactCard {
  background: var(--bg-gray);
  padding: 25px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}
.contactCard h3 {
  margin-bottom: 10px;
  font-size: 18px;
}
.contactCard p {
  font-size: 14px;
  margin-bottom: 15px;
}
.contactItemHelp {
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 13px;
}
.contactAutocomplete {
  position: relative;
}
.contactAutocompleteMenu {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.35rem);
  right: 0;
  left: 0;
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}
.contactAutocompleteMenu[hidden] {
  display: none;
}
.contactAutocompleteStatus {
  padding: 0.5rem 0.65rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.contactAutocompleteOption {
  display: block;
  width: 100%;
  padding: 0.7rem 0.75rem;
  color: var(--text-main);
  cursor: pointer;
  border-radius: 3px;
}
.contactAutocompleteOption + .contactAutocompleteOption {
  margin-top: 0.15rem;
}
.contactAutocompleteOption[aria-selected="true"],
.contactAutocompleteOption:hover {
  color: #0f172a;
  background: #e0f2fe;
}
.contactAutocompleteOptionName,
.contactAutocompleteOptionSku {
  display: block;
}
.contactAutocompleteOptionName {
  font-weight: 700;
}
.contactAutocompleteOptionSku {
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.contactContext {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-top: 0.75rem;
  padding: 0.8rem 1rem;
  color: #164e63;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  border-radius: 4px;
  font-size: 14px;
}
.contactContext[hidden] {
  display: none;
}
.contactContextLink {
  font-weight: 700;
}
.contactContextSummary {
  margin-top: 0.75rem;
}
.contactFieldLabel {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-main);
}
.requiredMarker {
  color: #b42318;
  font-size: 1.1em;
  margin-left: 0.15rem;
}
.optionalMarker {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-left: 0.35rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.fieldError,
.contactFormClientError {
  color: #b42318;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.45rem 0 0;
}
.contactFormClientError {
  padding: 0.85rem 1rem;
  background: #fff1f0;
  border: 1px solid #f4b7b1;
  border-radius: 4px;
}
.fieldError[hidden],
.contactFormClientError[hidden] {
  display: none;
}
.contactField input.contactFieldInvalid,
.contactField textarea.contactFieldInvalid,
.contactField input[aria-invalid="true"],
.contactField textarea[aria-invalid="true"] {
  border-color: #b42318 !important;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

/* --- ADMIN STYLES (from admin.module.css) --- */
.adminLayout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-gray);
}
.adminSidebar {
  width: 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 30px 15px;
  border-right: 1px solid var(--border-color);
  background: #fff;
}
.sidebarHeader h2 {
  font-size: 18px;
  margin-bottom: 30px;
  padding-left: 10px;
  color: #000;
}
.sidebarHeader h2 span {
  color: var(--accent-blue);
}
.adminNav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.adminNav a {
  padding: 10px 15px;
  border-radius: 4px;
  color: #444;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.adminNav a:hover {
  background: var(--bg-gray);
  color: var(--accent-blue);
}
.navDivider {
  height: 1px;
  background: var(--border-color);
  margin: 15px 0;
}
.adminMain {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

.adminTitle {
  font-size: 28px;
  margin-bottom: 30px;
  color: #000;
}
.adminSection {
  background: #fff;
  padding: 30px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  margin-bottom: 25px;
}
.adminTable {
  width: 100%;
  border-collapse: collapse;
}
.adminTable th {
  text-align: left;
  padding: 12px;
  border-bottom: 2px solid var(--border-color);
  color: #000;
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 700;
}
.adminTable td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  color: #333;
}
.actionBtn {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 3px;
  font-size: 12px;
  margin-right: 5px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}
.editBtn { background: #eee; color: #333; border: 1px solid #ccc; }
.deleteBtn { background: #fee; color: #d00; border: 1px solid #fcc; font-family: inherit; font-size: 12px; }

.statsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.statCard {
  background: #fff;
  padding: 20px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}
.statCard h3 {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 5px;
}
.statNumber {
  font-size: 32px;
  font-weight: 800;
  color: #000;
}

.pageHeaderActions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}
.actionGroup {
  display: flex;
  gap: 10px;
}

.adminForm {
  max-width: 800px;
}
.formGroup {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.formRow {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 15px;
}
@media (max-width: 600px) {
  .formRow {
    grid-template-columns: 1fr;
  }
}

/* --- IMAGE GALLERY --- */
.partDetailLayout {
  grid-template-areas: "gallery info";
  align-items: start;
}

.galleryColumn {
  grid-area: gallery;
  min-width: 0;
}

.infoColumn {
  grid-area: info;
  min-width: 0;
}

.mainImageWrapper {
  position: relative;
}

.galleryArrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #000;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.galleryArrow:hover {
  background: #fff;
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.galleryArrowPrevious { left: 12px; }
.galleryArrowNext { right: 12px; }
.galleryZoomButton {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 42px; height: 42px; border: 1px solid rgba(0,0,0,.18);
  border-radius: 50%; background: rgba(255,255,255,.92); color: #000;
  font-size: 21px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.galleryZoomButton:hover { color: var(--accent-blue); border-color: var(--accent-blue); }
.galleryLightbox[hidden] { display: none; }
.galleryLightbox { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 5vh 5vw; background: rgba(0,0,0,.92); }
.galleryLightbox img { max-width: 92vw; max-height: 90vh; object-fit: contain; }
.galleryLightboxClose { position: absolute; top: 18px; right: 24px; border: 0; background: transparent; color: #fff; font-size: 42px; line-height: 1; cursor: pointer; }
.galleryLightboxOpen { overflow: hidden; }

.galleryStatus {
  margin: -4px 0 10px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.thumbnailGrid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.thumbnailWrapper {
  appearance: none;
  padding: 0;
  background: #fff;
  cursor: pointer;
}

.thumbnailWrapper.is-active {
  border: 2px solid var(--accent-blue);
}

.thumbnailWrapper:focus-visible,
.galleryArrow:focus-visible,
.adminGalleryCard input:focus-visible,
.adminGalleryRotate button:focus-visible {
  outline: 3px solid rgba(0, 102, 204, 0.3);
  outline-offset: 2px;
}

/* Put the item identity above the image on a phone so a single large image
   never pushes the title below the first viewport. The full description and
   contact action remain immediately after the gallery. */
@media (max-width: 768px) {
  .partDetailLayout {
    grid-template-areas:
      "sku"
      "title"
      "price"
      "gallery"
      "description"
      "contact";
    grid-template-columns: 1fr;
  }

  .infoColumn {
    display: contents;
  }

  .detailSku { grid-area: sku; }
  .detailTitle { grid-area: title; margin-bottom: 6px; }
  .detailPriceWithBadge { grid-area: price; margin-bottom: 18px; }
  .descriptionBox { grid-area: description; margin-top: 22px; }
  .contactCard { grid-area: contact; }

  .mainImageWrapper {
    height: clamp(250px, 74vw, 360px);
    margin-bottom: 12px;
  }

  .thumbnailGrid {
    display: none;
  }
}

/* --- ADMIN IMAGE MANAGEMENT --- */
.adminNotice {
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid #e4c46d;
  border-radius: 4px;
  background: #fff8df;
  color: #5b4600;
  font-size: 14px;
}

.formHelp {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.galleryUploadGroup {
  padding: 18px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #fafafa;
}

.galleryUploadGroup input[type="file"] {
  padding: 8px;
}

.galleryUploadCount {
  color: var(--text-muted);
  font-size: 13px;
}

.adminGalleryGrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.adminGalleryCard {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: #fff;
}

.adminGalleryPreview {
  display: grid;
  place-items: center;
  width: 100%;
  height: clamp(104px, 11vw, 148px);
  overflow: hidden;
  margin-bottom: 8px;
  background: #f2f2f2;
}

.adminGalleryPreview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.adminGalleryCardActions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.adminGalleryPrimary,
.adminGalleryRemove {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.adminGalleryPrimary {
  color: var(--accent-blue);
  font-weight: 700;
}

.adminGalleryRotate {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.adminGalleryRotate button {
  min-height: 36px;
  padding: 6px;
  border: 1px solid var(--accent-blue);
  border-radius: 4px;
  background: #fff;
  color: var(--accent-blue);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.adminGalleryRotate button:hover {
  background: #eaf4ff;
}

.adminGalleryRemove {
  justify-content: center;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #e4a4a4;
  border-radius: 4px;
  background: #fff5f5;
  color: #8b1e1e;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
}

.adminGalleryRemove:hover {
  border-color: #b84a4a;
  background: #ffe8e8;
}

.adminGalleryRemove:focus-visible {
  outline: 3px solid rgba(139, 30, 30, 0.25);
  outline-offset: 2px;
}

.galleryManageStatus {
  min-height: 18px;
  margin: 10px 0 0;
  color: #8b1e1e;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 700px) {
  .adminGalleryGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .adminGalleryPreview {
    height: 120px;
  }
}

/* Category cards stay readable as a collection grows from one item to a
   full shelf. A wider desktop gets four columns; phones remain one column so
   names and prices do not become cramped. */
.partsGrid {
  align-items: stretch;
}

@media (min-width: 1400px) {
  .partsGrid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .partsGrid {
    grid-template-columns: 1fr;
  }

  .partCard .cardImageWrapper {
    aspect-ratio: 5 / 3;
  }
}
.formGroup label {
  font-size: 13px;
  color: #000;
  font-weight: 700;
}
.formGroup input, 
.formGroup select, 
.formGroup textarea {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: #000;
  font-size: 14px;
  font-family: inherit;
}
.formGroup input:focus, 
.formGroup select:focus, 
.formGroup textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}
.formActions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.adminLayoutTwoCol {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 30px;
}
@media (max-width: 1100px) {
  .adminLayoutTwoCol {
    grid-template-columns: 1fr;
  }
}

.mono {
  font-family: monospace;
}
.status-available {
  background: #e2f0d9;
  color: #2e7d32;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
}
.status-sold {
  background: #f8d7da;
  color: #721c24;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
}
.status-pending {
  background: #fff3cd;
  color: #856404;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
}

/* --- RESPONSIVE LAYOUT SYSTEM --- */
/* Keep the public site comfortable from a narrow phone through a wide desktop. */
html {
  overflow-x: hidden;
}

body {
  min-width: 320px;
}

.container {
  width: 100%;
  padding-inline: clamp(16px, 3vw, 20px);
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-header {
  padding: 14px 0;
}

.header-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "brand nav actions";
  align-items: center;
  gap: 20px 32px;
}

.logo {
  grid-area: brand;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: auto;
  height: 35px;
  object-fit: contain;
  flex: 0 0 auto;
}

.logo a {
  white-space: nowrap;
}

.header-tools {
  display: contents;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  min-height: 44px;
  padding: 8px 14px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: #222;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.menu-toggle-icon::before {
  content: '☰';
  font-size: 20px;
  line-height: 1;
}

.menu-toggle[aria-expanded='true'] .menu-toggle-icon::before {
  content: '×';
  font-size: 24px;
}

.main-nav {
  grid-area: nav;
  justify-self: center;
}

.header-actions {
  grid-area: actions;
  min-width: 0;
}

.search-form {
  min-height: 44px;
}

.search-form input {
  width: clamp(160px, 20vw, 240px);
  min-width: 0;
}

.search-form button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.heroSection {
  min-height: min(80vh, 760px);
  padding: clamp(72px, 10vh, 120px) 0;
}

.heroActions {
  flex-wrap: wrap;
}

.categoriesGrid,
.partsGrid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.categoryCard,
.partCard {
  min-width: 0;
}

.cardImageWrapper,
.imagePlaceholder {
  height: auto;
  aspect-ratio: 4 / 3;
}

.imagePlaceholder {
  min-height: 0;
}

.partHeader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.partHeader h3 {
  min-width: 0;
}

.partInfo {
  padding: clamp(16px, 2.5vw, 20px);
}

.partDetailLayout {
  gap: clamp(24px, 4vw, 40px);
}

.mainImageWrapper {
  height: clamp(280px, 42vw, 400px);
}

.detailTitle {
  font-size: clamp(28px, 5vw, 32px);
}

@media (max-width: 1024px) {
  .header-content {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand nav"
      "actions actions";
    gap: 12px 20px;
  }

  .main-nav {
    justify-self: end;
  }

  .header-actions,
  .search-form {
    width: 100%;
  }

  .search-form input {
    width: auto;
    flex: 1 1 auto;
  }
}

@media (max-width: 600px) {
  .site-header {
    padding: 12px 0 14px;
  }

  .header-content {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand menu"
      "tools tools";
    gap: 12px;
    position: relative;
  }

  .logo {
    grid-area: brand;
  }

  .logo a {
    font-size: clamp(20px, 6vw, 26px);
    letter-spacing: -0.7px;
  }

  .logo-mark {
    height: 30px;
  }

  .menu-toggle {
    display: inline-flex;
    grid-area: menu;
  }

  .header-tools {
    grid-area: tools;
    display: none;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
  }

  .header-content.menu-open .header-tools {
    display: flex;
  }

  .main-nav,
  .main-nav ul {
    width: 100%;
  }

  .main-nav {
    grid-area: auto;
    justify-self: stretch;
  }

  .header-actions {
    grid-area: auto;
  }

  .main-nav ul {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .main-nav a {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 14px;
  }

  .search-form {
    min-height: 46px;
  }

  .search-form input {
    font-size: 16px;
  }

  .site-header.is-scrolled {
    padding: 8px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  }

  .site-header.is-scrolled .logo-mark {
    height: 28px;
  }

  .catalogPage {
    padding-top: clamp(24px, 7vw, 40px);
  }

  .pageHeader {
    margin-bottom: 24px;
    padding-bottom: 16px;
  }

  .pageHeader h1 {
    font-size: clamp(28px, 8vw, 36px);
    line-height: 1.15;
  }

  .categoryTitleRow {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .categorySubtitle { margin: 0; }

  .categoriesGrid,
  .partsGrid {
    gap: 16px;
  }

  .categoryCard {
    padding: 20px;
  }

  .catalogToolbar { align-items: stretch; flex-direction: column; gap: 10px; }

  .catalogFilterPanel { width: 100%; max-width: none; margin-left: 0; }

  .catalogFilterPanel summary { align-items: flex-start; }

  .catalogFilterSummary { max-width: 11rem; }

  .catalogControls { display: grid; grid-template-columns: 1fr; }

  .catalogControls select,
  .catalogControls .btn { width: 100%; }

  .partHeader {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .heroSection {
    min-height: min(72svh, 620px);
    padding: clamp(56px, 12vh, 96px) 0;
  }

  .heroTitle {
    font-size: clamp(36px, 11vw, 52px);
    line-height: 1.05;
  }

  .heroSubtitle {
    font-size: 16px;
    margin-bottom: 28px;
  }

  .heroActions {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    max-width: 28rem;
  }

  .heroActions .btn {
    width: 100%;
  }

  .mainImageWrapper {
    height: clamp(260px, 72vw, 360px);
  }

  .thumbnailGrid {
    gap: 8px;
  }

  .contactCard {
    padding: 20px;
  }

  .site-footer {
    padding: 32px 0;
    margin-top: 48px;
  }
}

@media (max-width: 900px) and (min-width: 601px) {
  .categoriesGrid,
  .partsGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .adminMain {
    padding: 24px;
  }

  .adminTable {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 600px) {
  .adminLayout {
    display: block;
  }

  .adminSidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 16px;
  }

  .sidebarHeader h2 {
    margin-bottom: 16px;
  }

  .adminNav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .navDivider {
    grid-column: 1 / -1;
    margin: 8px 0;
  }

  .adminMain {
    padding: 16px;
  }

  .adminTitle {
    font-size: 24px;
    margin-bottom: 20px;
  }

  .adminSection {
    padding: 18px;
  }

  .pageHeaderActions {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .actionGroup,
  .formActions {
    flex-wrap: wrap;
  }
}
