/* ==========================================================================
   shop.css — E-commerce: product grid, cart, checkout, auth, payments, wishlist
   ========================================================================== */

/* overflow safety (shop-specific) */
.product-grid, .cat-grid, .chips, .toolbar, .drawer, .modal-panel, .pay-grid {
  max-width: 100% !important;
  box-sizing: border-box !important;
}
.product-media i,
.cat-icon i,
.why-card i {
  width: 1.25em !important;
  height: 1.25em !important;
  max-width: 2rem !important;
  max-height: 2rem !important;
  font-size: 1.5rem !important;
  line-height: 1 !important;
}
.product-media i { font-size: 2rem !important; max-width: 3rem !important; max-height: 3rem !important; }

.toolbar { display: flex; flex-direction: column; gap: 0.65rem; margin-bottom: 1rem; }
.search { position: relative; }
.search i {
  position: absolute; inset-inline-start: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 0.9rem;
}
.search input {
  width: 100%; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.85rem 1rem 0.85rem 2.6rem; outline: none; background: #fff;
}
.search input:focus { border-color: var(--black); box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
.toolbar-meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; font-size: 0.85rem; color: var(--muted);
}
#sortSelect {
  border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.8rem; background: #fff;
}
.chips {
  display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.5rem; margin-bottom: 0.75rem;
}
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.78rem;
  font-weight: 500; cursor: pointer; color: var(--muted);
}
.chip.active { background: var(--black); border-color: var(--black); color: #fff; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.product-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column; transition: .15s;
}
.product-card:hover { box-shadow: 0 10px 28px rgba(0,0,0,.07); border-color: transparent; }
.product-media {
  aspect-ratio: 1; background: #fafafa; display: grid; place-items: center; position: relative;
  overflow: hidden;
}
.product-media img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
  padding: 0.75rem;
  display: block;
}
.product-media i { font-size: 2rem; color: #bbb; }
.product-sku {
  position: absolute; top: 0.55rem; inset-inline-start: 0.55rem;
  background: #fff; border-radius: 6px; font-size: 0.68rem; font-weight: 700;
  padding: 0.2rem 0.45rem; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.product-body { padding: 0.8rem; display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.product-body h3 {
  font-size: 0.86rem; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-cat { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.product-price { font-weight: 800; font-size: 0.95rem; margin-top: 0.25rem; }
.product-price small { font-weight: 500; color: var(--muted); font-size: 0.75rem; }
.product-learn {
  font-size: 0.75rem; font-weight: 700; color: var(--red);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.product-actions {
  margin-top: auto; padding-top: 0.55rem;
  display: flex; gap: 0.4rem; align-items: center;
}
.qty-input {
  width: 56px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0.4rem; text-align: center;
}
.product-actions .btn { flex: 1; }
.wish-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  width: 38px; height: 38px; cursor: pointer; color: var(--muted);
}
.wish-btn.active { color: var(--red); border-color: var(--red); }

.pager {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; margin-top: 1.75rem;
}
.page-btn {
  min-width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 600; font-size: 0.85rem;
}
.page-btn.active { background: var(--black); color: #fff; border-color: var(--black); }

/* Cart drawer */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 80;
}
.drawer-backdrop[hidden], .modal[hidden], .drawer[hidden] { display: none !important; }
.drawer {
  position: fixed; top: 0; inset-inline-end: 0; bottom: 0; width: min(100%, 400px);
  background: #fff; z-index: 90; box-shadow: -8px 0 30px rgba(0,0,0,.08);
  display: flex; flex-direction: column;
}
html[dir='rtl'] .drawer { box-shadow: 8px 0 30px rgba(0,0,0,.08); }
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); font-weight: 800;
}
.drawer-body { flex: 1; overflow: auto; padding: 1rem; }
.drawer-foot { border-top: 1px solid var(--line); padding: 1rem; display: grid; gap: 0.65rem; }
.cart-line {
  display: flex; justify-content: space-between; gap: 0.5rem;
  border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem; margin-bottom: 0.55rem;
}
.cart-line strong { font-size: 0.88rem; }
.cart-line .meta { font-size: 0.75rem; color: var(--muted); }
.empty-cart { text-align: center; color: var(--muted); padding: 2rem 0.5rem; }

/* Auth + payment modals */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 1rem;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.3); }
.modal-panel {
  position: relative; background: #fff; width: min(100%, 460px);
  border-radius: 18px; padding: 1.35rem; z-index: 1;
  box-shadow: 0 20px 50px rgba(0,0,0,.12); max-height: 92vh; overflow: auto;
}
.modal-panel.wide { width: min(100%, 560px); }
.modal-panel h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.35rem; }
.modal-panel .sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 1rem; }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem;
  background: var(--soft); padding: 4px; border-radius: 12px; margin-bottom: 1rem;
}
.auth-tabs button {
  border: 0; background: transparent; border-radius: 10px;
  padding: 0.65rem 0.4rem; font-weight: 700; font-size: 0.82rem; cursor: pointer; color: var(--muted);
}
.auth-tabs button.active { background: #fff; color: var(--black); box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.field { display: grid; gap: 0.3rem; margin-bottom: 0.7rem; }
.field label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.8rem; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--black); }
.dev-otp {
  background: #fff8e6; border: 1px solid #ffe0a3; color: #8a5a00;
  border-radius: 10px; padding: 0.55rem 0.75rem; font-size: 0.8rem; margin-bottom: 0.7rem;
}
.auth-note { font-size: 0.78rem; color: var(--muted); margin-top: 0.75rem; line-height: 1.45; }
.close-x {
  position: absolute; top: 0.75rem; inset-inline-end: 0.75rem;
  width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--soft); cursor: pointer;
}
.btn-google {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 0.75rem; font-weight: 600; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 0.5rem; margin-bottom: 0.75rem;
}
.btn-google:hover { background: var(--soft); }
.divider {
  display: flex; align-items: center; gap: 0.75rem; color: var(--muted);
  font-size: 0.78rem; margin: 0.75rem 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

/* Payment methods grid */
.pay-grid { display: grid; gap: 0.55rem; margin-bottom: 1rem; }
.pay-option {
  border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 0.9rem;
  display: flex; align-items: center; gap: 0.65rem; cursor: pointer; background: #fff;
}
.pay-option input { accent-color: var(--red); }
.pay-option.active { border-color: var(--red); background: var(--red-soft); }
.pay-option strong { display: block; font-size: 0.9rem; }
.pay-option span { font-size: 0.75rem; color: var(--muted); }
.pay-logos { display: flex; gap: 0.35rem; flex-wrap: wrap; font-size: 0.7rem; color: var(--muted); }
.locked-banner {
  background: #fff8e6; border: 1px solid #ffe0a3; border-radius: 12px;
  padding: 0.85rem 1rem; font-size: 0.88rem; margin-bottom: 1rem; color: #6b4e00;
}

/* Dealer page */
.dealer-hero {
  background: linear-gradient(180deg, #fafafa, #fff);
  border-bottom: 1px solid var(--line);
  padding: 2.5rem 0;
}
.dealer-hero h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; margin-bottom: 0.5rem; }
.dealer-hero p { color: var(--muted); max-width: 560px; }
.dealer-form-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 1.5rem; max-width: 520px; margin: 2rem auto;
  box-shadow: 0 8px 28px rgba(0,0,0,.05);
}

/* Admin shells */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-side {
  background: #111; color: #fff; padding: 1.25rem 1rem;
}
.admin-side a {
  display: block; color: rgba(255,255,255,.8); padding: 0.55rem 0.75rem;
  border-radius: 8px; margin-bottom: 0.25rem; font-size: 0.9rem;
}
.admin-side a:hover, .admin-side a.active { background: rgba(255,255,255,.1); color: #fff; }
.admin-main { padding: 1.5rem; background: #f5f5f5; }
.admin-card {
  background: #fff; border-radius: 12px; border: 1px solid var(--line);
  padding: 1rem; margin-bottom: 1rem;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--line); padding: 0.55rem 0.4rem; text-align: start;
}
.admin-table th { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }
.stat-box {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem;
}
.stat-box strong { display: block; font-size: 1.4rem; font-weight: 800; }
.stat-box span { font-size: 0.78rem; color: var(--muted); }

@media (min-width: 769px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
}
@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 768px) {
  .product-grid, .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .product-learn { display: none; }
  .product-body { padding: 0.6rem; }
  .product-body h3 { font-size: 0.8rem; }
  .product-price { font-size: 0.85rem; }
  .product-actions { flex-wrap: wrap; gap: 0.3rem; }
  .qty-input { width: 44px; padding: 0.3rem; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { display: flex; flex-wrap: wrap; gap: 0.25rem; }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .product-cat { display: none; }
}
