/* ==========================================================================
   Header (top bar) của whois.inet.vn
   File CSS thuần (gulp-sass chỉ pass-through) — nạp SAU header.css theo thứ
   tự alphabet của glob ./public/css/style/*.css nên dùng để ghi đè.

   Xử lý 3 vấn đề UX/UI:
   1. Các nút bên phải (iNET Tools, Extension, chuông, tài khoản) dính sát
      nhau vì <li> của navbar không có khoảng cách -> bố cục flex + gap.
   2. Thông báo khó nhìn: core_menu.css của SSO dùng biến thiết kế
      --vi-color-* nhưng whois.inet.vn không khai báo, nên chữ badge và
      tiêu đề dropdown rơi về màu xám trên nền đỏ/xanh đậm. Khai báo lại
      token theo đúng giá trị của inet.vn + phóng to badge cho dễ đọc.
   3. Dropdown tài khoản: đổi từ panel xám đậm sang card sáng, bổ sung lối
      vào "Quản lý dịch vụ" (portal.inet.vn).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design token dùng chung với inet.vn
   Thiếu các biến này thì core_menu.css/notification.css của SSO render sai
   màu (chữ xám trên nền đỏ, nền dropdown trong suốt).
   -------------------------------------------------------------------------- */
:root {
  --vi-color-surface-background: #fff;
  --vi-color-surface-elevated: #F4F7FA;
  --vi-color-success-default: #0E9F6E;
  --vi-color-error-default: #B91C1C;
  --vi-color-error-text: #991B1B;
}

/* --------------------------------------------------------------------------
   2. Bố cục hàng nút bên phải
   -------------------------------------------------------------------------- */
@media screen and (min-width: 769px) {
  #header .inet-navbar-header .control-menu > .navbar-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    height: 48px;
    margin: 0;
    /* header.css ép width:100% từ 800px trở xuống khiến hàng nút rơi
       xuống dòng thứ hai ở dải 769–800px — trả về co theo nội dung. */
    float: right;
    width: auto;
  }
  #header .inet-navbar-header .control-menu > .navbar-nav > li {
    float: none;
    display: flex;
    align-items: center;
  }
  /* Vạch ngăn giữa nhóm CTA và nhóm tài khoản */
  #header .inet-navbar-header .control-menu > .navbar-nav > .notifications:before,
  #header .inet-navbar-header .control-menu > .navbar-nav > .link-login:before {
    content: "";
    width: 1px;
    height: 22px;
    margin-right: 6px;
    background-color: rgba(15, 35, 60, 0.12);
  }
}

/* --------------------------------------------------------------------------
   3. Nút CTA (iNET Tools / Extension)
   -------------------------------------------------------------------------- */
#header .control-menu .i-hdr-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
#header .control-menu .i-hdr-btn > i {
  font-size: 15px;
}
#header .control-menu .i-hdr-btn .i-hdr-btn-arrow {
  opacity: .85;
}
#header .control-menu .i-hdr-btn-tools {
  background: linear-gradient(135deg, #0a6ccb 0%, #024799 100%);
  box-shadow: 0 1px 3px rgba(2, 71, 153, 0.28);
}
#header .control-menu .i-hdr-btn-ext {
  background: linear-gradient(135deg, #49c98d 0%, #2e7d32 100%);
  box-shadow: 0 1px 3px rgba(46, 125, 50, 0.28);
}
#header .control-menu .i-hdr-btn-tools:hover,
#header .control-menu .i-hdr-btn-tools:focus {
  background: linear-gradient(135deg, #0a6ccb 0%, #024799 100%);
  box-shadow: 0 4px 12px rgba(2, 71, 153, 0.38);
  filter: brightness(1.07);
  transform: translateY(-1px);
}
#header .control-menu .i-hdr-btn-ext:hover,
#header .control-menu .i-hdr-btn-ext:focus {
  background: linear-gradient(135deg, #49c98d 0%, #2e7d32 100%);
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.38);
  filter: brightness(1.07);
  transform: translateY(-1px);
}
#header .control-menu .i-hdr-btn:active {
  transform: translateY(0);
  filter: brightness(.96);
}
#header .control-menu .i-hdr-btn:focus-visible {
  outline: 2px solid #024799;
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   4. Chuông thông báo + badge số chưa đọc
   -------------------------------------------------------------------------- */
#header .notifications > .i-hdr-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  background-color: transparent;
  color: #5b6b7c;
  font-size: 17px;
  transition: background-color .15s linear, color .15s linear;
}
#header .notifications > .i-hdr-bell:hover,
#header .notifications > .i-hdr-bell:focus,
#header .notifications.open > .i-hdr-bell,
#header .notifications.open > .i-hdr-bell:hover,
#header .notifications.open > .i-hdr-bell:focus {
  background-color: #eaf1fb;
  color: #024799;
}
#header .notifications > .i-hdr-bell:focus-visible {
  outline: 2px solid #024799;
  outline-offset: 2px;
}
#header .notifications > .i-hdr-bell > .i-hdr-bell-label {
  display: none;
}
/* Ghi đè .notifications-length của core_menu.css (badge 14px, bo góc lệch,
   chữ dựa vào biến --vi-color-* nên bị xám trên nền đỏ). */
#header .notifications > .i-hdr-bell > .notifications-length {
  position: absolute;
  top: 2px;
  right: 2px;
  left: auto;
  margin: 0;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  width: auto;
  height: 18px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background-color: #d32f2f;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  vertical-align: top;
}

/* --------------------------------------------------------------------------
   5. Dropdown thông báo
   -------------------------------------------------------------------------- */
#header .notifications.open > ul.dropdown-menu {
  margin-top: 6px;
  border: 1px solid rgba(15, 35, 60, 0.08);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 35, 60, 0.18);
}
#header .notifications .dropdown-header .ntfct-header-title,
#header .notifications .dropdown-header a {
  color: #fff;
}
#header .notifications .dropdown-header a {
  text-decoration: underline;
}
#header .notifications .dropdown-content {
  background-color: #fff;
}

/* --------------------------------------------------------------------------
   6. Nút tài khoản + dropdown
   -------------------------------------------------------------------------- */
#header .control-menu .user-info > .i-hdr-account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background-color: transparent;
  color: #3b4756;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color .15s linear, color .15s linear;
}
/* Chỉ ghi đè MÀU cho trạng thái hover/mở (header.css cho nền xám đậm khi
   .open). Giữ selector phần hộp ở độ ưu tiên thấp để media query mobile
   bên dưới còn ghi đè được. */
#header .control-menu .user-info > .i-hdr-account:hover,
#header .control-menu .user-info > .i-hdr-account:focus,
#header .inet-navbar-header .control-menu .user-info.open > .dropdown-toggle.i-hdr-account {
  background-color: #eaf1fb;
  color: #024799;
}
#header .control-menu .user-info > .i-hdr-account:focus-visible {
  outline: 2px solid #024799;
  outline-offset: 2px;
}
#header .control-menu .user-info .i-hdr-avatar {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #e3e9f0;
  background-color: #f2f5f9;
  object-fit: cover;
}
#header .control-menu .user-info .i-hdr-account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Card dropdown — ghi đè panel xám đậm mặc định trong header.css */
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu {
  min-width: 248px;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid rgba(15, 35, 60, 0.08);
  border-radius: 10px;
  background-color: #fff;
  box-shadow: 0 10px 28px rgba(15, 35, 60, 0.16);
}
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background-color: transparent;
  color: #3b4756;
  font-size: 13.5px;
  line-height: 1.4;
  white-space: nowrap;
  transition: background-color .15s linear, color .15s linear;
}
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a > i {
  flex: 0 0 16px;
  width: 16px;
  margin-right: 0;
  color: #8a97a6;
  font-size: 14px;
  text-align: center;
}
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a:hover,
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a:focus {
  background-color: #eaf1fb;
  color: #024799;
}
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a:hover > i,
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a:focus > i {
  color: #024799;
}
/* Lối vào portal — mục chính nên nhấn mạnh hơn */
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a.i-hdr-account-primary,
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a.i-hdr-account-primary > i {
  color: #024799;
}
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a.i-hdr-account-primary {
  font-weight: 600;
}
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a.i-hdr-account-signout:hover,
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a.i-hdr-account-signout:focus {
  background-color: #fdecec;
  color: #c62828;
}
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a.i-hdr-account-signout:hover > i,
#header .inet-navbar-header .control-menu .user-info > .dropdown-menu.i-hdr-account-menu li > a.i-hdr-account-signout:focus > i {
  color: #c62828;
}
#header .control-menu .user-info .i-hdr-account-menu > .divider {
  margin: 6px 4px;
  background-color: rgba(15, 35, 60, 0.09);
}
#header .control-menu .user-info .i-hdr-account-head {
  padding: 8px 10px 10px;
  line-height: 1.35;
}
#header .control-menu .user-info .i-hdr-account-head > strong {
  display: block;
  overflow: hidden;
  color: #1f2d3d;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#header .control-menu .user-info .i-hdr-account-head > small {
  display: block;
  overflow: hidden;
  color: #7b8794;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   7. Nút đăng nhập (khách chưa đăng nhập)
   -------------------------------------------------------------------------- */
#header .control-menu .link-login > a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid #cfdcea;
  border-radius: 8px;
  background-color: transparent;
  color: #024799;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color .15s linear, border-color .15s linear;
}
#header .control-menu .link-login > a:hover,
#header .control-menu .link-login > a:focus {
  border-color: #024799;
  background-color: #eaf1fb;
  color: #024799;
}

/* --------------------------------------------------------------------------
   8. Màn hình trung bình (769–991px): container chỉ còn ~720px nên thu gọn
   bớt để hàng nút không bị đẩy xuống dòng thứ hai.
   -------------------------------------------------------------------------- */
@media screen and (min-width: 769px) and (max-width: 991px) {
  #header .control-menu .i-hdr-btn,
  #header .control-menu .link-login > a {
    padding: 0 11px;
  }
  #header .control-menu .i-hdr-btn .i-hdr-btn-arrow {
    display: none;
  }
  #header .control-menu .user-info > .i-hdr-account {
    max-width: 150px;
  }
}

/* --------------------------------------------------------------------------
   9. Mobile (menu thu gọn)
   -------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
  #header .inet-navbar-header .control-menu ul.navbar-nav {
    gap: 6px;
    padding: 8px;
    border-radius: 0 0 10px 10px;
    background-color: #fff;
    box-shadow: 0 10px 24px rgba(15, 35, 60, 0.16);
  }
  #header .inet-navbar-header .control-menu ul.navbar-nav > li {
    width: 100%;
  }
  #header .control-menu .i-hdr-btn,
  #header .control-menu .link-login > a {
    display: flex;
    width: 100%;
    height: 38px;
    justify-content: flex-start;
  }
  #header .control-menu .i-hdr-btn .i-hdr-btn-arrow {
    margin-left: auto;
  }
  #header .notifications > .i-hdr-bell,
  #header .control-menu .user-info > .i-hdr-account {
    display: flex;
    width: 100%;
    max-width: none;
    height: 38px;
    justify-content: flex-start;
    padding: 0 12px;
    font-size: 13.5px;
  }
  #header .notifications > .i-hdr-bell > .i-hdr-bell-label {
    display: inline;
    margin-left: 10px;
    color: #3b4756;
    font-weight: 600;
  }
  #header .notifications > .i-hdr-bell > .notifications-length {
    position: static;
    margin-left: auto;
    border-color: transparent;
  }
  #header .control-menu .user-info > .i-hdr-account > .caret {
    margin-left: auto;
  }
}
