/* public/css/main.css — Store-facing styles */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Montserrat:wght@600;700;800&display=swap');

/* ── Custom properties ─────────────────────────────────────── */
:root {
  --c-primary:   #1C2B4A;
  --c-accent:    #C9922A;
  --c-accent-lt: #F0C97A;
  --c-bg:        #F5F3EF;
  --c-surface:   #FFFFFF;
  --c-text:      #1A1A1A;
  --c-muted:     #6B7280;
  --c-border:    #E5E1DA;
  --c-danger:    #DC2626;
  --c-success:   #16A34A;
  --font-body:   'Roboto', system-ui, sans-serif;
  --font-head:   'Montserrat', system-ui, sans-serif;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:   0 12px 40px rgba(0,0,0,.14);
  --r:           8px;
  --r-lg:        16px;
  --sidebar-w:   260px;
  --header-h:    64px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
ul { list-style: none; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.8rem); }
h3 { font-size: 1.1rem; }

/* ── Site Header ────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-primary);
  color: #fff;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 2rem;
  box-shadow: var(--shadow-md);
}
.site-logo {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--c-accent-lt);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.site-logo span { color: #fff; }
.site-nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}
.site-nav a {
  padding: 0.5rem 1rem;
  border-radius: var(--r);
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  transition: background .15s, color .15s;
}
.site-nav a:hover, .site-nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.header-search {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.1);
  border-radius: var(--r);
  padding: 0.4rem 0.8rem;
  gap: 0.5rem;
  flex: 0 0 240px;
}
.header-search input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  width: 100%;
  font-size: 0.88rem;
}
.header-search input::placeholder { color: rgba(255,255,255,.5); }
.header-search svg { color: rgba(255,255,255,.6); flex-shrink: 0; }

/* ── Layout: Sidebar + Main ─────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
  max-width: 1440px;
  margin: 0 auto;
}
.sidebar {
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  padding: 1.25rem 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.main-content {
  padding: 1.75rem 2rem;
  min-width: 0;
}

/* ── Product Grid ───────────────────────────────────────────── */
.store-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.products-header-text { font-size: .9rem; color: var(--c-muted); }
.products-header-text strong { color: var(--c-text); font-weight: 600; }

.products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.products-header h2 { font-size: 1.1rem; color: var(--c-muted); font-weight: 500; }
.products-header h2 strong { color: var(--c-text); }
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

/* ── Product card skeleton ──────────────────────────────────── */
.product-card-skeleton {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.skeleton-img { aspect-ratio: 4/3; }
.skeleton-body { padding: 1rem; }
.skeleton-line { height: 12px; border-radius: 6px; margin-bottom: .5rem; }
.skeleton-line.long  { width: 85%; }
.skeleton-line.short { width: 50%; }

/* ── Product Card (custom element) ─────────────────────────── */
product-card {
  display: contents;
}
.product-card-inner {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.product-card-inner:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.product-card-thumb {
  aspect-ratio: 4 / 3;
  background: var(--c-bg);
  overflow: hidden;
  position: relative;
}
.product-card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.product-card-inner:hover .product-card-thumb img { transform: scale(1.04); }
.product-card-thumb .no-image {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-border);
}
.product-card-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.product-card-cat {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--c-accent);
}
.product-card-name {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--c-text);
}
.product-card-actions {
  margin-top: auto;
  padding-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--r);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: #26365e; }
.btn-accent  { background: var(--c-accent); color: #fff; }
.btn-accent:hover  { background: #b0801e; }
.btn-outline { border: 1.5px solid var(--c-border); color: var(--c-text); background: transparent; }
.btn-outline:hover { border-color: var(--c-accent); color: var(--c-accent); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-full { width: 100%; }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ── Category Nav (custom element) ─────────────────────────── */
category-nav { display: contents; }
.cat-nav-section {
  padding: 0 0.75rem 0.5rem;
}
.cat-nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--c-muted);
  padding: 0.6rem 0.75rem 0.3rem;
}
.cat-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  border-radius: var(--r);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background .12s, color .12s;
  user-select: none;
}
.cat-nav-item:hover { background: var(--c-bg); }
.cat-nav-item.active { background: var(--c-primary); color: #fff; font-weight: 600; }
.cat-nav-item .cat-toggle {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: transform .2s;
  flex-shrink: 0;
}
.cat-nav-item.open .cat-toggle { transform: rotate(90deg); }
.cat-nav-children {
  padding-left: 0.75rem;
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
}
.cat-nav-children.open { max-height: 400px; }
.cat-nav-child-item {
  display: block;
  padding: 0.35rem 0.75rem;
  border-radius: var(--r);
  font-size: 0.83rem;
  cursor: pointer;
  color: var(--c-muted);
  transition: background .12s, color .12s;
  border-left: 2px solid transparent;
  margin: 1px 0;
}
.cat-nav-child-item:hover { background: var(--c-bg); color: var(--c-text); }
.cat-nav-child-item.active {
  color: var(--c-accent);
  border-left-color: var(--c-accent);
  font-weight: 600;
  background: rgba(201,146,42,.06);
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 0.4rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}
.pagination button {
  width: 36px; height: 36px;
  border-radius: var(--r);
  border: 1.5px solid var(--c-border);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--c-muted);
  transition: all .15s;
}
.pagination button:hover:not([disabled]) { border-color: var(--c-accent); color: var(--c-accent); }
.pagination button.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.pagination button[disabled] { opacity: .35; }

/* ── Product Detail ─────────────────────────────────────────── */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}
.product-detail-info { display: flex; flex-direction: column; gap: 1rem; }
.product-breadcrumb {
  font-size: 0.82rem;
  color: var(--c-muted);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.product-breadcrumb a:hover { color: var(--c-accent); }
.product-name-lg {
  font-family: var(--font-head);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
}
.product-description {
  color: var(--c-muted);
  line-height: 1.7;
  font-size: 0.95rem;
}
.product-cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(201,146,42,.1);
  color: var(--c-accent);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
}

/* ── Related products section ───────────────────────────────── */
.related-section { margin-top: 3rem; padding: 0 2rem 2rem; }
.related-section h3 { margin-bottom: 1.25rem; }

/* ── Toast Notification (custom element) ───────────────────── */
toast-notify { display: contents; }
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--r-lg);
  min-width: 260px;
  max-width: 380px;
  pointer-events: all;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
}
.toast.success { background: var(--c-success); color: #fff; }
.toast.error   { background: var(--c-danger);  color: #fff; }
.toast.info    { background: var(--c-primary); color: #fff; }
.toast-msg { font-size: 0.88rem; font-weight: 500; flex: 1; }
.toast-close { opacity: .7; font-size: 1.1rem; cursor: pointer; padding: 0.1rem; }
.toast-close:hover { opacity: 1; }
@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateX(120%); opacity: 0; }
}
.toast.removing { animation: toastOut .25s ease forwards; }

/* ── Inquiry Modal (custom element) ─────────────────────────── */
inquiry-modal { display: contents; }
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn .15s ease;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  animation: slideUp .2s ease;
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--c-border);
}
.modal-header h3 { font-size: 1.05rem; }
.modal-close { font-size: 1.4rem; color: var(--c-muted); padding: 0.2rem 0.4rem; border-radius: 4px; }
.modal-close:hover { background: var(--c-bg); color: var(--c-text); }
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.modal-product-ref {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--c-bg);
  border-radius: var(--r);
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  color: var(--c-muted);
}
.modal-product-ref strong { color: var(--c-text); }
.modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Form elements ──────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label { font-size: 0.83rem; font-weight: 600; color: var(--c-text); }
.form-label .req { color: var(--c-danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 0.9rem;
  transition: border-color .15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--c-accent);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 0.78rem; color: var(--c-muted); }
.form-error { font-size: 0.78rem; color: var(--c-danger); }

/* ── Image Gallery (custom element) ─────────────────────────── */
image-gallery { display: contents; }
.gallery-main {
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-bg);
  position: relative;
}
.gallery-main img {
  width: 100%; height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.gallery-thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.gallery-thumb {
  width: 64px; height: 64px;
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.gallery-thumb.active { border-color: var(--c-accent); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.9);
  z-index: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.gallery-lightbox.hidden { display: none; }
.gallery-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--r);
}
.gallery-lb-close {
  position: absolute; top: 1.5rem; right: 1.5rem;
  color: #fff; font-size: 2rem; cursor: pointer;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
}
.gallery-lb-close:hover { background: rgba(255,255,255,.2); }

/* ── Loading / Empty states ─────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--c-bg) 25%, var(--c-border) 50%, var(--c-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--c-muted);
}
.empty-state svg { width: 64px; height: 64px; opacity: .3; margin: 0 auto 1rem; }
.empty-state h3 { color: var(--c-text); margin-bottom: 0.5rem; }

/* ── Site Footer ────────────────────────────────────────────── */
.site-footer {
  background: var(--c-primary);
  color: rgba(255,255,255,.7);
  padding: 3rem 2rem 2rem;
  margin-top: 4rem;
}
.footer-grid {
  max-width: 1200px; margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-col h4 { color: #fff; font-family: var(--font-head); margin-bottom: 0.75rem; font-size: 0.9rem; }
.footer-col p, .footer-col a { font-size: 0.85rem; line-height: 2; display: block; }
.footer-col a:hover { color: var(--c-accent-lt); }
.footer-bottom { text-align: center; font-size: 0.8rem; border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.5rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
  }
  .product-detail {
    grid-template-columns: 1fr;
  }
  .header-search { display: none; }
}
@media (max-width: 600px) {
  .main-content { padding: 1rem; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; }
  .site-header { padding: 0 1rem; gap: 1rem; }
}
