/* --- PetroMart UI (modular, production-ready vanilla JS) --- */
:root{
  --bg: #111;
  --panel: #111826;
  --panel2: #0f1522;
  --text: #e8eef7;
  --muted: #9fb0c5;
  --border: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0,0,0,.25);
  --radius: 14px;
  --accent: #6ee7ff;
  --danger: #ff6b6b;
  --ok: #7CFFB2;
}

*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a{ color: inherit; }
button, input, select { font: inherit; }

.header{
    width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: rgba(17, 24, 38, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.logo{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 0 0 rgba(0,0,0,0);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.logo:hover{ transform: translateY(-1px); border-color: rgba(255,255,255,.16); box-shadow: var(--shadow); }

.search input{
  width: 100%;
  max-width: 640px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15,21,34,.7);
  color: var(--text);
  outline: none;
}
.search input::placeholder{ color: rgba(159,176,197,.7); }
.search input:focus{ border-color: rgba(110,231,255,.35); box-shadow: 0 0 0 3px rgba(110,231,255,.12); }

.cart{
  background: rgba(15,21,34,.7);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease;
}
.cart:hover{ transform: translateY(-1px); border-color: rgba(255,255,255,.16); }
.pill{
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(110,231,255,.14);
  border: 1px solid rgba(110,231,255,.22);
  margin-left: 8px;
  font-size: 12px;
}

.categories{
width: 100%;
  position: fixed;
  top: 74px;
  left: 0;
  z-index: 9;
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  overflow-x: auto;
  background: rgba(15, 21, 34, .75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.categories::-webkit-scrollbar{ height: 8px; }
.categories::-webkit-scrollbar-thumb{ background: rgba(255,255,255,.10); border-radius: 999px; }

.cat-pill{
  border: 1px solid var(--border);
  background: rgba(17,24,38,.55);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s ease, transform .15s ease;
}
.cat-pill:hover{ transform: translateY(-1px); border-color: rgba(255,255,255,.16); }
.cat-pill.active{
  border-color: rgba(110,231,255,.38);
  background: rgba(110,231,255,.12);
}

.app{
  padding: 18px 12px 60px;
  max-width: 1200px;
  margin: 0 auto;
  margin-top: calc(74px + 60px);
  display: flex;
  flex-direction: column;
}

.product-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 16px;
}
.card{
  background: rgba(17,24,38,.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 0 0 rgba(0,0,0,0);
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover{
  transform: translateY(-2px);
  border-color: rgba(255,255,255,.16);
  box-shadow: var(--shadow);
}

.product-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  padding: 0;              /* remove extra internal spacing */
  overflow: hidden;
}

.product-card .img {
  width: 100%;
  aspect-ratio: 1 / 1;     /* perfect square image */
  background: rgba(255,255,255,.04);
  display: flex;
  align-items: center;
  justify-content: center;
  /*padding: 12px;*/
}

.product-card .img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.product-card .content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;                /* consistent spacing */
}

.product-card h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
  min-height: 38px;        /* keeps cards aligned */
}

.product-card .price {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
}


.button{
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(110,231,255,.14);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, border-color .15s ease;
}
.button:hover{ transform: translateY(-1px); border-color: rgba(110,231,255,.35); }
.button:disabled{ opacity: .55; cursor: not-allowed; transform: none; }

.button.secondary{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.10);
}

.stack{ display: grid; gap: 12px; }
.row{ display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread{ display:flex; justify-content: space-between; align-items:center; gap: 10px; }

.page-title{
  margin: 10px 0 6px;
  font-size: 22px;
}
.muted{ color: var(--muted); }

/* Pagination */
.pagination{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
}

/* Global loader */
.global-loader{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}
.hidden{ display: none !important; }
.spinner{
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255,255,255,.7);
  border-top: 4px solid rgba(255,255,255,0);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin{ to { transform: rotate(360deg); } }

/* Toast */
.toast{
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: rgba(17,24,38,.92);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 1000;
}
.toast.ok{ border-color: rgba(124,255,178,.25); }
.toast.err{ border-color: rgba(255,107,107,.25); }

/* Skeletons */
.skeleton{
  pointer-events: none;
}
.sk-img, .sk-line{
  background: rgba(255,255,255,.08);
  animation: shimmer 1.2s ease-in-out infinite;
}
.sk-img{
  height: 190px;
}
.sk-line{
  height: 14px;
  margin: 10px 12px;
  border-radius: 8px;
}
.sk-line.small{ width: 55%; }

@keyframes shimmer{
  0%{ opacity: .55; }
  50%{ opacity: .95; }
  100%{ opacity: .55; }
}

hr.sep{
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

/* Product page */
.product{
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}
.product .media{
  padding: 12px;
}
.product .media img{
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}
.product .details{
  padding: 12px;
}
.product .desc{
  color: var(--muted);
  line-height: 1.55;
}

.product-card {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp .4s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scroll-loader {
  display: flex;
  justify-content: center;
  padding: 20px;
  opacity: 0.8;
}

.scroll-loader span {
  width: 8px;
  height: 8px;
  margin: 0 4px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 0.6s infinite alternate;
}

.scroll-loader span:nth-child(2) { animation-delay: 0.2s; }
.scroll-loader span:nth-child(3) { animation-delay: 0.4s; }

.carousel {
  position: relative;
}

.carousel-main {
  position: relative;
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-main img {
  max-height: 400px;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  border: none;
  color: white;
  font-size: 24px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
}

.carousel-btn span {
    margin-bottom: 4px;
}

.carousel-btn.left {
  left: 10px;
}

.carousel-btn.right {
  right: 10px;
}

.carousel-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
}

.carousel-thumbs .thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  cursor: pointer;
  border-radius: 6px;
  opacity: 0.7;
  transition: 0.2s;
}

.carousel-thumbs .thumb:hover {
  opacity: 1;
}


/* ========================= */
/* PRODUCT PAGE - DESKTOP   */
/* ========================= */

.product {
  max-width: 1200px;
  margin: 0 auto;
}

.product-main {
  display: grid;
  grid-template-columns: 500px 1fr;
  gap: 40px;
  align-items: start;
}

.media.card {
  padding: 20px;
  background: rgba(255,255,255,0.02);
}

.details.card {
  padding: 24px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
}

.price-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0;
}

.price-sale {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
}

.price-regular {
  font-size: 18px;
  text-decoration: line-through;
  color: var(--muted);
}

.sale-badge {
  background: #ff6b6b;
  color: white;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.gst-label {
  font-size: 12px;
  background: rgba(255,255,255,.08);
  padding: 5px 10px;
  border-radius: 6px;
}

.stock.in {
  color: #7CFFB2;
  font-weight: 600;
}

.sold-count {
  font-size: 13px;
  color: var(--muted);
}

.section-title {
  font-size: 20px;
  margin: 20px 0 10px;
  font-weight: 600;
}

/* Related/Upsell Grid */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 16px;
  margin-top: 10px;
}

/* Mobile */
@media (max-width: 900px){
  .product-main {
    grid-template-columns: 1fr;
  }
  .related-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 16px;
      margin-top: 10px;
    }
}


@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}



/* Mobile */
@media (max-width: 860px){
    .product-grid{
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 16px;
    }
  .header{ grid-template-columns: auto 1fr auto; }
  .product{ grid-template-columns: 1fr; }
}
