/* Petiht web header (_header.tpl, .main-header.ph-header; .ph-guest when signed out).
   Light: white bar, Haiti blue #00209F accents, Haiti red #D21034 create button and badges.
   Dark (body.night-mode): yellow #F5C518 icons and accents, white text, red create button. */

.main-header.ph-header {
  --ph-blue: #00209F;
  --ph-red: #D21034;
  --ph-yellow: #F5C518;
  --ph-ink: #0f172a;
  --ph-chip: #f3f5f8;
  --ph-chip-hover: #e8ebf0;
  --ph-line: #e6e9ef;
  background: #ffffff;
  border-bottom: 1px solid var(--ph-line);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
}

body.night-mode .main-header.ph-header {
  --ph-ink: #ffffff;
  --ph-chip: rgba(255, 255, 255, 0.06);
  --ph-chip-hover: rgba(255, 255, 255, 0.12);
  --ph-line: var(--card-dark-divider, #2e3f4d);
  background: var(--header-bg-color-dark, #262D34);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* flag stripe: hard stop, never a blended blue-red gradient */
.main-header.ph-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ph-blue) 0 50%, var(--ph-red) 50% 100%);
}

body.night-mode .main-header.ph-header::before {
  background: linear-gradient(90deg, var(--ph-yellow) 0 50%, var(--ph-red) 50% 100%);
}

/* text logo (only when no logo image is set) */
.ph-header .logo {
  color: var(--ph-blue);
}

body.night-mode .ph-header .logo {
  color: var(--ph-yellow);
}

/* ---------- icons ---------- */
.ph-header .header-icon,
.ph-header .header-icon * {
  color: var(--ph-ink) !important;
  fill: var(--ph-ink) !important;
}

body.night-mode .ph-header .header-icon,
body.night-mode .ph-header .header-icon * {
  color: var(--ph-yellow) !important;
  fill: var(--ph-yellow) !important;
}

/* ---------- search ---------- */
.ph-header .search-wrapper .form-control {
  padding-left: 18px;
  font-size: 15px;
  background: var(--ph-chip);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ph-header .search-wrapper .form-control:focus {
  background: #ffffff;
  border-color: var(--ph-blue);
  box-shadow: 0 0 0 3px rgba(0, 32, 159, 0.12);
}

body.night-mode .ph-header .search-wrapper .form-control:focus {
  background: var(--body-bg-color-dark, #1e252b);
  border-color: var(--ph-yellow);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.18);
}

.ph-header .search-input-icon {
  right: 16px;
}

/* ---------- action buttons ---------- */
.ph-header .navbar-wrapper > ul {
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
}

.ph-header .navbar-wrapper > ul > li {
  flex: 0 0 auto;
  margin: 0;
}

.ph-header .navbar-wrapper > ul > li > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  margin-top: 13px;
  padding: 0;
  line-height: 1;
  background: var(--ph-chip);
  border-radius: 50%;
  transition: background 0.15s ease, transform 0.15s ease;
}

.ph-header .navbar-wrapper > ul > li > a:hover {
  background: var(--ph-chip-hover);
}

.ph-header .navbar-wrapper > ul > li > a .header-icon {
  width: 22px !important;
  height: 22px !important;
}

/* open dropdown */
.ph-header .navbar-wrapper > ul > li.dropdown.show > a {
  background: var(--ph-blue);
}

.ph-header .navbar-wrapper > ul > li.dropdown.show > a .header-icon,
.ph-header .navbar-wrapper > ul > li.dropdown.show > a .header-icon * {
  color: #ffffff !important;
  fill: #ffffff !important;
}

body.night-mode .ph-header .navbar-wrapper > ul > li.dropdown.show > a {
  background: var(--ph-yellow);
}

body.night-mode .ph-header .navbar-wrapper > ul > li.dropdown.show > a .header-icon,
body.night-mode .ph-header .navbar-wrapper > ul > li.dropdown.show > a .header-icon * {
  color: #111111 !important;
  fill: #111111 !important;
}

/* create (+): red call to action in both themes */
.ph-header .navbar-wrapper > ul > li > a.ph-create,
body.night-mode .ph-header .navbar-wrapper > ul > li.dropdown.show > a.ph-create {
  background: var(--ph-red);
  box-shadow: 0 6px 16px rgba(210, 16, 52, 0.25);
}

.ph-header .navbar-wrapper > ul > li > a.ph-create:hover {
  background: #b50d2c;
  transform: translateY(-1px);
}

.ph-header a.ph-create .header-icon,
.ph-header a.ph-create .header-icon *,
body.night-mode .ph-header a.ph-create .header-icon,
body.night-mode .ph-header a.ph-create .header-icon * {
  color: #ffffff !important;
  fill: #ffffff !important;
}

/* ---------- badges ---------- */
.ph-header .navbar-wrapper .counter,
.ph-header .navbar-wrapper .counter.red {
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  color: #ffffff;
  background: var(--ph-red);
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: none !important;
}

body.night-mode .ph-header .navbar-wrapper .counter {
  border-color: var(--header-bg-color-dark, #262D34);
}

/* ---------- account avatar ---------- */
.ph-header .navbar-wrapper > ul > li > a.user-menu {
  padding: 2px;
  background: transparent;
  border: 2px solid var(--ph-blue);
}

body.night-mode .ph-header .navbar-wrapper > ul > li > a.user-menu {
  border-color: var(--ph-yellow);
}

.ph-header .navbar-wrapper > ul > li > a.user-menu > img {
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  border-radius: 50%;
}

.ph-header .user-menu.dropdown-toggle::after {
  content: none;
}

.ph-header .navbar-wrapper > ul > li.dropdown.show > a.user-menu {
  background: transparent;
  box-shadow: 0 0 0 3px rgba(0, 32, 159, 0.15);
}

body.night-mode .ph-header .navbar-wrapper > ul > li.dropdown.show > a.user-menu {
  background: transparent;
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.25);
}

/* ---------- signed-out visitors ---------- */
.ph-header .navbar-wrapper > ul > li > a.ph-icon i {
  font-size: 18px;
  color: var(--ph-ink);
}

body.night-mode .ph-header .navbar-wrapper > ul > li > a.ph-icon i {
  color: var(--ph-yellow);
}

.ph-header .navbar-wrapper > ul > li > a.ph-heart i,
body.night-mode .ph-header .navbar-wrapper > ul > li > a.ph-heart i {
  color: var(--ph-red);
}

.ph-header .navbar-wrapper > ul > li > a.ph-signin,
.ph-header .navbar-wrapper > ul > li > a.ph-signup {
  width: auto;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  border-radius: 999px;
}

.ph-header .navbar-wrapper > ul > li > a.ph-signin {
  color: var(--ph-blue);
  background: transparent;
  border: 2px solid var(--ph-blue);
}

.ph-header .navbar-wrapper > ul > li > a.ph-signin:hover {
  color: #ffffff;
  background: var(--ph-blue);
}

body.night-mode .ph-header .navbar-wrapper > ul > li > a.ph-signin {
  color: var(--ph-yellow);
  border-color: var(--ph-yellow);
}

body.night-mode .ph-header .navbar-wrapper > ul > li > a.ph-signin:hover {
  color: #111111;
  background: var(--ph-yellow);
}

.ph-header .navbar-wrapper > ul > li > a.ph-signup {
  color: #ffffff;
  background: var(--ph-red);
  box-shadow: 0 6px 16px rgba(210, 16, 52, 0.25);
}

.ph-header .navbar-wrapper > ul > li > a.ph-signup:hover {
  color: #ffffff;
  background: #b50d2c;
}

@media (max-width: 991.98px) {
  .ph-guest .navbar-wrapper > ul {
    gap: 6px;
  }

  .ph-header .navbar-wrapper > ul > li > a.ph-signin {
    padding: 0 14px;
  }
}

/* "Join" menu: round account button, label hidden */
.ph-guest .navbar-wrapper > ul > li > a.user-menu {
  float: none !important;
}

.ph-guest .navbar-wrapper > ul > li > a.user-menu > span {
  display: none;
}

/* ---------- group invite card in web chat (__feeds_message.tpl) ---------- */
.chat-invite-card {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 300px;
  margin-top: 6px;
  padding: 10px;
  color: #0f172a !important;
  text-decoration: none !important;
  background: #ffffff;
  border: 1px solid #e6e9ef;
  border-top: 3px solid #00209F;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.conversation.right .chat-invite-card {
  margin-left: auto;
}

.chat-invite-photo {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
}

.chat-invite-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  background: #D21034;
}

.chat-invite-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.3;
}

.chat-invite-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #00209F;
}

.chat-invite-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-invite-meta {
  font-size: 12px;
  color: #64748b;
}

.chat-invite-btn {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  background: #D21034;
  border-radius: 999px;
}

body.night-mode .chat-invite-card {
  color: #ffffff !important;
  background: var(--card-dark-color, #262D34);
  border-color: var(--card-dark-divider, #2e3f4d);
  border-top-color: #F5C518;
}

body.night-mode .chat-invite-label {
  color: #F5C518;
}

body.night-mode .chat-invite-meta {
  color: #b8c2cc;
}

/* ---------- unread notifications ---------- */
.ph-header .js_live-notifications .feeds-item.unread {
  box-shadow: inset 3px 0 0 var(--ph-red);
}

/* ---------- phones (header is 54px tall) ---------- */
@media (max-width: 767.98px) {
  .ph-header .navbar-wrapper > ul {
    gap: 6px;
  }

  .ph-header .navbar-wrapper > ul > li > a {
    width: 38px;
    min-width: 38px;
    height: 38px;
    margin-top: 8px;
  }

  .ph-header .navbar-wrapper > ul > li > a .header-icon {
    width: 20px !important;
    height: 20px !important;
  }

  .ph-header .navbar-wrapper .counter,
  .ph-header .navbar-wrapper .counter.red {
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    line-height: 14px;
  }

  .ph-header .search-wrapper .form-control {
    padding-left: 14px;
    font-size: 14px;
  }
}

@media (max-width: 380px) {
  .ph-header .navbar-wrapper > ul {
    gap: 4px;
  }

  .ph-header .navbar-wrapper > ul > li > a {
    width: 34px;
    min-width: 34px;
    height: 34px;
    margin-top: 8px;
  }
}
