/* ==========================================================================
   Media Sphere — shared storefront header styles (Amazon/Jumia/Konga style)
   Loaded on dynamic pages via the layout and injected onto static pages so the
   new header renders identically everywhere. Light logo retained.
   ========================================================================== */

.ms-header {
  background: #16133d;
  border-bottom: 3px solid var(--tb-theme-color, #4f46e5);
}
.ms-header .ms-header-main { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 0; flex-wrap: wrap; }
.ms-header .ms-logo { display: inline-flex; align-items: center; }
.ms-header .ms-logo img { height: 46px; transition: opacity .2s; }
.ms-header .ms-logo:hover img { opacity: .85; }

/* Top utility bar */
.ms-topbar {
  background: #0e0c28;
  color: #c7cee3;
  font-size: 12.5px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.ms-topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 36px; gap: 16px; flex-wrap: wrap; padding: 4px 0; }
.ms-topbar-left, .ms-topbar-right { display: flex; align-items: center; gap: 18px; }
.ms-topbar-item { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.ms-topbar-item i { color: var(--ms-accent, #6366f1); font-size: 12px; }
.ms-topbar-right a { color: #c7cee3; display: inline-flex; align-items: center; gap: 6px; transition: color .2s; text-decoration: none; }
.ms-topbar-right a i { font-size: 12px; color: var(--ms-accent, #6366f1); }
.ms-topbar-right a:hover { color: #fff; }

/* Search bar */
.ms-header-search { flex: 1; min-width: 260px; max-width: 600px; margin: 0 auto; }
.ms-header-search form {
  display: flex; width: 100%; height: 44px;
  background: #fff; border-radius: 8px; overflow: hidden;
  border: 2px solid #fff; transition: border-color .2s;
}
.ms-header-search form:focus-within { border-color: var(--ms-accent, #6366f1); }
.ms-header-search .select-category { display: flex; align-items: center; background: #f1f3f9; border-right: 1px solid #e5e8f0; }
.ms-header-search .select-category select {
  border: none; background: transparent; padding: 0 10px 0 14px; font-size: 13px; height: 40px;
  max-width: 132px; color: #333; cursor: pointer; outline: none; font-weight: 600;
}
.ms-header-search input[type=text] {
  flex: 1; border: 0; padding: 0 16px; font-size: 14px; color: #333; min-width: 0; outline: none;
}
.ms-header-search button {
  border: none; background: var(--tb-theme-color, #4f46e5); color: #fff;
  padding: 0 24px; font-size: 14px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 7px; transition: background .2s;
}
.ms-header-search button:hover { background: var(--tb-theme-color-hover, #4338ca); }

/* Action icons */
.ms-header-actions { display: flex; align-items: center; gap: 4px; }
.ms-header-actions .ms-hact {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: #fff; position: relative; min-width: 60px; padding: 8px 12px;
  border-radius: 6px; transition: background .15s; text-decoration: none;
}
.ms-header-actions .ms-hact:hover { background: rgba(255,255,255,.10); }
.ms-header-actions .ms-hact i, .ms-header-actions .ms-hact svg { font-size: 20px; color: #fff; }
.ms-header-actions .ms-hact span.ms-hlabel { color: #dbe1f2; font-size: 11.5px; font-weight: 600; }
.ms-header-actions .ms-hact span.ms-hlabel-sm { font-size: 11px; }
.ms-header-actions .ms-hact .ms-count {
  position: absolute; top: 2px; left: 50%; transform: translateX(10px);
  background: #f43f5e; color: #fff; font-size: 11px; font-weight: 800; min-width: 19px; height: 19px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0 5px;
  box-shadow: 0 2px 6px rgba(244,63,94,.5);
}
.ms-header-actions .ms-hact .ms-count-wish { background: #f59e0b; box-shadow: 0 2px 6px rgba(245,158,11,.5); }

/* Login / register */
.ms-header-actions .ms-hact-login {
  background: var(--tb-theme-color, #4f46e5);
  border-radius: 6px; min-width: 0; padding: 9px 20px; flex-direction: row; gap: 8px;
}
.ms-header-actions .ms-hact-login:hover { background: var(--tb-theme-color-hover, #4338ca); }
.ms-header-actions .ms-hact-login i { font-size: 15px; }
.ms-header-actions .ms-hact-login span.ms-hlabel { color: #fff; font-size: 13px; }
.ms-header-actions .ms-hact-register { flex-direction: row; gap: 8px; min-width: 0; padding: 9px 16px; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; }
.ms-header-actions .ms-hact-register:hover { border-color: #fff; background: rgba(255,255,255,.08); }

/* User menu */
.ms-user-menu { position: relative; margin-right: 4px; }
.ms-user-btn {
  display: flex; align-items: center; gap: 10px; background: transparent;
  border: 1px solid rgba(255,255,255,.25); color: #fff; padding: 6px 14px 6px 6px;
  border-radius: 6px; cursor: pointer; transition: background .15s, border-color .15s; font-family: inherit;
}
.ms-user-btn:hover { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.4); }
.ms-user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  background: var(--tb-theme-color, #4f46e5); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}
.ms-user-avatar-lg { width: 44px; height: 44px; flex-basis: 44px; font-size: 18px; }
.ms-user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.ms-user-hello { font-size: 10.5px; color: #aab4d8; text-transform: uppercase; letter-spacing: .4px; }
.ms-user-name { font-size: 13.5px; font-weight: 700; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-user-caret { font-size: 10px; color: #aab4d8; margin-left: 2px; transition: transform .2s; }
.ms-user-menu.open .ms-user-caret { transform: rotate(180deg); }

.ms-user-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  background: #fff; border-radius: 10px; width: 250px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(22,19,61,.25); border: 1px solid #eef0f6;
  opacity: 0; visibility: hidden; transform: translateY(8px); transition: all .22s ease;
}
.ms-user-menu.open .ms-user-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.ms-user-drop-head {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  background: #f5f6ff; border-bottom: 1px solid #e5e9f7;
}
.ms-user-drop-head strong { display: block; color: #1e1b4b; font-size: 14px; }
.ms-user-drop-head span { color: #777; font-size: 12px; word-break: break-all; }
.ms-user-dropdown a, .ms-user-logout {
  display: flex; align-items: center; gap: 11px; padding: 11px 16px;
  color: #333; font-size: 13.5px; font-weight: 500; text-decoration: none; transition: background .15s;
  width: 100%; text-align: left; border: 0; background: #fff; cursor: pointer; font-family: inherit;
}
.ms-user-dropdown a i, .ms-user-logout i { width: 18px; text-align: center; color: var(--tb-theme-color, #4f46e5); font-size: 14px; }
.ms-user-dropdown a:hover { background: #f5f6ff; color: var(--tb-theme-color, #4f46e5); }
.ms-user-drop-sep { height: 1px; background: #eef0f6; margin: 4px 0; }
.ms-user-logout { color: #dc2626; }
.ms-user-logout i { color: #dc2626; }
.ms-user-logout:hover { background: #fef2f2; color: #b91c1c; }
.ms-badge-inline {
  display: inline-block; font-size: 9.5px; font-weight: 800; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; margin-left: 6px;
}
.ms-badge-inline.pending { background: #fef3c7; color: #92400e; }
.ms-badge-inline.approved { background: #ecfdf5; color: #047857; }
.ms-badge-inline.rejected { background: #fef2f2; color: #b91c1c; }

/* Nav — category strip with "All Categories" dropdown */
.ms-nav { background: #fff; border-bottom: 1px solid #e8e8e8; box-shadow: 0 2px 8px rgba(22,19,61,.04); }
.ms-nav .container { display: flex; align-items: center; position: relative; }
.ms-nav-cats { position: relative; }
.ms-nav-cats-btn {
  display: flex; align-items: center; gap: 9px; height: 44px; padding: 0 18px;
  background: var(--tb-theme-color, #4f46e5); color: #fff; border: none; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 700; border-radius: 6px 6px 0 0;
}
.ms-nav-cats-btn:hover { background: var(--tb-theme-color-hover, #4338ca); }
.ms-nav-cats-menu {
  position: absolute; top: 100%; left: 0; z-index: 55; width: 300px; max-height: 70vh; overflow: auto;
  background: #fff; border: 1px solid #e8e8e8; border-top: 2px solid var(--tb-theme-color, #4f46e5);
  border-radius: 0 0 8px 8px; box-shadow: 0 16px 40px rgba(22,19,61,.15);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: all .2s ease;
}
.ms-nav-cats:hover .ms-nav-cats-menu, .ms-nav-cats:focus-within .ms-nav-cats-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.ms-nav-cats-menu a {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  color: #333; font-size: 14px; font-weight: 500; border-bottom: 1px solid #f4f5f9;
  white-space: nowrap; text-decoration: none;
}
.ms-nav-cats-menu a i { width: 16px; text-align: center; color: var(--tb-theme-color, #4f46e5); font-size: 13px; }
.ms-nav-cats-menu a:hover { background: #f5f6ff; color: var(--tb-theme-color, #4f46e5); }
.ms-nav-links { display: flex; align-items: center; overflow-x: auto; margin-left: 18px; }
.ms-nav-links a { padding: 13px 16px; color: #1e1b4b; font-weight: 600; font-size: 14px; white-space: nowrap; transition: color .15s; text-decoration: none; }
.ms-nav-links a:hover, .ms-nav-links a.active { color: var(--tb-theme-color, #4f46e5); }

/* ===== Mobile header (fixed, simple) ===== */
.ms-mobile-header { display: none; }
.ms-mobile-drawer { display: none; }
.ms-mobile-overlay { display: none; }

/* Responsive */
.ms-topbar-hide-sm { display: inline-flex; }
@media (max-width: 992px) {
  .ms-header .ms-header-main { justify-content: center; gap: 14px; }
  .ms-header-search { order: 3; max-width: 100%; flex-basis: 100%; }
  .ms-header-actions { gap: 2px; }
}
@media (max-width: 768px) {
  /* Show the simple FIXED mobile header; hide the desktop header. */
  .ms-mobile-header {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: #16133d;
    border-bottom: 3px solid var(--tb-theme-color, #4f46e5);
    box-shadow: 0 2px 10px rgba(22,19,61,.25);
  }
  /* Add body padding so fixed header doesn't cover page content. */
  body { padding-top: 58px; }
  .ms-mh-top {
    display: grid;
    grid-template-columns: 44px 1fr 88px;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
  }
  .ms-mh-burger {
    width: 40px;
    height: 40px;
    border: 0;
    background: rgba(255,255,255,.10);
    color: #fff;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .ms-mh-burger:active { background: rgba(255,255,255,.22); }
  .ms-mh-logo { display: inline-flex; justify-content: center; }
  .ms-mh-logo img { height: 42px; }
  .ms-mh-icons { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
  .ms-mh-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #fff;
    background: rgba(255,255,255,.10);
  }
  .ms-mh-icon i { font-size: 18px; color: #fff; }
  .ms-mh-icon .ms-count {
    position: absolute; top: 0; right: 0;
    background: #f43f5e; color: #fff; font-size: 10px; font-weight: 800;
    min-width: 17px; height: 17px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
    transform: translate(4px, -2px);
  }
  .ms-mh-icon .ms-count-wish { background: #f59e0b; }
  .ms-header .ms-topbar,
  .ms-header .ms-header-main,
  .ms-header .ms-nav { display: none !important; }

  /* ---- Mobile drawer (nav/account/search) ---- */
  .ms-mobile-drawer {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    z-index: 120;
    background: #fff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.3);
  }
  .ms-mobile-drawer.open { transform: translateX(0); }
  .ms-md-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #16133d;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .ms-md-title { font-weight: 700; font-size: 16px; }
  .ms-md-close {
    width: 34px; height: 34px; border: 0; border-radius: 8px;
    background: rgba(255,255,255,.12); color: #fff; font-size: 16px; cursor: pointer;
  }
  .ms-md-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 16px;
    padding: 0 12px;
    height: 42px;
    background: #f2f4f9;
    border: 1px solid #e5e8f0;
    border-radius: 8px;
  }
  .ms-md-search i { color: #8a90a8; font-size: 14px; }
  .ms-md-search input { flex: 1; border: 0; outline: 0; font-size: 14px; color: #333; min-width: 0; background: transparent; }
  .ms-md-search button {
    border: 0; background: var(--tb-theme-color, #4f46e5); color: #fff;
    font-size: 12px; font-weight: 700; padding: 6px 14px; border-radius: 6px; cursor: pointer;
  }
  .ms-md-section { padding: 6px 16px 14px; border-bottom: 1px solid #f0f2f7; }
  .ms-md-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: #8a90a8; font-weight: 700; padding: 8px 0 4px;
  }
  .ms-md-section a, .ms-md-logout button {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 8px; color: #26303f; font-size: 14px; font-weight: 500;
    text-decoration: none; border-radius: 8px; width: 100%; text-align: left;
    border: 0; background: #fff; cursor: pointer; font-family: inherit;
  }
  .ms-md-section a i, .ms-md-logout button i { width: 18px; text-align: center; color: var(--tb-theme-color, #4f46e5); font-size: 15px; }
  .ms-md-section a:active { background: #f5f6ff; }
  .ms-md-logout { margin: 0; }
  .ms-md-logout button { color: #dc2626; }
  .ms-md-logout button i { color: #dc2626; }
  .ms-mobile-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(15,18,38,.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease;
  }
  .ms-mobile-overlay.show { opacity: 1; visibility: visible; }
  body.ms-drawer-open { overflow: hidden; }
}
