/* =======================================================
   CLOUDX FLIC UI - HEADER v1.2.2
   Mục tiêu: header 2 tầng giống mẫu FLIC/CSC, không sửa logic WooCommerce
======================================================= */

/* Ẩn header Astra gốc khi plugin hoạt động */
.cloudx-flic-ui-active .site-header:not(.cflic-header),
.cloudx-flic-ui-active #masthead:not(.cflic-header),
.cloudx-flic-ui-active .ast-mobile-header-wrap {
  display: none !important;
}

.cflic-header {
  position: relative;
  z-index: 9999;
  background: var(--cflic-white);
  font-family: inherit;
}

/* ================= TOPBAR ================= */
.cflic-topbar {
  background: #fff;
  border-bottom: 1px solid #edf2f7;
}

.cflic-topbar-inner {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.cflic-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none !important;
  flex: 0 0 auto;
}

.cflic-brand img,
.cflic-brand .custom-logo {
  max-height: 68px;
  width: auto;
  display: block;
}

.cflic-brand-text {
  font-size: 36px;
  font-weight: 900;
  color: var(--cflic-blue-2);
  letter-spacing: .5px;
}

/* Search nằm ở hàng trên, thay cho các link phụ cũ */
.cflic-top-search-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  flex: 0 1 430px;
}

.cflic-search-top {
  width: min(420px, 100%);
  height: 42px;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #dbe7f3;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(15, 23, 42, .05);
}

.cflic-search-top input {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0 !important;
  outline: none !important;
  padding: 0 16px !important;
  font-size: 14px;
  color: var(--cflic-text);
  background: transparent !important;
}

.cflic-search-top button {
  flex: 0 0 52px;
  width: 52px;
  height: 100%;
  border: 0 !important;
  border-left: 1px solid #edf2f7 !important;
  background: #fff !important;
  color: #003b82;
  font-size: 22px;
  cursor: pointer;
}

.cflic-search-top button:hover {
  color: var(--cflic-blue-2);
  background: #f3f8ff !important;
}

/* ================= NAVBAR ================= */
.cflic-navbar {
  background: #003b82;
  box-shadow: 0 8px 18px rgba(0, 59, 130, .16);
}

.cflic-navbar-inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 0;
}

.cflic-home {
  width: 58px;
  min-width: 58px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.12);
  color: #fff !important;
  font-size: 23px;
  line-height: 1;
  text-decoration: none !important;
  margin-right: 8px;
}

.cflic-home:hover {
  background: rgba(255,255,255,.2);
}

.cflic-navigation {
  flex: 1 1 auto;
  min-width: 0;
}

.cflic-nav-menu,
.cflic-nav-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cflic-nav-menu {
  display: flex;
  align-items: center;
  gap: 0;
}

.cflic-nav-menu > li {
  position: relative;
}

.cflic-nav-menu > li > a,
.cflic-nav-menu > li > .menu-link {
  min-height: 56px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: #fff !important;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none !important;
  white-space: nowrap;
  letter-spacing: .05px;
}

.cflic-nav-menu > li:hover > a,
.cflic-nav-menu > li.current-menu-item > a,
.cflic-nav-menu > li.current-menu-ancestor > a {
  background: rgba(255,255,255,.12);
}

.cflic-nav-menu .sub-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 230px;
  background: #fff;
  border: 1px solid var(--cflic-border);
  box-shadow: var(--cflic-shadow);
  z-index: 99999;
}

.cflic-nav-menu li:hover > .sub-menu {
  display: block;
}

.cflic-nav-menu .sub-menu a {
  display: block;
  padding: 12px 16px;
  color: var(--cflic-text) !important;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 700;
  border-bottom: 1px solid #eef2f7;
}

.cflic-nav-menu .sub-menu a:hover {
  background: #f0f7ff;
  color: var(--cflic-blue-2) !important;
}

/* ================= ACTIONS ================= */
.cflic-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: auto;
}

.cflic-cart {
  position: relative;
  color: #fff !important;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  font-size: 19px;
  border-radius: 8px;
}

.cflic-cart:hover {
  background: rgba(255,255,255,.12);
}

.cflic-cart-count {
  position: absolute;
  top: 1px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--cflic-red);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Search chính đã chuyển lên topbar, navbar chỉ giữ cart bên phải */

.cflic-mobile-toggle,
.cflic-mobile-panel {
  display: none;
}

/* Guard: không hiển thị top links cũ nếu trình duyệt còn cache markup cũ */
.cflic-top-links {
  display: none !important;
}

/* Giữ navbar 1 hàng, không cho Tin tức/Liên hệ rơi xuống dòng */
.cflic-navbar-inner {
  flex-wrap: nowrap !important;
}

.cflic-navigation,
.cflic-nav-menu {
  min-width: 0 !important;
}

.cflic-nav-menu {
  flex-wrap: nowrap !important;
}

.cflic-nav-menu > li > a,
.cflic-nav-menu > li > .menu-link {
  white-space: nowrap !important;
}


/* Account button ở thanh menu xanh */
.cflic-account {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border-radius: 8px;
  color: #fff !important;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none !important;
  white-space: nowrap;
}

.cflic-account:hover {
  background: rgba(255,255,255,.12);
  color: #fff !important;
}

.cflic-account-icon {
  font-size: 15px;
  line-height: 1;
}

/* Căn giữa icon tìm kiếm */
.cflic-search-top button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  padding: 0 !important;
}

.cflic-search-top button svg {
  width: 17px;
  height: 17px;
  display: block;
}

@media (max-width: 1100px) {
  .cflic-account-text {
    display: none;
  }

  .cflic-account {
    width: 42px;
    padding: 0;
  }
}

/* =======================================================
   v1.4.0 Typography refinement
   Chữ menu/search nhẹ hơn, giống các website khóa học hiện đại
======================================================= */
.cflic-header {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--cflic-text);
}

.cflic-container {
  max-width: 1280px;
}

.cflic-nav-menu > li > a,
.cflic-nav-menu > li > .menu-link {
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0;
}

.cflic-nav-menu .sub-menu a {
  font-weight: 500;
}

.cflic-account,
.cflic-cart,
.cflic-search-top input {
  font-weight: 400;
}

.cflic-account-text {
  font-weight: 500;
}

.cflic-search-top input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.cflic-search-top button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
}
.cflic-search-top button svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* =======================================================
   v1.5.0 Account dropdown routing
   - Chưa đăng nhập: /dang-nhap/
   - Đã đăng nhập: WooCommerce My account endpoints
======================================================= */
.cflic-home svg {
  width: 19px;
  height: 19px;
  display: block;
}

.cflic-account-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.cflic-account-wrap .cflic-account {
  position: relative;
  z-index: 2;
}

.cflic-account-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cflic-account-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.cflic-account-caret {
  font-size: 11px;
  opacity: .75;
  margin-left: 2px;
  transform: translateY(-1px);
}

.cflic-account-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 235px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #dbeafe;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
  z-index: 99999;
}

.cflic-account-dropdown::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 26px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-left: 1px solid #dbeafe;
  border-top: 1px solid #dbeafe;
  transform: rotate(45deg);
}

.cflic-account-wrap:hover .cflic-account-dropdown,
.cflic-account-wrap:focus-within .cflic-account-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cflic-account-dropdown a {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 9px;
  color: #172033 !important;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.cflic-account-dropdown a:hover {
  background: #eef7ff;
  color: #0678b5 !important;
}

.cflic-account-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid #edf4f9;
  color: #475569;
  font-size: 13px;
  line-height: 1.35;
}

.cflic-account-user strong {
  display: block;
  color: #172033;
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

.cflic-account-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8f7ff;
  color: #0678b5;
  font-weight: 700;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.cflic-account-logout {
  margin-top: 6px;
  color: #b42318 !important;
  background: #fff5f5;
}

.cflic-account-logout:hover {
  background: #fee2e2 !important;
  color: #991b1b !important;
}

@media (max-width: 1100px) {
  .cflic-account-caret { display: none; }
}

/* =======================================================
   v1.5.1 Account dropdown follows My account menu
======================================================= */
.cflic-account-dropdown {
  width: 255px;
}

.cflic-account-dropdown .cflic-account-admin {
  background: #eef7ff;
  color: #0678b5 !important;
  font-weight: 600;
  margin-bottom: 6px;
}

.cflic-account-dropdown .cflic-account-admin:hover {
  background: #dff1ff;
}

.cflic-account-dropdown .cflic-account-menu-customer-logout,
.cflic-account-dropdown .cflic-account-logout {
  margin-top: 6px;
  color: #b42318 !important;
  background: #fff5f5;
}

.cflic-account-dropdown .cflic-account-menu-customer-logout:hover,
.cflic-account-dropdown .cflic-account-logout:hover {
  background: #fee2e2 !important;
  color: #991b1b !important;
}


/* v1.6.3 - Account simple button: bỏ dropdown/caret trên header */
.cflic-account-wrap-simple .cflic-account-caret,
.cflic-account-wrap-simple .cflic-account-dropdown {
  display: none !important;
}
.cflic-account-wrap-simple .cflic-account {
  gap: 8px;
  padding-left: 14px;
  padding-right: 14px;
}
.cflic-account-wrap-simple .cflic-account-text {
  font-weight: 600;
}


/* v1.6.4 - Account đúng luồng: guest không icon, member có icon */
.cflic-account-guest .cflic-account {
  padding-left: 16px;
  padding-right: 16px;
}
.cflic-account-guest .cflic-account-text {
  display: inline !important;
  font-weight: 600;
}
.cflic-account-member .cflic-account-icon {
  display: inline-flex;
}
@media (max-width: 1100px) {
  .cflic-account-guest .cflic-account {
    width: auto;
    min-width: 0;
    padding-left: 12px;
    padding-right: 12px;
  }
  .cflic-account-guest .cflic-account-text {
    display: inline !important;
    font-size: 13px;
  }
}
