/* ===========================
   HEADER LAYOUT
   =========================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(20, 20, 20, 0.75); /* transparency is now 0.75 */
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px; /* or your previous value */
  border-top: 1px solid #20c0ff;
  border-bottom: 1px solid #20c0ff; /* Match footer line color */
}

.header-left {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.header-center {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  position: static; /* remove absolute positioning */
}

.header-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 40px; /* 1cm from the right edge */
}

/* ===========================
   LOGOS
   =========================== */
.logo {
  height: 48px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.rustlogo {
  display: block;
  margin: 0 auto;
  max-height: 64px;
}

/* ===========================
   USER INFO
   =========================== */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 1px solid #444; /* Small border between language and user info/login */
  padding-left: 40px; /* 10mm to the right */
}

.user-info .avatar {
  border-radius: 50%;
  height: 32px;
  width: 32px;
  object-fit: cover;
}

.user-info span {
  color: #fff;
  font-size: 14px;
}

.user-info a {
  color: #ccc;
  font-size: 14px;
  text-decoration: none;
}

.user-info a:hover {
  color: #fff;
}

/* ===========================
   LANGUAGE DROPDOWN
   =========================== */
.language-toggle {
  position: relative;
  margin-right: 40px; /* 10mm to the right */
  margin-left: -40px; /* Move 10mm to the left */
}

.language-btn {
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
}

.flag-icon {
  width: 20px;
  height: 14px;
  margin-right: 6px;
  vertical-align: middle;
}

.language-btn .arrow {
  margin-left: 4px;
  font-size: 10px;
}

/* ===========================
   DROPDOWN MENU
   =========================== */
.language-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #222;
  border: 1px solid #444;
  border-radius: 4px;
  min-width: 140px;
  padding: 5px 0;
  z-index: 1000;

  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.language-dropdown.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.language-dropdown a {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  color: #fff;
  font-size: 14px;
  text-decoration: none;
}

.language-dropdown a:hover {
  background: #333;
}

.language-dropdown a img {
  width: 20px;
  height: 14px;
  margin-right: 8px;
}

/* ===========================
   RESPONSIVE BEHAVIOUR
   =========================== */
@media (max-width: 768px) {
  header {
    flex-wrap: wrap;
    padding: 10px;
  }

  .header-center {
    order: 3;
    margin-top: 10px;
  }

  .header-right {
    order: 2;
  }

  .header-left {
    order: 1;
  }

  .language-dropdown {
    right: auto;
    left: 0;
  }
}

/* ===========================
   FLAG BUTTON HOVER EFFECT
   =========================== */
.language-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.language-btn:hover .arrow {
  color: #fff;
}

/* Add padding to body or main container to prevent content hiding under header */
body, .main-container {
  padding-top: 80px; /* adjust to match header height */
}

.center-line {
  width: 5mm;
  height: 2px;
  background: #fff;
  margin-top: 8px;
  margin-bottom: 0;
}

/* ===========================
   SITE HEADER OVERRIDES
   =========================== */
header.site-header {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  background: rgba(0, 0, 0, 0.55);
  box-sizing: border-box;
  position: relative;
  z-index: 4000;
  overflow: visible;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-left img {
  height: 64px;
  display: block;
}

.pulldown-menu {
  position: absolute;
  left: 10px;
  top: 100%;
  margin-top: 8px;
  display: none;
  min-width: 190px;
  background: rgba(6, 22, 28, 0.96);
  border: 1px solid rgba(32, 192, 255, 0.12);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 1002;
  user-select: none;
}

.pulldown-menu.show {
  display: block;
}

.pulldown-menu a {
  display: block;
  padding: 8px 12px;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  margin: 4px 0;
  font-size: 0.95rem;
}

.pulldown-menu a:hover {
  background: rgba(32, 192, 255, 0.08);
  color: #20c0ff;
}

.pulldown-menu a.disabled {
  color: #666;
  pointer-events: none;
  cursor: default;
  opacity: 0.5;
}

.pulldown-menu hr {
  border: none;
  border-top: 1px solid rgba(32, 192, 255, 0.15);
  margin: 4px 0;
}

.menu-login {
  padding: 6px 8px;
}

.menu-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.menu-toggle .bar {
  display: block;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.6);
}

/* only show focus ring while the menu is open to avoid persistent highlight when closed */
body.menu-open .menu-toggle:focus {
  outline: 2px solid rgba(32, 192, 255, 0.35);
  outline-offset: 2px;
}

.header-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-center img {
  max-height: 78px;
  width: auto;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.stream-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(32, 192, 255, 0.5);
  background: rgba(32, 192, 255, 0.08);
  color: #d8f6ff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.stream-status-btn:hover {
  background: rgba(32, 192, 255, 0.16);
}

.stream-status-btn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #95a7ad;
  display: inline-block;
}

@keyframes stream-live-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(63, 196, 106, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 10px rgba(63, 196, 106, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(63, 196, 106, 0); }
}

.stream-status-btn.is-live {
  border-color: rgba(63, 196, 106, 0.9);
  background: rgba(63, 196, 106, 0.22);
  color: #ffffff;
}

.stream-status-btn.is-live .dot {
  background: #3fc46a;
  animation: stream-live-pulse 1.5s infinite;
}

.stream-status-btn.is-offline {
  opacity: 0.9;
}

@media (prefers-reduced-motion: reduce) {
  .stream-status-btn.is-live .dot {
    animation: none;
  }
}

.stream-status-wrap {
  position: relative;
  margin-left: 24px;
}

.stream-platforms {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  width: 100%;
  justify-content: flex-start;
  padding-left: 10px;
}

.stream-platform-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
  overflow: hidden;
}

.stream-platform-icon svg {
  width: 13px;
  height: 13px;
  display: block;
}

.stream-platform-icon.twitch {
  background: #9146ff;
  border-color: rgba(145, 70, 255, 0.9);
}

.stream-platform-icon.kick {
  background: #53fc18;
  border-color: rgba(83, 252, 24, 0.9);
  color: #07130a;
}

.stream-platform-icon.youtube {
  background: #ff0000;
  border-color: rgba(255, 0, 0, 0.9);
  color: #fff;
}

.stream-platform-icon.placeholder {
  opacity: 0.45;
  cursor: default;
}

.stream-platform-icon.placeholder span {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.stream-live-list {
  display: none;
  position: absolute;
  left: 0;
  top: 115%;
  min-width: 240px;
  max-width: 320px;
  background: rgba(6, 22, 28, 0.97);
  border: 1px solid rgba(32, 192, 255, 0.35);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 1003;
}

.stream-live-list.show {
  display: block;
}

.stream-live-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  line-height: 1.3;
}

.stream-live-list a:hover {
  background: rgba(32, 192, 255, 0.14);
}

.stream-live-list .stream-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 24px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.45);
}

.stream-live-list .stream-meta {
  display: block;
  min-width: 0;
}

.stream-live-list .stream-line {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stream-live-list .platform-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 14px;
  min-width: 34px;
  padding: 0 5px;
  margin-right: 6px;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.stream-live-list .platform-badge.twitch {
  background: #9146ff;
  color: #fff;
}

.stream-live-list .platform-badge.kick {
  background: #53fc18;
  color: #07130a;
}

.stream-live-list .platform-badge.youtube {
  background: #ff0000;
  color: #fff;
}

.stream-live-list .platform-badge.unknown {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.stream-live-list .stream-name {
  font-weight: 700;
}

.stream-live-list .stream-viewers {
  font-weight: 400;
  opacity: 0.95;
}

.stream-live-list .stream-game {
  display: block;
  opacity: 0.9;
  font-weight: 400;
}

.stream-live-list .empty {
  padding: 8px 10px;
  font-size: 0.8rem;
  color: #b9c7cc;
}

.language-selector {
  position: relative;
}

.language-toggle-btn {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.language-toggle-btn:focus {
  outline: 2px solid rgba(32, 192, 255, 0.35);
  outline-offset: 3px;
  border-radius: 4px;
}

.current-flag {
  width: 28px;
  cursor: pointer;
  border-radius: 3px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}

.language-menu {
  display: none;
  position: absolute;
  top: 110%;
  right: 0;
  background: rgba(6, 22, 28, 0.97);
  border: 1px solid rgba(32, 192, 255, 0.35);
  border-radius: 8px;
  padding: 8px;
  min-width: 340px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 1000;
}

.language-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 6px;
  white-space: nowrap;
}

.language-menu a:hover {
  background: rgba(32, 192, 255, 0.35);
}

.language-menu img {
  width: 20px;
  border-radius: 2px;
}

.user-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-block .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.user-block span {
  font-size: 0.9rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-block a {
  color: #20c0ff;
  text-decoration: none;
  font-size: 0.75rem;
}

.user-block a:hover {
  text-decoration: underline;
}

@media (max-width: 780px) {
  header,
  header.site-header {
    flex-wrap: wrap;
    align-items: flex-start;
    min-height: 84px;
    height: auto;
    padding: 10px 14px;
    row-gap: 8px;
  }

  .header-left {
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    gap: 8px;
  }

  .header-left img {
    height: 52px;
  }

  .header-right {
    flex: 0 1 auto;
    min-width: 0;
    margin-left: auto;
    padding-right: 0;
    gap: 10px;
  }

  .user-block {
    min-width: 0;
    gap: 8px;
  }

  .user-block span {
    max-width: 92px;
    font-size: 0.82rem;
  }

  .user-block > a img {
    display: block;
    max-width: 110px;
    height: auto;
  }

  .stream-status-wrap {
    order: 3;
    width: 100%;
    margin-left: 0;
    margin-top: 2px;
  }

  .stream-status-btn {
    font-size: 0.72rem;
    padding: 6px 10px;
  }

  .stream-platforms {
    padding-left: 0;
  }

  .stream-live-list {
    left: 0;
    right: auto;
    min-width: min(260px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
  }

  .language-menu {
    min-width: min(280px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
  }

  .language-menu a {
    white-space: normal;
  }

  body,
  .main-container {
    padding-top: 132px;
  }
}

@media (max-width: 780px) and (orientation: landscape) {
  .header-center {
    display: flex;
  }

  .header-center img {
    max-height: 62px;
  }
}

@media (max-width: 780px) and (orientation: portrait) {
  .header-center {
    display: none;
  }

  .header-right {
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 6px;
  }

  .user-block {
    justify-content: flex-end;
    align-self: flex-end;
  }

  .user-block > a {
    display: block;
  }

  .language-selector {
    align-self: flex-end;
  }

  .language-toggle-btn {
    display: flex;
    justify-content: flex-end;
  }

  body,
  .main-container {
    padding-top: 148px; 
  }
}

@media (max-width: 480px) {
  .header-left img {
    height: 46px;
  }

  .user-block span {
    max-width: 72px;
  }

  .stream-status-btn {
    font-size: 0.68rem;
    padding: 6px 9px;
  }

  .stream-platforms {
    gap: 5px;
  }

  body,
  .main-container {
    padding-top: 138px;
  }
}

@media (max-width: 480px) and (orientation: portrait) {
  body,
  .main-container {
    padding-top: 154px;
  }
}
