/* BENIKA theme — layered on top of Bootstrap 5, driven by --brand-primary/--brand-secondary
   which are set inline (from admin-configurable settings) in header.php / admin_header.php */

body {
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  color: #212529;
  background: #f7f8fa;
}

a { color: var(--brand-primary); }
a:hover { color: var(--brand-primary); filter: brightness(0.85); }

.text-brand-primary { color: var(--brand-primary) !important; }
.text-brand-secondary { color: var(--brand-secondary) !important; }
.bg-brand-primary { background-color: var(--brand-primary) !important; }
.bg-brand-secondary { background-color: var(--brand-secondary) !important; }

/* Header */
.top-bar {
  background: var(--brand-primary);
  color: var(--brand-secondary);
  filter: brightness(0.9);
}
.navbar-brand-custom {
  background: var(--brand-primary);
}
.navbar-brand-custom .navbar-brand,
.navbar-brand-custom .nav-link {
  color: var(--brand-secondary) !important;
}
.navbar-brand-custom .nav-link:hover {
  opacity: 0.8;
}
.navbar-brand-custom .dropdown-menu {
  border-top: 3px solid var(--brand-primary);
}
.cart-badge {
  position: absolute;
  top: -4px;
  right: -10px;
  font-size: 0.65rem;
}

/* Search box (navbar + products toolbar) */
.nav-search {
  flex: 1 1 320px;
  max-width: 440px;
  order: 3;
  width: 100%;
}
@media (min-width: 992px) {
  .nav-search {
    order: 0;
  }
}
.search-wrapper-inline {
  flex: 1 1 220px;
  max-width: 280px;
}
.search-box {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid transparent;
  border-radius: 50rem;
  padding: 0.3rem 0.3rem 0.3rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-box:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.06);
}
.search-box-icon {
  color: #adb5bd;
  font-size: 0.95rem;
  margin-right: 0.55rem;
  flex-shrink: 0;
}
.search-box-input {
  border: none;
  outline: none;
  background: transparent;
  flex-grow: 1;
  min-width: 0;
  font-size: 0.9rem;
  color: #212529;
}
.search-box-input::placeholder {
  color: #adb5bd;
}
.search-box-input::-webkit-search-cancel-button {
  cursor: pointer;
}
.search-box-submit {
  border: none;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: var(--brand-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.search-box-submit:hover {
  filter: brightness(0.9);
}
.search-box-submit:active {
  transform: scale(0.94);
}
.search-box-sm {
  padding: 0.2rem 0.2rem 0.2rem 0.85rem;
}
.search-box-sm .search-box-submit {
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
}
.search-box-sm .search-box-input {
  font-size: 0.85rem;
}

/* Buttons
   Bootstrap 5.3's .btn/.btn:hover/.btn:active/.btn:focus read colors from --bs-btn-*
   custom properties. Custom variants (not shipped by Bootstrap) must define those
   properties themselves, otherwise :hover/:active fall back to Bootstrap's own
   defaults (white background, grey text) regardless of what background-color/color
   the base class sets. */
.btn-brand {
  --bs-btn-color: var(--brand-secondary);
  --bs-btn-bg: var(--brand-primary);
  --bs-btn-border-color: var(--brand-primary);
  --bs-btn-hover-color: var(--brand-secondary);
  --bs-btn-hover-bg: var(--brand-primary);
  --bs-btn-hover-border-color: var(--brand-primary);
  --bs-btn-active-color: var(--brand-secondary);
  --bs-btn-active-bg: var(--brand-primary);
  --bs-btn-active-border-color: var(--brand-primary);
  --bs-btn-disabled-color: var(--brand-secondary);
  --bs-btn-disabled-bg: var(--brand-primary);
  --bs-btn-disabled-border-color: var(--brand-primary);
  --bs-btn-focus-shadow-rgb: 13, 71, 161;
}
.btn-brand:hover,
.btn-brand:active {
  filter: brightness(0.88);
}
.btn-outline-brand {
  --bs-btn-color: var(--brand-primary);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--brand-primary);
  --bs-btn-hover-color: var(--brand-secondary);
  --bs-btn-hover-bg: var(--brand-primary);
  --bs-btn-hover-border-color: var(--brand-primary);
  --bs-btn-active-color: var(--brand-secondary);
  --bs-btn-active-bg: var(--brand-primary);
  --bs-btn-active-border-color: var(--brand-primary);
}

/* Hero */
.hero-section {
  background-color: var(--brand-primary);
  background-image: linear-gradient(135deg, var(--brand-primary), rgba(0,0,0,0.35));
  color: var(--brand-secondary);
  padding: 4rem 0;
}

/* Product cards */
.product-card {
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  overflow: hidden;
  height: 100%;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  background: #fff;
}
.product-card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
.product-card .product-img-wrap {
  aspect-ratio: 1 / 1;
  background: #f1f3f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-card .product-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.product-card:hover .product-img-wrap img {
  transform: scale(1.1);
}
.price-current {
  font-weight: 700;
  color: var(--brand-primary);
}
.price-original {
  text-decoration: line-through;
  color: #adb5bd;
  font-size: 0.85em;
}
.badge-discount {
  background: #dc3545;
  color: #fff;
}
.badge-stock-low {
  background: #fd7e14;
  color: #fff;
}
.badge-stock-out {
  background: #6c757d;
  color: #fff;
}

.category-tile {
  border-radius: 0.5rem;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid #e9ecef;
  text-align: center;
  height: 100%;
  color: #212529;
  text-decoration: none;
  display: block;
}
.category-tile:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* Footer */
.site-footer {
  background: #1a1d20;
  color: #ced4da;
}
.site-footer a {
  color: #ced4da;
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--brand-secondary);
}

/* Product gallery */
.gallery-thumb {
  width: 70px;
  height: 70px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 0.25rem;
}
.gallery-thumb.active {
  border-color: var(--brand-primary);
}
.main-gallery-img-wrap {
  overflow: hidden;
  border-radius: 0.5rem;
  background: #f1f3f5;
}
.main-gallery-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.main-gallery-img-wrap:hover .main-gallery-img {
  transform: scale(1.15);
}

/* Admin */
.admin-sidebar {
  min-height: 100vh;
  background: #1a1d20;
  color: #ced4da;
}
.admin-sidebar a {
  color: #ced4da;
  text-decoration: none;
  display: block;
  padding: 0.65rem 1rem;
  border-radius: 0.35rem;
}
.admin-sidebar a:hover,
.admin-sidebar a.active {
  background: var(--brand-primary);
  color: var(--brand-secondary);
}
.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
}
.stat-card {
  border-radius: 0.5rem;
  padding: 1.25rem;
  background: #fff;
  border-left: 4px solid var(--brand-primary);
}

@media (max-width: 767px) {
  .hero-section { padding: 2.5rem 0; }
}

/* Hero banner carousel (homepage) */
.hero-carousel .carousel-item {
  height: 420px;
  background-color: var(--brand-primary);
}
.hero-carousel .carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.65);
}
.hero-carousel .carousel-caption {
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  text-align: left;
  left: 5%;
  right: 5%;
  max-width: 600px;
}
.hero-carousel .carousel-caption h2 {
  font-weight: 700;
}
@media (max-width: 767px) {
  .hero-carousel .carousel-item { height: 280px; }
  .hero-carousel .carousel-caption h2 { font-size: 1.4rem; }
}

/* Live search autocomplete */
.search-wrapper {
  position: relative;
}
.search-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 0.75rem;
  max-height: 340px;
  overflow-y: auto;
  z-index: 1060;
  box-shadow: 0 0.75rem 1.5rem rgba(0,0,0,0.18);
}
.search-suggestions.show {
  display: block;
}
.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: #212529;
  border-bottom: 1px solid #f1f3f5;
}
.search-suggestion-item:last-child {
  border-bottom: none;
}
.search-suggestion-item:hover {
  background: #f1f3f5;
  color: #212529;
}
.search-suggestion-item img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.search-suggestion-name {
  flex-grow: 1;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-suggestion-price {
  font-size: 0.8rem;
  color: var(--brand-primary);
  font-weight: 600;
  white-space: nowrap;
}
.search-suggestions-empty {
  padding: 0.75rem;
  font-size: 0.85rem;
  color: #6c757d;
}

/* Floating WhatsApp chat button */
.whatsapp-float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  background: #25d366;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 1050;
  transition: transform 0.2s ease;
}
.whatsapp-float:hover {
  transform: scale(1.08);
  color: #fff;
}

/* Invoice */
.invoice-box {
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  padding: 2.5rem;
}
.invoice-header {
  border-bottom: 3px solid var(--brand-primary);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .invoice-box { padding: 0; }
}
