/* ============================================================
   header.css — MHub Header
   Floating glass card + search expandabil
   ============================================================ */

/* ---------- 1. Header wrapper ---------- */
.header {
  position: sticky;
  top: 10px;
  z-index: 100;
  margin: 10px auto 0;
  width: calc(100% - 24px);
  max-width: 1240px;
  padding: 0;
  background: transparent;
  border: 0;
  pointer-events: none;
}

/* ---------- 2. Card interior ---------- */
.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 58px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.65);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.06),
    0 2px 6px rgba(15, 23, 42, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  pointer-events: auto;
  overflow: hidden;
  transition: box-shadow .3s, background .3s;
}

.header.scrolled .header-inner {
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    0 12px 32px rgba(15, 23, 42, 0.10),
    0 4px 10px rgba(15, 23, 42, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] .header-inner {
  background: rgba(20, 28, 45, 0.65);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .header.scrolled .header-inner {
  background: rgba(20, 28, 45, 0.85);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ---------- 3. Logo ---------- */
.header .brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: 42px;
  padding: 0 8px;
  border-radius: 14px;
  text-decoration: none;
  transition: background .15s;
}
.header .brand:hover {
  background: rgba(255, 255, 255, 0.4);
}
html[data-theme="dark"] .header .brand:hover {
  background: rgba(255, 255, 255, 0.06);
}
.header .brand .logo {
  height: 26px;
  width: auto;
  display: block;
}

/* Logo light/dark switch */
.header .brand .logo-light { display: block; }
.header .brand .logo-dark  { display: none; }
html[data-theme="dark"] .header .brand .logo-light { display: none; }
html[data-theme="dark"] .header .brand .logo-dark  { display: block; }

/* ---------- 4. Icon button ---------- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: 14px;
  color: #0f172a;
  font-size: 16px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform .15s, background .15s, color .15s;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.75);
  color: #16a34a;
}
.icon-btn:active { transform: scale(0.92); }

html[data-theme="dark"] .icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .icon-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #22c55e;
}

.menu-btn { order: 1; }

/* ---------- 5. Search desktop ---------- */
.search {
  position: relative;
  display: none;
  align-items: center;
  flex: 1;
  max-width: 440px;
  height: 42px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  cursor: text;
  order: 3;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search:focus-within {
  border-color: #22c55e;
  background: rgba(255, 255, 255, 0.85);
  box-shadow:
    0 0 0 4px rgba(34, 197, 94, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.search .search-icon {
  color: #94a3b8;
  font-size: 13px;
  margin-right: 10px;
  flex-shrink: 0;
}
.search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0f172a;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.search input::placeholder { color: #94a3b8; }
.search input::-webkit-search-cancel-button { display: none; }

.search-kbd {
  display: none;
  padding: 3px 6px;
  font-size: 10.5px;
  font-family: inherit;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 6px;
}
html[data-theme="dark"] .search {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .search:focus-within {
  background: rgba(255, 255, 255, 0.10);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}
html[data-theme="dark"] .search input { color: #f1f5f9; }
html[data-theme="dark"] .search-kbd {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.10);
}

/* ---------- 6. Nav ---------- */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  order: 4;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 14px;
  color: #475569;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.nav-btn i { font-size: 16px; }
.nav-btn:hover {
  background: rgba(255, 255, 255, 0.55);
  color: #16a34a;
}
.nav-btn:active { transform: scale(0.94); }
.nav-btn.active {
  background: rgba(255, 255, 255, 0.7);
  color: #16a34a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

html[data-theme="dark"] .nav-btn { color: #cbd5e1; }
html[data-theme="dark"] .nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #22c55e;
}
html[data-theme="dark"] .nav-btn.active {
  background: rgba(255, 255, 255, 0.10);
  color: #22c55e;
}

.nav-btn .nav-label { display: none; }

/* ---------- 7. Cart badge ---------- */
.cart-btn .cart-count {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #22c55e;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 2px 6px rgba(34, 197, 94, 0.45),
    0 0 0 2px #fff;
}
html[data-theme="dark"] .cart-btn .cart-count {
  box-shadow:
    0 2px 6px rgba(34, 197, 94, 0.45),
    0 0 0 2px #0b1220;
}
.mobile-menu .cart-count {
  position: static;
  margin-left: auto;
  box-shadow: none;
  min-width: 20px;
  height: 20px;
  font-size: 10px;
}

/* Vizibilitate butoane */
.search-btn { display: inline-flex; }
.theme-btn  { display: inline-flex; }
.user-btn   { display: none; }

/* ============================================================
   8. SEARCH EXPANDABILĂ (mobil)
   ============================================================ */
.search-expand {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-radius: inherit;
  z-index: 10;
  opacity: 0;
  transform: translateX(100%);
  pointer-events: none;
  transition: transform .35s cubic-bezier(.32, .72, 0, 1),
              opacity .25s ease;
}
html[data-theme="dark"] .search-expand {
  background: rgba(20, 28, 45, 0.94);
}

.search-expand.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* Buton back */
.search-expand-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #0f172a;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  transition: background .15s, transform .15s;
}
.search-expand-back:hover { background: rgba(255, 255, 255, 0.5); }
.search-expand-back:active { transform: scale(0.9); }
html[data-theme="dark"] .search-expand-back { color: #f1f5f9; }
html[data-theme="dark"] .search-expand-back:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Câmp căutare */
.search-expand-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color .15s, box-shadow .15s;
}
.search-expand-field:focus-within {
  border-color: #22c55e;
  box-shadow:
    0 0 0 4px rgba(34, 197, 94, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
html[data-theme="dark"] .search-expand-field {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .search-expand-field:focus-within {
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.search-expand-icon {
  color: #94a3b8;
  font-size: 14px;
  flex-shrink: 0;
}

#search-expand-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #0f172a;
  font-family: inherit;
  font-size: 15px;
  outline: none;
  padding: 0;
}
#search-expand-input::placeholder { color: #94a3b8; }
#search-expand-input::-webkit-search-cancel-button { display: none; }
html[data-theme="dark"] #search-expand-input { color: #f1f5f9; }

.search-expand-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  transition: color .15s, transform .15s;
}
.search-expand-clear:hover { color: #475569; }
.search-expand-clear:active { transform: scale(0.9); }
.search-expand-clear.visible { display: inline-flex; }

/* Ascunde pe desktop */
@media (min-width: 640px) {
  .search-expand { display: none !important; }
}

/* ============================================================
   9. MOBILE MENU
   ============================================================ */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
  z-index: 998;
}
.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  padding: 18px 14px;
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 8px 0 40px rgba(15, 23, 42, 0.12);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transform: translateX(-100%);
  transition: transform .35s cubic-bezier(.32, .72, 0, 1);
}
.mobile-menu.active { transform: translateX(0); }
html[data-theme="dark"] .mobile-menu {
  background: rgba(20, 28, 45, 0.92);
  border-right-color: rgba(255, 255, 255, 0.08);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
html[data-theme="dark"] .mobile-menu-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.mobile-menu-header .brand {
  height: 40px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.mobile-menu-header .brand .logo { height: 26px; }
.mobile-menu-header .brand .logo-light { display: block; }
.mobile-menu-header .brand .logo-dark  { display: none; }
html[data-theme="dark"] .mobile-menu-header .brand .logo-light { display: none; }
html[data-theme="dark"] .mobile-menu-header .brand .logo-dark  { display: block; }

.mobile-menu-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #475569;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s, border-color .15s;
}
.mobile-menu-item:active { transform: scale(0.98); }
.mobile-menu-item:hover,
.mobile-menu-item.active {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.20);
  color: #15803d;
}
.mobile-menu-item i {
  width: 20px;
  font-size: 16px;
  color: #22c55e;
  text-align: center;
  flex-shrink: 0;
}
.mobile-menu-item.active i { color: #15803d; }
html[data-theme="dark"] .mobile-menu-item { color: #cbd5e1; }
html[data-theme="dark"] .mobile-menu-item:hover,
html[data-theme="dark"] .mobile-menu-item.active {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.mobile-menu-footer {
  padding-top: 12px;
  margin-top: 6px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}
html[data-theme="dark"] .mobile-menu-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* ---------- 10. Theme switch ---------- */
.theme-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  color: #475569;
  font-size: 14.5px;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}
.theme-switch:hover {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.18);
}
.theme-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.theme-switch-label i {
  width: 20px;
  font-size: 15px;
  color: #22c55e;
  text-align: center;
}
.theme-switch-track {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  transition: background .25s;
}
.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform .25s cubic-bezier(.32, .72, 0, 1);
}
html[data-theme="dark"] .theme-switch { color: #cbd5e1; }
html[data-theme="dark"] .theme-switch-track { background: #22c55e; }
html[data-theme="dark"] .theme-switch-thumb { transform: translateX(18px); }

/* ============================================================
   11. RESPONSIVE
   ============================================================ */

/* Very small */
@media (max-width: 379px) {
  .header {
    top: 8px;
    margin-top: 8px;
    width: calc(100% - 16px);
  }
  .header-inner {
    height: 54px;
    padding: 0 6px;
    border-radius: 18px;
  }
  .header .brand { height: 38px; padding: 0 6px; }
  .header .brand .logo { height: 22px; }
  .icon-btn { width: 38px; height: 38px; font-size: 15px; border-radius: 12px; }
  .nav-btn { min-width: 38px; height: 38px; border-radius: 12px; padding: 0 6px; }
  .nav-btn i { font-size: 15px; }
  .nav { gap: 2px; }
}

/* Tablet */
@media (min-width: 640px) {
  .header {
    top: 14px;
    margin-top: 14px;
    width: calc(100% - 40px);
  }
  .header-inner {
    height: 62px;
    padding: 0 10px;
    border-radius: 24px;
    gap: 12px;
  }
  .header .brand .logo { height: 28px; }
  .search { display: flex; }
  .search-btn { display: none; }
  .nav { gap: 4px; }
  .user-btn { display: inline-flex; }
}

/* Desktop */
@media (min-width: 960px) {
  .header {
    top: 16px;
    margin-top: 16px;
    width: calc(100% - 64px);
  }
  .header-inner {
    height: 66px;
    padding: 0 12px;
    border-radius: 26px;
    gap: 16px;
  }
  .menu-btn { display: none; }
  .search { max-width: 480px; }
  .search-kbd { display: inline-block; }
  .nav { gap: 6px; margin-left: auto; }
  .nav-btn {
    height: 46px;
    padding: 0 14px;
    gap: 8px;
    border-radius: 16px;
  }
  .nav-btn .nav-label { display: inline; }
  .theme-btn { padding: 0; min-width: 46px; }
  .theme-btn .nav-label { display: none; }
}

/* Large */
@media (min-width: 1280px) {
  .header { width: calc(100% - 96px); }
  .header-inner { padding: 0 14px; }
  .search { max-width: 520px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .header-inner,
  .icon-btn,
  .nav-btn,
  .search,
  .search-expand,
  .mobile-menu,
  .theme-switch-thumb,
  .theme-switch-track {
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   ORDINE HEADER — hamburger ÎNAINTE de logo
   ============================================================ */

/* Reset ordine */
.header-inner .brand { order: 2; }
.header-inner .menu-btn { order: 1; }
.header-inner .search { order: 3; }
.header-inner .nav { order: 4; }