/* =========================================================
   Ahad Online — app.css (ditulis manual, tanpa build tool)
   Mobile-first: dirancang dari lebar 375px.
   ========================================================= */

:root {
  --brand: #0d6efd;
  --brand-dark: #0a58ca;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --surface: #f5f7fb;
  --radius: 12px;
  --nav-h: 62px;
  --shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
}

* {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--surface);
  color: var(--ink);
  padding-bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom, 0px));
}

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

img {
  max-width: 100%;
}

/* ---------- Target sentuh minimal 44px ---------- */
.btn {
  min-height: 44px;
}

.btn-sm {
  min-height: 36px;
}

.form-control,
.form-select {
  min-height: 44px;
}

textarea.form-control {
  min-height: auto;
}

/* ---------- Header toko ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  padding: 0.7rem 0 0.8rem;
  box-shadow: 0 4px 18px rgba(13, 110, 253, 0.25);
}

.site-header .brand {
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.site-header .brand:hover {
  color: #fff;
}

.site-header .icon-link {
  color: #fff;
  font-size: 1.35rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  justify-content: center;
}

.search-form .form-control {
  border-radius: 999px 0 0 999px;
  border: 0;
  min-height: 44px;
}

.search-form .btn {
  border-radius: 0 999px 999px 0;
  background: #fff;
  color: var(--brand);
  font-weight: 600;
}

.cart-badge {
  position: absolute;
  top: 2px;
  right: 0;
  background: #ff4757;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  line-height: 1.5;
}

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1035;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  min-height: var(--nav-h);
  position: relative;
}

.bottom-nav a .bi {
  font-size: 1.35rem;
}

.bottom-nav a.active,
.bottom-nav a:hover {
  color: var(--brand);
}

@media (min-width: 992px) {
  .bottom-nav {
    display: none;
  }

  body {
    padding-bottom: 24px;
  }
}

/* ---------- Sticky CTA (halaman produk + checkout) ---------- */
.sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 1032;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 0.7rem 1rem;
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.1);
}

body.has-sticky-cta {
  padding-bottom: calc(var(--nav-h) + 96px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 992px) {
  .sticky-cta {
    bottom: 0;
    padding: 0.85rem 0;
  }

  body.has-sticky-cta {
    padding-bottom: 110px;
  }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--brand), #6610f2);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.6rem 1.25rem;
  box-shadow: var(--shadow);
}

.hero h1 {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.hero p {
  opacity: 0.92;
  margin-bottom: 1rem;
}

.hero .btn-light {
  font-weight: 600;
  color: var(--brand);
}

/* ---------- Chip & kartu kategori ---------- */
.chip-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.kategori-chip {
  white-space: nowrap;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.kategori-chip:hover,
.kategori-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.kategori-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  color: var(--ink);
  font-weight: 600;
  height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kategori-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: var(--brand);
}

.kategori-card .kat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(13, 110, 253, 0.1);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ---------- Grid produk ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 576px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 1400px) {
  .product-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.product-card {
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.product-card .thumb {
  aspect-ratio: 1 / 1;
  background: #eef2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.product-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card .thumb .placeholder {
  color: #c3ccd9;
  font-size: 2.4rem;
}

.product-card .body {
  padding: 0.6rem 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.product-card .nama {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.product-card .body .btn {
  margin-top: auto;
}

/* ---------- Harga ---------- */
.price {
  color: var(--brand);
  font-weight: 800;
}

.price-old {
  color: var(--muted);
  text-decoration: line-through;
  font-size: 0.78rem;
  font-weight: 500;
  margin-left: 0.35rem;
}

.detail-price {
  font-size: 1.55rem;
}

/* ---------- Judul section & badge ---------- */
.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
}

.section-title .link-more {
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-stok {
  font-size: 0.72rem;
  font-weight: 600;
}

/* ---------- Kartu ---------- */
.card-flat {
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-flat .card-head-fl {
  padding: 1rem 1.15rem 0.25rem;
  font-weight: 800;
}

.card-flat .card-body-fl {
  padding: 1rem 1.15rem;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 2.75rem 1.25rem;
  color: var(--muted);
  background: #fff;
  border: 1px dashed #d6dde8;
  border-radius: var(--radius);
}

.empty-state .bi {
  font-size: 3rem;
  opacity: 0.45;
  display: block;
  margin-bottom: 0.65rem;
}

/* ---------- Timeline status pesanan ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.25rem;
}

.timeline li {
  position: relative;
  padding: 0 0 1.25rem 1.55rem;
  border-left: 2px solid #dbe3ee;
  margin-left: 7px;
}

.timeline li:last-child {
  padding-bottom: 0.15rem;
  border-left-color: transparent;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0.3rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--brand);
}

.timeline li.muted-step::before {
  background: #cbd5e1;
  box-shadow: 0 0 0 2px #cbd5e1;
}

/* ---------- Qty stepper ---------- */
.qty-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.qty-stepper button {
  width: 44px;
  min-height: 44px;
  border: 0;
  background: #f3f6fa;
  font-size: 1.15rem;
  color: var(--ink);
}

.qty-stepper input {
  width: 58px;
  border: 0;
  text-align: center;
  font-weight: 700;
  min-height: 44px;
}

.qty-stepper input:focus {
  outline: none;
}

/* ---------- Tabel ---------- */
.table-cards thead th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  white-space: nowrap;
}

.table > :not(caption) > * > * {
  vertical-align: middle;
}

/* ---------- KPI ---------- */
.kpi-card {
  display: block;
  background: #fff;
  border: 1px solid #eef0f4;
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  color: var(--ink);
  height: 100%;
  transition: transform 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-3px);
  color: var(--ink);
}

.kpi-card .kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.kpi-card .kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
  word-break: break-word;
}

.kpi-card .kpi-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---------- Layout panel / superadmin ---------- */
.panel-sidebar {
  width: 252px;
  background: #0f172a;
  color: #cbd5e1;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  z-index: 1030;
}

@media (min-width: 992px) {
  .panel-sidebar {
    display: flex;
  }

  .panel-main {
    margin-left: 252px;
  }
}

.panel-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.panel-topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.sidebar-brand {
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 1.15rem 1.15rem 1.35rem;
  display: block;
}

.sidebar-brand:hover {
  color: #fff;
}

.panel-sidebar .nav-link {
  color: #94a3b8;
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.panel-sidebar .nav-link .bi {
  font-size: 1.15rem;
}

.panel-sidebar .nav-link:hover,
.panel-sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.panel-sidebar .sidebar-foot {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Offcanvas menu mobile */
.offcanvas.panel-offcanvas {
  background: #0f172a;
  color: #fff;
}

.offcanvas.panel-offcanvas .nav-link {
  color: #94a3b8;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.7rem;
  align-items: center;
  font-weight: 600;
}

.offcanvas.panel-offcanvas .nav-link:hover,
.offcanvas.panel-offcanvas .nav-link.active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.offcanvas.panel-offcanvas .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* ---------- Form ---------- */
.form-label {
  font-weight: 600;
  font-size: 0.88rem;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.invalid-feedback {
  display: block;
}

/* ---------- Halaman auth standalone ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--brand), #6610f2);
  padding: 1.25rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 2rem 1.5rem;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
}

/* ---------- Lain-lain ---------- */
.tenant-color {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.12);
  vertical-align: middle;
}

.text-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pre-json {
  background: #0f172a;
  color: #d1fae5;
  border-radius: 10px;
  padding: 1rem;
  font-size: 0.82rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.detail-img {
  aspect-ratio: 1 / 1;
  background: #eef2f7;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-xs {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef2f7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #c3ccd9;
}

footer.site-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.75rem 0 1.25rem;
  margin-top: 2.5rem;
}

footer.site-footer a {
  color: var(--muted);
  font-weight: 600;
}

footer.site-footer a:hover {
  color: var(--brand);
}
