/* =========================================================================
   Header V4 dung chung — render boi app\components\HeaderWidget, CSS nap qua
   HeaderV4Asset (widget tu dang ky) nen MOI layout dung widget deu co du style,
   khong phu thuoc layout do co nap v4-preview.css hay khong.

   2 bien the (theo 2 frame Figma):
     public  .hdr ...          cao 60 — trang chu, dang nhap, lien he, chinh sach,
                               ho tro, help center, download... (node 14996:76633,
                               da login: 14996:76755)
     app     header.fs ...     cao 64 — quan ly file, tai khoan, sub-account...
                               (node 15044:32199: logo | o tim kiem | chuong | avatar)
   ========================================================================= */

/* Token dung trong file nay — trung gia tri voi v4-preview.css, khai bao lai vi cac
   layout page.php/app.php khong nap v4-preview.css. */
:root {
  --ui-main-fsharestorage: #025afc;
  --text-primary: #333;
  --elev-btn:
    0 1px 5px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.14),
    0 3px 1px -2px rgba(0, 0, 0, 0.2);
}
.hdr,
.hdr * {
  box-sizing: border-box;
}
.hdr a {
  text-decoration: none;
}
.hdr img {
  display: block;
  max-width: 100%;
}

/* ============================ Bien the public ============================ */
/* ---------- Header 60px ---------- */
.hdr {
  height: 60px;
  background: #fff;
  filter: drop-shadow(2px 2px 2px rgba(189, 200, 223, 0.7));
  position: relative;
  z-index: 3;
}
.hdr__in {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.hdr__logo {
  width: 154px;
  height: 26px;
  flex: 0 0 auto;
}
.hdr__nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
.hdr__link {
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  padding: 10px;
  line-height: normal;
}
.hdr__link:hover {
  color: var(--ui-main-fsharestorage);
}
/* Muc BLOG: cau hinh code chen tu admin (SettingFrontend ads_gg.page_all.code_js) co rule
   a[href='https://blog.fshare.vn']{ display: none !important; } an moi link blog tren site. Header V4
   (Figma 14996:76633) co muc BLOG nen giu hien thi bang selector manh hon; man hinh <= 640px van an
   nhu cac link khac (rule .hdr__link o media query ben duoi). */
@media (min-width: 641px) {
  .hdr .hdr__nav a.hdr__link[href="https://blog.fshare.vn"] {
    display: inline !important;
  }
}

/* ---------- Header trạng thái ĐÃ ĐĂNG NHẬP (node 14996:76755) ----------
   Khác bản chưa login: thay nút ĐĂNG NHẬP bằng cụm chuông + avatar + tên + mũi tên.
   Trong Figma cụm nav dời từ left 941 sang left 868 vì cụm này rộng hơn — ở đây dùng
   flex space-between nên tự canh, không cần toạ độ tuyệt đối. */
.hdr__user {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 39px;
}
.hdr__bell {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}
.hdr__bell img {
  width: 24px;
  height: 24px;
}
/* Hộp avatar 40×40; glyph thật 33.33×33.33 đặt theo inset 8.33% đúng thiết kế.
   File container account_circle của Figma rỗng nên không dùng, chỉ dùng lớp glyph. */
.hdr__ava {
  width: 40px;
  height: 40px;
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
}
.hdr__ava img {
  position: absolute;
  left: 8.33%;
  right: 8.33%;
  top: 8.33%;
  bottom: 8.33%;
  width: auto;
  height: auto;
}
.hdr__name {
  font-size: 14px;
  line-height: 21px;
  color: var(--text-primary);
  white-space: nowrap;
}
.hdr__caret {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}
.hdr__caret img {
  width: 24px;
  height: 24px;
}

@media (max-width: 1100px) {
  .hdr__nav {
    gap: 8px;
  }
}
@media (max-width: 640px) {
  .hdr__link {
    display: none;
  }
}

/* ============================= Bien the app ==============================
   Markup header.fs (MDC toolbar) giu nguyen tu layouts/main.php vi JS/CSS quan ly file
   (tree.scss, main.js, NotifyWidget, AccouninfortWidget) bam vao cac class nay.
   Cac rule duoi day chuyen nguyen van tu v4-preview.css (vong doi chieu FM V4). */
/* --- Header trang 64px (Figma 15001:139207 "Frame 561": nen trang, vien duoi #D9DEE2
   ve TRONG khung 64 -> dung box-shadow inset de khong lam header cao thanh 65) --- */
.fs.mdc-toolbar {
  background: #fff !important;
  color: #333;
  box-shadow: inset 0 -1px 0 #d9dee2;
  border-bottom: 0;
}
.fs.mdc-toolbar .mdc-toolbar__row {
  height: 64px;
  min-height: 64px;
}
.fs .tree-menu {
  display: none;
} /* thiet ke khong co nut menu */
/* Logo 170x28 cach mep trai header 19, mep tren 16 (Figma 15001:139208 x=19 y=16 trong
   khung 64 - lech 2px len so voi canh giua, nen cong 4px phia duoi de khoi 32 canh giua) */
.logo-fshare--v4 {
  display: block;
  width: 170px;
  height: 28px;
  margin: 0 0 4px 19px;
}

/* o tim kiem header 285x36 (Figma 15001:139211): dung rule chung .mdc-textfield--fullwidth + --dense
   (button-v4.css: khung vien #D9DEE2, cao 36, icon 24 dau o, placeholder). O day chi con kich thuoc,
   vi tri va mau rieng cua header.
   Ghim o tim kiem 285px: o be rong 1366 o quang cao trong va khoi cuoi thanh header cung flex-grow:1 nen chia
   doi cho trong, khoi cuoi khong du cho o tim kiem + email dai -> cho khoi cuoi tu co theo noi dung, o quang cao
   nhuong. */
#search-widget {
  flex: 0 0 285px;
  width: 285px !important;
  margin-top: 0;
  padding-left: 15px; /* icon cach mep ngoai 16 (tru vien 1) */
  background: #fff;
}
#search-widget .mdc-textfield__input::placeholder {
  color: #6e7376;
  opacity: 1;
}
#search-widget .material-icons {
  color: #333;
}

.fs .mdc-toolbar__section--align-end {
  flex: 0 0 auto;
}

.fs .quang-cao-top-manager-file {
  min-width: 0;
}

/* Icon VipPoint canh chuong: thiet ke khong co -> AN bang CSS (tinh nang giu nguyen,
   mo lai bang cach xoa rule nay) [HIDDEN-fm-vippoint-bell] */
.button_login .bell_loyalty {
  display: none !important;
}

/* Chuong thong bao mau vang #FFA000 nhu thiet ke */
.total-notify .notification .material-icons {
  color: #ffa000 !important;
}

/* Avatar theo hang (VipPoint/GoldVip...) -> thiet ke dung account_circle xam.
   AN anh hang bang CSS (tinh nang + dropdown giu nguyen), the cho bang icon V4.
   [HIDDEN-fm-level-avatar] Mo lai: xoa 2 rule nay. */
.button_login .user__profile .image img {
  display: none !important;
}

.button_login .user__profile .image {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  background: url(../images/header-v4/ic-account-in.svg) center/40px no-repeat;
}

/* Cum ben phai: can giua doc cho deu nhu thiet ke */
.button_login .user__profile {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0; /* main.css: 0 20px */
}

.button_login .user__profile .toggle {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0; /* main.css: margin-left 20px */
  font-size: 14px;
  line-height: 21px;
  color: #333;
  font-weight: 400;
  white-space: nowrap;
}
/* Mui ten 24 #333 (Figma "Keyboard arrow down" = glyph expand_more); main.css de 16 #666 */
.button_login .user__profile .toggle .icon_profile {
  width: 24px;
  height: 24px;
  margin: 0;
  font-size: 24px;
  line-height: 24px;
  color: #333;
}

/* 3. O tim kiem - chuong - avatar: gap 24 giua cac cum, 16 trong cum (Figma Frame 1181:
   search 285 | 24 | bell | 16 | avatar | 16 | ten | caret). */
.fs .mdc-toolbar__section--align-end {
  display: flex !important;
  align-items: center;
  gap: 24px;
  /* Figma 15001:139209 "Frame 1181" x=859 w=494 trong khung 1366 -> mep phai 1353 */
  padding-right: 13px;
}

/* manager.scss dat align-start flex:none va dua vao banner quang cao ("quang-cao-top-
   manager-file", flex:1) o giua de day khoi avatar/chuong sang phai. Trang khong co
   banner (vd /site/notify, controller != file/follow) thi khoi avatar bi dinh sat khoi
   logo ben trai. Khi align-end nam NGAY SAU align-start (tuc khong co banner chen giua),
   margin-left:auto an het khoang trong -> day khoi ve mep phai. Cac trang co banner
   khong khop selector nay nen giu nguyen. */
.header_manager .mdc-toolbar__section--align-start + .mdc-toolbar__section--align-end {
  margin-left: auto;
}

.fs .mdc-toolbar__section--align-end #search-widget {
  margin: 0;
}

.button_login {
  display: flex;
  align-items: center;
  gap: 16px;
}

.button_login .total-notify {
  margin: 0;
  position: relative;
}

/* Chuong 24 #FFA000 (Figma 15001:139222) - NotifyWidget boc icon trong o 28 */
.button_login .total-notify .notification {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}
.button_login .total-notify .notification .material-icons {
  font-size: 24px;
  line-height: 24px;
}
