/*
 * BookHaven Storefront Theme Layer
 * A lightweight visual system shared by every storefront, account, content,
 * checkout and admin page. Bootstrap remains the layout utility layer.
 */

:root {
  --bh-primary: #0f766e;
  --bh-primary-strong: #0b5f59;
  --bh-primary-soft: #e8f5f2;
  --bh-accent: #d89b38;
  --bh-accent-soft: #fff7e8;
  --bh-ink: #172234;
  --bh-muted: #64748b;
  --bh-page: #045059;
  --bh-surface: #ffffff;
  --bh-surface-soft: #f3f7f7;
  --bh-line: #e5ebf0;
  --bh-danger: #d85664;
  --bh-success: #16866e;
  --bh-radius-xs: 10px;
  --bh-radius-sm: 14px;
  --bh-radius-md: 20px;
  --bh-radius-lg: 28px;
  --bh-shadow-sm: 0 8px 24px rgba(23, 34, 52, .06);
  --bh-shadow-md: 0 18px 48px rgba(23, 34, 52, .10);
  --bh-shadow-lg: 0 28px 75px rgba(23, 34, 52, .14);
  --bh-ease: cubic-bezier(.22, .8, .22, 1);

  /* Bridge the original v4 component tokens to the new theme tokens. */
  --primary: var(--bh-primary);
  --primary-hover: var(--bh-primary-strong);
  --accent: var(--bh-accent);
  --accent-hover: var(--bh-primary-strong);
  --secondary: var(--bh-ink);
  --body-bg: var(--bh-page);
  --bg-light: var(--bh-surface-soft);
  --surface: var(--bh-surface);
  --text-main: var(--bh-ink);
  --text-muted: var(--bh-muted);
  --border-color: var(--bh-line);
}

html { background: var(--bh-page); }

body {
  background:
    radial-gradient(circle at 6% 3%, rgba(15, 118, 110, .055), transparent 24rem),
    var(--bh-page);
  color: var(--bh-ink);
  font-size: .95rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::selection { background: var(--bh-primary); color: #fff; }

h1, h2, h3, h4, h5, h6 {
  color: var(--bh-ink);
  letter-spacing: -.025em;
}

p { color: var(--bh-muted); }

.container-custom {
  width: min(100% - 2rem, 1380px);
  padding-left: 0;
  padding-right: 0;
}

/* Shared top utility bar */
.announcement-bar,
.header-top-bar {
  min-height: 38px;
  padding: .55rem 0;
  background: #fff;
  border-bottom: 1px solid var(--bh-line);
  color: var(--bh-muted);
}

.announcement-bar a,
.header-top-bar a { color: var(--bh-muted); transition: color .2s ease; }
.announcement-bar a:hover,
.header-top-bar a:hover { color: var(--bh-primary); }

/* Shared main header */
.main-header,
.main-navbar {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--bh-line);
  box-shadow: 0 3px 16px rgba(23, 34, 52, .035);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: padding .25s var(--bh-ease), box-shadow .25s ease, background .25s ease;
  z-index: 1020;
}

.main-header.is-scrolled,
.main-navbar.is-scrolled { box-shadow: 0 12px 30px rgba(23, 34, 52, .09); }

.main-header .container,
.main-navbar .container { padding-top: .9rem; padding-bottom: .9rem; }

.brand-title,
.brand-logo-title {
  color: var(--bh-primary);
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
}

.main-header .fa-book-bookmark,
.main-navbar .fa-book-bookmark { color: var(--bh-primary) !important; }

.main-header .text-muted,
.main-navbar .text-muted { color: #8a98a8 !important; }

.search-wrapper {
  min-height: 48px;
  padding: .3rem .4rem .3rem 1rem;
  background: var(--bh-surface-soft);
  border: 1px solid var(--bh-line);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.search-wrapper:focus-within {
  background: #fff;
  border-color: rgba(15, 118, 110, .52);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .10);
}

.search-input { color: var(--bh-ink); min-width: 0; }
.search-input::placeholder { color: #94a3b8; }
.search-type-select,
.search-category-select {
  color: var(--bh-muted);
  border-right-color: var(--bh-line);
}

.btn-search {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  background: var(--bh-primary) !important;
  border: 0;
  color: #fff !important;
  box-shadow: 0 7px 16px rgba(15, 118, 110, .22);
}

.btn-search:hover { background: var(--bh-primary-strong) !important; transform: translateY(-1px); }

.header-icon-btn,
.action-btn {
  color: var(--bh-ink);
  border-radius: 12px;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}

.header-icon-btn:hover,
.action-btn:hover { color: var(--bh-primary); background: var(--bh-primary-soft); transform: translateY(-1px); }

.badge-count,
.header-icon-btn .badge { background: var(--bh-accent) !important; color: #fff !important; border: 2px solid #fff; }
.header-icon-btn .badge.bg-danger { background: var(--bh-danger) !important; }

/* Navigation */
.nav-secondary,
.main-navbar + .bg-dark {
  background: linear-gradient(90deg, #123b3a, #14534f 55%, #163d53) !important;
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(15, 65, 64, .14);
}

.nav-secondary { position: relative; z-index: 1010; }
.nav-secondary .nav-link,
.main-navbar + .bg-dark a {
  padding: .72rem .78rem !important;
  color: rgba(255,255,255,.78) !important;
  font-weight: 600;
  border-radius: 10px;
  transition: color .2s ease, background .2s ease;
}

.nav-secondary .nav-link:hover,
.nav-secondary .nav-link.active,
.main-navbar + .bg-dark a:hover,
.main-navbar + .bg-dark a.active {
  color: #fff !important;
  background: rgba(255,255,255,.13);
}

.btn-category {
  background: rgba(255,255,255,.13) !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  color: #fff !important;
  border-radius: 999px;
  font-weight: 700;
}

.nav-secondary .navbar-toggler { color: #fff !important; }
.nav-secondary .navbar-toggler-icon { filter: brightness(0) invert(1); }
.nav-secondary .dropdown-menu { border-radius: 16px; padding: .55rem; min-width: 250px; }
.nav-secondary .dropdown-item { border-radius: 10px; padding: .65rem .75rem; }
.nav-secondary .dropdown-item:hover { color: var(--bh-primary); background: var(--bh-primary-soft); }

/* Breadcrumbs and page rhythm */
.breadcrumb,
.breadcrumb a { color: var(--bh-muted); }
.breadcrumb a:hover { color: var(--bh-primary); }
.breadcrumb-item.active { color: var(--bh-ink); }

main,
body > .container-custom,
body > section { position: relative; }

main > section,
main > .container-custom,
body > section:not(.announcement-bar) { --section-space: clamp(2.5rem, 5vw, 5rem); }

/* Homepage and category hero surfaces */
.hero-section { padding-top: clamp(1.2rem, 3vw, 2rem); padding-bottom: clamp(2rem, 4vw, 3.5rem); }
.hero-carousel-curved,
.hero-slide-curved { border-radius: var(--bh-radius-lg) !important; }
.hero-carousel-curved { box-shadow: var(--bh-shadow-md); }
.hero-slide-curved { min-height: 410px; }
.hero-product-img-curved { filter: drop-shadow(0 22px 24px rgba(0,0,0,.28)); }
.category-sidebar-card,
.category-card,
.commercial-panel,
.dashboard-sidebar,
.order-card {
  background: #fff;
  border: 1px solid var(--bh-line) !important;
  border-radius: var(--bh-radius-md) !important;
  box-shadow: var(--bh-shadow-sm);
}

.sidebar-header { background: var(--bh-primary-soft); color: var(--bh-primary-strong); }
.category-group-item a:hover { background: #f5fbfa; color: var(--bh-primary); }

.full-width-product-strip,
.trust-strip { position: relative; }
.full-width-product-strip::before,
.trust-strip::before {
  content: '';
  position: absolute;
  inset: .5rem 0;
  background: #fff;
  border: 1px solid var(--bh-line);
  border-radius: var(--bh-radius-md);
  z-index: -1;
}

/* Product grids and cards */
.product-card,
.blog-card,
.mini-product-card {
  border: 1px solid var(--bh-line) !important;
  border-radius: var(--bh-radius-md) !important;
  background: #fff !important;
  box-shadow: var(--bh-shadow-sm) !important;
}

.product-card { padding: 0; overflow: hidden; }
.product-card:hover,
.blog-card:hover,
.mini-product-card:hover { border-color: rgba(15,118,110,.24) !important; box-shadow: var(--bh-shadow-md) !important; }
.product-img-wrapper { background: linear-gradient(145deg, #f4f8f8, #eef4f3); border-radius: 0; }
.product-img-wrapper img { height: 250px; object-fit: cover; }
.product-body { padding: 1.1rem; }
.product-title { color: var(--bh-ink); line-height: 1.35; }
.product-title a:hover { color: var(--bh-primary); }
.product-category { color: var(--bh-primary); font-weight: 700; letter-spacing: .035em; }
.current-price { color: var(--bh-primary-strong); }
.product-tag-sales,
.product-badge { background: var(--bh-danger) !important; }
.product-actions { top: .9rem !important; right: .9rem !important; }
.btn-action { border: 1px solid rgba(255,255,255,.8); background: rgba(255,255,255,.9); box-shadow: 0 5px 14px rgba(23,34,52,.10); }
.btn-action:hover { background: #fff; color: var(--bh-primary); }
.btn-wishlist-toggle.active { color: var(--bh-danger) !important; background: #fff1f3 !important; }

.btn-bh-primary,
.btn-add-cart,
.btn-add-cart-sellzy,
.btn-mini-add,
.btn-order-again {
  background: var(--bh-primary) !important;
  border-color: var(--bh-primary) !important;
  color: #fff !important;
  border-radius: 999px !important;
  font-weight: 700 !important;
  box-shadow: 0 8px 18px rgba(15,118,110,.17);
}

.btn-bh-primary:hover,
.btn-add-cart:hover,
.btn-add-cart-sellzy:hover,
.btn-mini-add:hover,
.btn-order-again:hover { background: var(--bh-primary-strong) !important; border-color: var(--bh-primary-strong) !important; }
.btn-warning { background: var(--bh-accent) !important; border-color: var(--bh-accent) !important; color: #fff !important; }
.btn-warning:hover { background: #b77a22 !important; border-color: #b77a22 !important; }

.promo-card { border-radius: var(--bh-radius-lg) !important; box-shadow: var(--bh-shadow-sm); }
.promo-bg-green { background: linear-gradient(135deg, #dff8e8, #b6e7d0); }
.promo-bg-cyan { background: linear-gradient(135deg, #e0f7fa, #bfe7ee); }
.blog-img { height: 205px; }
.blog-category-badge { background: var(--bh-accent-soft); color: #9a6819; }

/* Catalog, result and content surfaces */
.results-toolbar { padding: clamp(1rem, 2vw, 1.6rem); background: #fff; border: 1px solid var(--bh-line); border-radius: var(--bh-radius-md); box-shadow: var(--bh-shadow-sm); }
.results-toolbar h1,
.dashboard-title { margin-bottom: .35rem; color: var(--bh-ink); }
.empty-state { background: #fff; border-color: #cbdedb; box-shadow: var(--bh-shadow-sm); }
.form-control,
.form-select,
.input-group-text { border-color: var(--bh-line); border-radius: 11px; color: var(--bh-ink); }
.form-control:focus,
.form-select:focus { border-color: rgba(15,118,110,.55); box-shadow: 0 0 0 4px rgba(15,118,110,.10); }
.form-check-input:checked { background-color: var(--bh-primary); border-color: var(--bh-primary); }
.accordion-item { border-color: var(--bh-line); overflow: hidden; }
.accordion-button:not(.collapsed) { color: var(--bh-primary-strong); background: var(--bh-primary-soft); box-shadow: none; }

.table-responsive,
.cart-responsive-table,
.wishlist-card { border: 1px solid var(--bh-line); border-radius: var(--bh-radius-md); box-shadow: var(--bh-shadow-sm); background: #fff; }
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--bh-line); }
.table thead th { background: #f3f7f7; color: var(--bh-ink); font-size: .78rem; letter-spacing: .045em; text-transform: uppercase; }

.detail-gallery-frame { border-radius: var(--bh-radius-lg) !important; border: 1px solid var(--bh-line); box-shadow: var(--bh-shadow-sm); }
.format-option { border-radius: 13px; }
.format-option.active { border-color: var(--bh-primary); background: var(--bh-primary-soft); }
.trust-item { border-color: var(--bh-line); border-radius: var(--bh-radius-sm); box-shadow: 0 6px 18px rgba(23,34,52,.04); }
.trust-item i { color: var(--bh-primary); }

/* Admin and account polish */
.dashboard-sidebar { padding: 1rem; }
.sidebar-nav-item { border-radius: 11px !important; }
.sidebar-nav-item.active { background: var(--bh-primary) !important; }
.order-card:hover { transform: translateY(-2px); box-shadow: var(--bh-shadow-md); }
.order-header,
.order-actions { border-color: var(--bh-line); }
.card,
.modal-content,
.offcanvas,
.dropdown-menu { border-color: var(--bh-line) !important; border-radius: var(--bh-radius-md); }
.offcanvas-header { background: #fbfdfd; }
.progress { background: #e8efef; }
.progress-bar { background: var(--bh-primary) !important; }

/* Footer */
.footer {
  position: relative;
  margin-top: clamp(3rem, 7vw, 7rem) !important;
  background: linear-gradient(145deg, #102c35, #133f3c) !important;
  border: 0 !important;
  color: rgba(255,255,255,.75) !important;
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  left: -8%;
  right: -8%;
  top: -36px;
  height: 72px;
  background: var(--bh-page);
  border-radius: 50%;
}

.footer > * { position: relative; z-index: 1; }
.footer h5,
.footer .brand-title { color: #fff !important; }
.footer p,
.footer li,
.footer .text-muted { color: rgba(255,255,255,.68) !important; }
.footer a { color: rgba(255,255,255,.76); transition: color .2s ease, transform .2s ease; }
.footer a:hover { color: #fff; }
.footer .border-top { border-color: rgba(255,255,255,.15) !important; }
.footer .btn-outline-secondary { border-color: rgba(255,255,255,.22); color: #fff; }
.footer .btn-outline-secondary:hover { background: #fff; color: var(--bh-primary); }
.footer form .form-control { border: 0; background: rgba(255,255,255,.10); color: #fff; }
.footer form .form-control::placeholder { color: rgba(255,255,255,.55); }

/* Floating controls and motion */
.back-to-top-btn,
.theme-customizer-trigger { border: 0; box-shadow: var(--bh-shadow-md); }
.back-to-top-btn { background: var(--bh-primary); }
.theme-customizer-trigger { background: var(--bh-ink); }
.bh-reveal { transition: opacity .55s var(--bh-ease), transform .55s var(--bh-ease); }

/* Tenant theme accents: ?tenant=lumen, ?tenant=atelier or ?tenant=forest */
html[data-tenant="lumen"] { --bh-primary: #2563eb; --bh-primary-strong: #1d4ed8; --bh-primary-soft: #eaf1ff; }
html[data-tenant="atelier"] { --bh-primary: #9a5b3a; --bh-primary-strong: #7f4327; --bh-primary-soft: #fff0e9; --bh-accent: #bf8b30; }
html[data-tenant="forest"] { --bh-primary: #3f6d45; --bh-primary-strong: #2f5734; --bh-primary-soft: #edf7ed; --bh-accent: #bc8830; }

@media (max-width: 1199.98px) {
  .container-custom { width: min(100% - 2.25rem, 1380px); }
  .product-img-wrapper img { height: 225px; }
}

@media (max-width: 991.98px) {
  .main-header .container,
  .main-navbar .container { padding-top: .7rem; padding-bottom: .7rem; }
  .main-header .col-12,
  .main-navbar .col-12 { margin-top: .15rem; }
  .nav-secondary .navbar-collapse { padding-top: .7rem; }
  .nav-secondary .navbar-nav { padding-bottom: .35rem; }
  .hero-slide-curved { min-height: 440px; }
  .footer { margin-top: 4rem !important; }
}

@media (max-width: 767.98px) {
  body { font-size: .93rem; }
  .container-custom { width: min(100% - 1.5rem, 1380px); }
  .announcement-bar .container,
  .header-top-bar .container { overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .announcement-bar .container::-webkit-scrollbar,
  .header-top-bar .container::-webkit-scrollbar { display: none; }
  .main-header .header-actions,
  .main-navbar .header-actions { gap: .15rem !important; }
  .action-btn { padding: .42rem .55rem !important; }
  .search-wrapper { min-height: 46px; }
  .hero-section { padding-top: .75rem; }
  .hero-slide-curved { min-height: 505px; }
  .hero-slide-curved .display-5 { font-size: 1.9rem; }
  .product-img-wrapper img { height: 205px; }
  .product-body { padding: .85rem; }
  .product-title { font-size: .88rem !important; }
  .results-toolbar { align-items: flex-start; flex-direction: column; }
  .results-toolbar .btn { width: 100%; }
  .footer::before { top: -22px; height: 45px; }
  .footer { padding-top: 3.5rem !important; }
  .footer .row > div { margin-bottom: 1.2rem; }
  .footer form.d-flex { flex-direction: column; }
  .footer form .btn { width: 100%; }
  .cart-responsive-table table,
  .wishlist-table { min-width: 720px; }
  .table-responsive,
  .cart-responsive-table,
  .wishlist-card { border-radius: var(--bh-radius-sm); }
  .theme-customizer-trigger { right: 14px; bottom: 72px; }
  .back-to-top-btn { right: 14px; bottom: 18px; }
}

@media (max-width: 575.98px) {
  .container-custom { width: min(100% - 1.25rem, 1380px); }
  .brand-title { font-size: 1.12rem; }
  .main-header .d-block.fs-xs { display: none !important; }
  .hero-slide-curved .row { padding: 1.15rem !important; }
  .hero-slide-curved .display-5 { font-size: 1.62rem; }
  .hero-slide-curved .lead { font-size: .92rem; }
  .hero-product-img-curved { max-height: 185px; }
  .product-img-wrapper img { height: 180px; }
  .product-card .btn-add-cart,
  .product-card .btn-add-cart-sellzy { font-size: .72rem !important; padding: .56rem .45rem !important; }
  .current-price { font-size: .98rem !important; }
  .format-option { min-width: calc(50% - .25rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
