/* ==========================================
   HEADER.CSS — Handmade.ru (финальная чистая версия)
   ========================================== */

/* ---------- TOP BAR ---------- */
.top-bar {
  background: var(--bg-dark);
  color: #aaa;
  font-size: 12px;
  height: 36px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.top-bar__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.top-bar__left,
.top-bar__right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.top-bar a {
  color: #999;
  font-size: 12px;
  transition: color 0.2s;
  text-decoration: none;
}

.top-bar a:hover { color: #fff; }

.top-bar__seller {
  background: rgba(231,76,60,0.12) !important;
  color: var(--primary) !important;
  padding: 4px 14px !important;
  border-radius: var(--radius-full);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.top-bar__seller:hover {
  background: var(--primary) !important;
  color: #fff !important;
}

.top-bar__lang {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #999;
}

.top-bar__lang select {
  background: transparent;
  border: none;
  color: #999;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.top-bar__lang option {
  background: var(--bg-dark);
  color: #ccc;
}

/* ---------- HEADER ---------- */
.header {
  background: var(--bg-white);
  height: var(--header-height, 70px);
  box-shadow: 0 1px 0 var(--border-light);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: box-shadow 0.3s;
}

.header.scrolled {
  box-shadow: var(--shadow-md);
}

.header__inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 16px;
}

/* Logo */
.header__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #e67e22);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  white-space: nowrap;
}

.logo-hand { color: var(--primary); }
.logo-made { color: var(--text-primary); }
.logo-dot  { color: var(--primary); }
.logo-ru   { color: var(--primary); }

/* Nav */
.header__nav {
  display: flex;
  align-items: center;
  height: 100%;
  flex-shrink: 0;
}

.header__nav a {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
}

.header__nav a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.header__nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Search */
.header__search {
  flex: 1;
  max-width: 520px;
  min-width: 180px;
  display: flex;
  align-items: stretch;
  height: 42px;
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
  background: #fff;
}

.header__search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(231,76,60,0.08);
}

.search-category {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-gray);
}

.search-category select {
  height: 100%;
  padding: 0 12px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.header__search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 14px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  line-height: 1;
}

.search-btn {
  flex-shrink: 0;
  height: 100%;
  padding: 0 16px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.search-btn:hover {
  background: var(--primary-dark);
}

.search-btn i {
  margin: 0;
  line-height: 1;
}

/* Actions */
.header__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.header__action-btn {
  position: relative;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-gray);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 16px;
  text-decoration: none;
  transition: all 0.15s;
  box-sizing: border-box;
  padding: 0;
  flex-shrink: 0;
}

/* Иконка строго по центру круга (бейдж не сдвигает) */
.header__action-btn > i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  line-height: 1;
  font-size: 16px;
  pointer-events: none;
}

.header__action-btn:hover {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.header__action-btn.active-link {
  color: var(--primary);
}

/* Badge */
.action-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  z-index: 5;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  line-height: 1;
  box-sizing: border-box;
}

.action-badge.visible {
  display: flex !important;
}

/* Profile pill */
.header__profile {
  width: auto !important;
  height: 42px !important;
  padding: 0 14px !important;
  border-radius: var(--radius-full) !important;
  border: 1px solid var(--border);
  background: #fff;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  color: var(--text-secondary);
  text-decoration: none;
  box-sizing: border-box;
}

.header__profile > i {
  position: static !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  margin: 0 !important;
  font-size: 15px !important;
  line-height: 1 !important;
  pointer-events: auto !important;
}

.header__profile:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.profile-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  margin: 0;
}

/* Notif wrap */
.notif-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Burger */
.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  z-index: 1001;
  cursor: pointer;
  border: none;
  background: none;
}

.burger span {
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s;
}

.burger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ---------- SUBNAV ---------- */
.subnav {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 4px rgba(0,0,0,0.02);
}

.subnav__scroll {
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.subnav__scroll::-webkit-scrollbar { display: none; }

.subnav__scroll a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.2;
}

.subnav__scroll a i {
  font-size: 12px;
  line-height: 1;
  margin: 0;
  opacity: 0.75;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.subnav__scroll a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.subnav__scroll a:hover i {
  opacity: 1;
  color: var(--primary);
}

.subnav__scroll a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.subnav__scroll a.active i {
  opacity: 1;
  color: var(--primary);
}

/* ---------- BREADCRUMBS ---------- */
.breadcrumbs { padding: 16px 0; }

.breadcrumbs__inner {
  display: flex;
  align-items: center;
  font-size: 13px;
}

.breadcrumbs a {
  color: var(--text-muted);
  padding: 4px 2px;
  text-decoration: none;
}

.breadcrumbs a:hover { color: var(--primary); }

.breadcrumbs .sep {
  margin: 0 8px;
  color: var(--text-light);
  font-size: 10px;
}

.breadcrumbs .current {
  color: var(--text-primary);
  font-weight: 600;
}

/* ---------- BANNERS ---------- */
.banner-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  gap: 16px;
  margin-bottom: 30px;
  border-radius: var(--radius-lg);
}

.banner-carousel::-webkit-scrollbar { display: none; }

.banner-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  position: relative;
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.banner-inline {
  grid-column: 1 / -1;
  display: block;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 10px 0;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.banner-inline:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.banner-img-wrapper {
  width: 100%;
  display: block;
}

.banner-img-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.banner-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px 28px;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  color: #fff;
  pointer-events: none;
  z-index: 3;
}

.banner-overlay__title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.2;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  color: #fff;
}

.banner-overlay__text {
  font-size: 14px;
  opacity: 0.95;
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  color: #f1f5f9;
}

/* ---------- NEWSLETTER ---------- */
.newsletter {
  background: linear-gradient(135deg, var(--secondary), #34495e);
  padding: 50px 0;
  margin-top: 60px;
  overflow: hidden;
}

.newsletter__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
}

.newsletter__text { color: #fff; }

.newsletter__text h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.newsletter__text h2 i { color: var(--warning); }

.newsletter__text p {
  font-size: 14px;
  opacity: 0.8;
}

.newsletter__form {
  display: flex;
  min-width: 420px;
  max-width: 100%;
}

.newsletter__form input {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 14px;
  outline: none;
}

.newsletter__form button {
  padding: 14px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.newsletter__form button:hover {
  background: var(--primary-dark);
}

/* ---------- NOTIF DROPDOWN ---------- */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: -10px;
  width: 360px;
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 1050;
  display: none;
  animation: notifSlide 0.2s ease;
  overflow: hidden;
}

.notif-dropdown.active {
  display: block !important;
}

@keyframes notifSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notif-dropdown__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-gray);
}

.notif-dropdown__header h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.notif-dropdown__header h3 i { color: var(--primary); }

.notif-mark-read {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
}

.notif-mark-read:hover { text-decoration: underline; }

.notif-dropdown__list {
  max-height: 320px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-gray); }
.notif-item.unread { background: var(--primary-light); }

.notif-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.notif-item__icon.order    { background: #e3f2fd; color: #1976d2; }
.notif-item__icon.discount { background: #e8f5e9; color: #27ae60; }
.notif-item__icon.system   { background: #fff3e0; color: #f39c12; }
.notif-item__icon.shop     { background: #f3e5f5; color: #9c27b0; }

.notif-item__content { flex: 1; min-width: 0; }

.notif-item__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.3;
}

.notif-item__desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 4px;
}

.notif-item__time {
  font-size: 10px;
  color: var(--text-light);
}

.notif-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.notif-dropdown__footer {
  padding: 10px;
  text-align: center;
  background: var(--bg-gray);
  border-top: 1px solid var(--border-light);
}

.notif-dropdown__footer a {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1200px) {
  .header__search { max-width: 360px; }
  .header__nav a { padding: 0 10px; font-size: 12px; }
}

@media (max-width: 1024px) {
  .header__nav a { padding: 0 8px; font-size: 11px; }
  .header__search { max-width: 280px; }
  .search-category { display: none; }
}

@media (max-width: 768px) {
  .top-bar { display: none; }
  .profile-name { display: none; }

  .header__profile {
    width: 42px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
  }

  .burger { display: flex; }

  .header__nav {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: 12px 16px 20px;
    box-shadow: var(--shadow-lg);
    border-bottom: 2px solid var(--primary);
    z-index: 1040;
  }

  .header__nav.mobile-open {
    display: flex !important;
    animation: mobileNavSlide 0.25s ease;
  }

  .header__nav a {
    height: auto;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    border-bottom: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
  }

  .header__nav a:hover,
  .header__nav a.active {
    background: var(--primary-light);
    color: var(--primary);
  }

  .subnav__scroll a { padding: 10px 14px; font-size: 13px; }
  .subnav__scroll a i { display: none; }

  .newsletter__inner {
    flex-direction: column;
    text-align: center;
  }

  .newsletter__form {
    min-width: 0;
    width: 100%;
  }

  .banner-overlay { padding: 14px 16px; }
  .banner-overlay__title { font-size: 16px; margin-bottom: 3px; }
  .banner-overlay__text { font-size: 12px; }
}

@keyframes mobileNavSlide {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  .header {
    height: auto;
    padding: 10px 0;
  }

  .header__inner {
    flex-wrap: wrap;
    gap: 12px;
    height: auto;
  }

  .header__logo { flex: 1; }
  .header__actions { gap: 4px; }

  .header__action-btn {
    width: 36px;
    height: 36px;
  }

  .header__action-btn > i { font-size: 15px; }

  .burger {
    padding: 4px;
    margin-left: 4px;
  }

  .header__search {
    width: 100%;
    max-width: 100%;
    height: 44px;
    order: 3;
    margin-top: 4px;
  }

  .header__search input { font-size: 14px; }
  .logo-text { font-size: 18px; }

  .notif-dropdown {
    position: fixed;
    top: 60px;
    left: 10px;
    right: 10px;
    width: auto;
  }

  .newsletter__inner {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .newsletter__text h2 {
    justify-content: center;
    font-size: 20px;
  }

  .newsletter__form {
    min-width: 0 !important;
    width: 100% !important;
    flex-direction: column;
    gap: 10px;
  }

  .newsletter__form input {
    width: 100%;
    border-radius: var(--radius-sm);
    text-align: center;
    box-sizing: border-box;
  }

  .newsletter__form button {
    width: 100%;
    border-radius: var(--radius-sm);
    justify-content: center;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .notif-dropdown {
    position: fixed;
    top: var(--header-height, 70px);
    left: 10px;
    right: 10px;
    width: auto;
  }
}

@media (max-width: 380px) {
  .logo-text { display: none; }
  .logo-icon { width: 40px; height: 40px; font-size: 18px; }
  .header__action-btn { width: 34px; height: 34px; }
  .header__action-btn > i { font-size: 14px; }
}

/* ==========================================
   FIX: колокольчик не уезжает вверх
   ========================================== */

.header__actions {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* Обёртка уведомлений = тот же «слот», что и у других кнопок */
.notif-wrap {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 42px !important;
  height: 42px !important;
  flex-shrink: 0 !important;
  vertical-align: middle !important;
  line-height: 0 !important;
}

/* Сама кнопка-колокольчик заполняет слот 1:1 */
.notif-wrap > .header__action-btn {
  position: relative !important;
  width: 42px !important;
  height: 42px !important;
  margin: 0 !important;
  top: 0 !important;
  left: 0 !important;
}

/* Иконка строго по центру круга */
.header__action-btn > i {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important;
  line-height: 1 !important;
  font-size: 16px !important;
}

/* Профиль — исключение: иконка не absolute */
.header__profile > i {
  position: static !important;
  transform: none !important;
}

/* Dropdown остаётся относительно .notif-wrap */
.notif-wrap .notif-dropdown {
  top: calc(100% + 10px) !important;
  right: -8px !important;
}

@media (max-width: 600px) {
  .notif-wrap,
  .notif-wrap > .header__action-btn {
    width: 36px !important;
    height: 36px !important;
  }
}