/* =====================================================================
   Мултимагазин — основни стилове върху Bootstrap 5
   ===================================================================== */

:root {
  --shop-ink: #1d2b53;
  --shop-ink-soft: #2d3f72;
  --shop-accent: #f4b73f;
  --shop-bg: #f5f6fa;
  --shop-card: #ffffff;
  --shop-line: #e3e6ee;
  --shop-muted: #6b7280;
}

body {
  background: var(--shop-bg);
  color: #1f2430;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1 0 auto; }

a { color: var(--shop-ink); }
a:hover { color: var(--shop-ink-soft); }

/* ---------- Навигация ---------- */
.shop-navbar {
  background: linear-gradient(90deg, #16224a 0%, #24356b 100%);
  box-shadow: 0 2px 12px rgba(20, 30, 60, .18);
}
.shop-navbar .navbar-brand { font-weight: 700; letter-spacing: .2px; margin-right: 1rem; }
.shop-navbar .brand-mark { color: var(--shop-accent); font-size: 1.25rem; }
.shop-navbar .nav-link { color: rgba(255,255,255,.85); }
.shop-navbar .nav-link:hover, .shop-navbar .nav-link.active { color: #fff; }
.shop-navbar .navbar-toggler { border-color: rgba(255,255,255,.3); }

.shop-search { min-width: 260px; flex: 1 1 320px; max-width: 520px; }
.shop-navbar .navbar-nav .nav-link { padding-left: .55rem; padding-right: .55rem; white-space: nowrap; }
.shop-search .form-control {
  border-radius: 8px 0 0 8px;
  border: 0;
  padding: .5rem .9rem;
}
.shop-search .btn { border-radius: 0 8px 8px 0; }
.cart-badge { position: relative; top: -9px; left: -4px; font-size: .62rem; }

/* ---------- Търсене: вълнообразно подчертаване ---------- */
.shop-hl {
  text-decoration: underline wavy var(--shop-accent);
  text-decoration-skip-ink: none;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  background: rgba(244, 183, 63, .12);
  border-radius: 2px;
  padding: 0 1px;
}
mark.shop-hl, .card-title .shop-hl { color: inherit; }

.search-suggest {
  position: absolute;
  z-index: 1080;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--shop-line);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(20, 30, 60, .16);
  overflow: hidden;
  max-height: 60vh;
  overflow-y: auto;
}
.search-suggest .sug-item {
  display: flex;
  gap: .65rem;
  align-items: center;
  padding: .55rem .8rem;
  color: #1f2430;
  text-decoration: none;
  border-bottom: 1px solid #f1f2f7;
}
.search-suggest .sug-item:last-child { border-bottom: 0; }
.search-suggest .sug-item:hover { background: #f7f8fc; }
.search-suggest .sug-item img {
  width: 38px; height: 38px; object-fit: cover; border-radius: 6px; background: #eef0f6;
}
.search-suggest .sug-price { margin-left: auto; font-weight: 700; white-space: nowrap; font-size: .85rem; }
.search-suggest .sug-all { display: block; padding: .6rem .8rem; font-weight: 600; background: #f7f8fc; text-decoration: none; }

/* ---------- Продуктови боксове ---------- */
.product-card {
  background: var(--shop-card);
  border: 1px solid var(--shop-line);
  border-radius: 14px;
  overflow: hidden;
  height: 100%;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(20, 30, 60, .12);
  border-color: #cfd6e6;
}
.product-card .thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: #eef0f6;
  overflow: hidden;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.product-card:hover .thumb img { transform: scale(1.04); }
.product-card .body { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; flex: 1; }
.product-card .cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--shop-muted); }
.product-card .title { font-size: 1rem; font-weight: 650; line-height: 1.3; margin: .2rem 0 .35rem; }
.product-card .title a { text-decoration: none; color: #17203a; }
.product-card .desc { font-size: .82rem; color: var(--shop-muted); margin-bottom: .6rem; line-height: 1.45; }
.product-card .price-row { margin-top: auto; display: flex; align-items: baseline; gap: .5rem; }
.product-card .price { font-weight: 800; font-size: 1.05rem; color: #10203f; }
.product-card .old-price { text-decoration: line-through; color: #9aa1b2; font-size: .82rem; }
.product-card .store-link { font-size: .76rem; color: var(--shop-muted); text-decoration: none; }
.product-card .store-link:hover { text-decoration: underline; }

.badge-discount {
  position: absolute; top: 10px; left: 10px;
  background: #e5434f; color: #fff; font-weight: 700;
  border-radius: 999px; padding: .2rem .55rem; font-size: .74rem;
  box-shadow: 0 2px 8px rgba(229, 67, 79, .35);
}
.badge-out {
  position: absolute; inset: 0;
  background: rgba(23, 32, 58, .55);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; letter-spacing: .04em;
}
.badge-stock-low { font-size: .72rem; }

/* ---------- Категории ---------- */
.cat-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .8rem; border-radius: 999px;
  background: #fff; border: 1px solid var(--shop-line);
  color: #1f2430; text-decoration: none; font-size: .87rem;
  white-space: nowrap;
}
.cat-pill:hover { border-color: var(--shop-ink); color: var(--shop-ink); }
.cat-pill.active { background: var(--shop-ink); border-color: var(--shop-ink); color: #fff; }

.cat-tree { background: #fff; border: 1px solid var(--shop-line); border-radius: 14px; padding: .75rem; }
.cat-tree .cat-parent { font-weight: 700; font-size: .92rem; display: block; padding: .4rem .5rem; border-radius: 8px; text-decoration: none; color: #17203a; }
.cat-tree .cat-parent:hover, .cat-tree .cat-parent.active { background: #f0f3fb; }
.cat-tree ul { list-style: none; padding-left: .9rem; margin: 0 0 .35rem; }
.cat-tree ul a { display: block; padding: .25rem .5rem; border-radius: 6px; font-size: .86rem; color: #45506b; text-decoration: none; }
.cat-tree ul a:hover, .cat-tree ul a.active { background: #f0f3fb; color: var(--shop-ink); }

/* ---------- Секции ---------- */
.section-title { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.page-head { padding: 1.6rem 0 .6rem; }
.page-head h1 { font-weight: 800; letter-spacing: -.02em; font-size: 1.75rem; }
.hero {
  background: radial-gradient(1200px 400px at 10% -20%, #33477f 0%, #16224a 60%);
  color: #fff;
  border-radius: 18px;
  padding: 2.2rem;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(244,183,63,.35), transparent 70%);
}
.hero h1 { font-weight: 800; letter-spacing: -.02em; }
.hero .form-control { border-radius: 10px; border: 0; padding: .7rem 1rem; }
.hero .btn { border-radius: 10px; }

.stat-card { background: #fff; border: 1px solid var(--shop-line); border-radius: 12px; padding: .9rem 1rem; }
.stat-card .n { font-size: 1.35rem; font-weight: 800; }
.stat-card .l { font-size: .78rem; color: var(--shop-muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Магазини ---------- */
.store-card {
  background: #fff; border: 1px solid var(--shop-line); border-radius: 14px; padding: 1.1rem;
  height: 100%; display: flex; flex-direction: column; gap: .5rem;
  transition: box-shadow .18s ease, transform .18s ease;
}
.store-card:hover { box-shadow: 0 12px 26px rgba(20,30,60,.1); transform: translateY(-2px); }
.store-avatar {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, #24356b, #4a63ad);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem;
  flex: 0 0 auto;
}

/* ---------- Продуктова страница ---------- */
.product-hero { background: #fff; border: 1px solid var(--shop-line); border-radius: 16px; padding: 1.25rem; }
.product-hero .main-img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #f7f8fc; border-radius: 12px;
  border: 1px solid var(--shop-line);
}
.product-price { font-size: 1.9rem; font-weight: 800; color: #10203f; }
.product-desc { line-height: 1.7; }
.buybox { background: #fff; border: 1px solid var(--shop-line); border-radius: 16px; padding: 1.25rem; }

/* ---------- Кошница / поръчка ---------- */
.store-group { background: #fff; border: 1px solid var(--shop-line); border-radius: 14px; overflow: hidden; margin-bottom: 1rem; }
.store-group .head { background: #f4f6fb; padding: .7rem 1rem; font-weight: 700; display: flex; justify-content: space-between; }
.store-group .head a { text-decoration: none; }
.cart-line { display: flex; gap: 1rem; align-items: center; padding: .8rem 1rem; border-top: 1px solid #eef0f6; }
.cart-line img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #eef0f6; }
.qty-input { width: 78px; }

/* ---------- Форми ---------- */
.form-card { background: #fff; border: 1px solid var(--shop-line); border-radius: 16px; padding: 1.5rem; }
.form-label { font-weight: 600; font-size: .9rem; }
.form-control, .form-select { border-color: #d8dce8; }
.form-control:focus, .form-select:focus { border-color: var(--shop-ink-soft); box-shadow: 0 0 0 .2rem rgba(45, 63, 114, .12); }
.required::after { content: " *"; color: #e5434f; }

/* ---------- Таблици ---------- */
.table thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--shop-muted); }
.table-hover > tbody > tr:hover > * { background-color: #f7f8fc; }

/* ---------- Футър ---------- */
.shop-footer { background: #fff; border-top: 1px solid var(--shop-line); flex-shrink: 0; }
.shop-footer a { text-decoration: none; }
.shop-footer a:hover { text-decoration: underline; }

/* ---------- Дребни ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--shop-muted); }
.empty-state .icon { font-size: 2.6rem; opacity: .5; }
.skeleton { background: linear-gradient(90deg, #eef0f6 25%, #f6f7fb 50%, #eef0f6 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.spinner-overlay { position: absolute; inset: 0; background: rgba(245,246,250,.6); display: grid; place-items: center; z-index: 5; border-radius: 14px; }
.pagination .page-link { color: var(--shop-ink); }
.pagination .active > .page-link { background: var(--shop-ink); border-color: var(--shop-ink); }
.sticky-side { position: sticky; top: 84px; }
@media (max-width: 991px) {
  .shop-search { max-width: none; }
  .sticky-side { position: static; }
}
