/**
 * BizFlow Theme — UI/UX Fixes
 * Giải quyết các vấn đề giao diện trên desktop
 * @date 2026-07-19
 */

/* ═══════════════════════════════════════════════════════════════════
   FIX #1: Menu điều hướng quá nhạt (màu chữ không rõ)
   GUTENBERG NAVIGATION FORCE DISPLAY + COLOR FIX
   ═══════════════════════════════════════════════════════════════════ */

/* Override Gutenberg hide responsive container on desktop */
.bizflow-header .wp-block-navigation__responsive-container {
  visibility: visible !important;
  opacity: 1 !important;
  display: flex !important;
  position: relative !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  z-index: 10 !important;
  background: transparent !important;
  color: #0A1628 !important;
  padding: 0 !important;
  gap: 2rem !important;
  flex-wrap: nowrap !important;
}

.bizflow-header .wp-block-navigation__responsive-wrapper {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: auto !important;
  height: auto !important;
}

.bizflow-header .wp-block-navigation {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: auto !important;
  height: auto !important;
  position: relative !important;
  overflow: visible !important;
  color: #0A1628 !important;
}

.bizflow-header .wp-block-navigation > ul,
.bizflow-header .wp-block-navigation ul {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 2rem !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  visibility: visible !important;
  height: auto !important;
  position: relative !important;
  overflow: visible !important;
  width: auto !important;
  color: #0A1628 !important;
}

.bizflow-header .wp-block-navigation li,
.bizflow-header .wp-block-navigation-item,
.bizflow-header .wp-block-navigation__container {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  position: relative !important;
  width: auto !important;
  overflow: visible !important;
  color: #0A1628 !important;
}

/* CRITICAL: Menu item links & labels - HIGH SPECIFICITY */
.bizflow-header .wp-block-navigation :where(a),
.bizflow-header .wp-block-navigation :where(a:focus),
.bizflow-header .wp-block-navigation :where(a:active),
.bizflow-header .wp-block-navigation a,
.bizflow-header .wp-block-navigation-item__content,
.bizflow-header .wp-block-navigation-item__label {
  color: #0A1628 !important;
  font-weight: 700 !important;
  font-size: 0.9375rem !important;
  text-decoration: none !important;
  display: block !important;
  padding: 0.5rem 0 !important;
  visibility: visible !important;
  opacity: 1 !important;
  line-height: 1.2 !important;
  overflow: visible !important;
  position: relative !important;
  height: auto !important;
  width: auto !important;
  margin: 0 !important;
  background-color: transparent !important;
}

/* Hover states */
.bizflow-header .wp-block-navigation :where(a:hover),
.bizflow-header .wp-block-navigation a:hover,
.bizflow-header .wp-block-navigation-item__content:hover,
.bizflow-header .wp-block-navigation-item__label:hover {
  color: #2563EB !important;
  background-color: transparent !important;
}

/* Remove any Gutenberg width/height tricks */
.bizflow-header .wp-block-navigation__submenu-container {
  visibility: visible !important;
  opacity: 1 !important;
  width: auto !important;
  height: auto !important;
  display: flex !important;
  overflow: visible !important;
  color: #0A1628 !important;
}

/* Classic nav support */
.bizflow-header .bf-nav a {
  color: #0A1628 !important;
  font-weight: 700 !important;
}

.bizflow-header .bf-nav a:hover {
  color: #2563EB !important;
}

/* Override any inherited colors from parent groups */
.bizflow-header .wp-block-group {
  color: #0A1628 !important;
}

.bizflow-header .wp-block-navigation,
.bizflow-header .wp-block-navigation *:not(.wp-block-button__link) {
  color: #0A1628 !important;
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #2: Nút CTA thứ 2 bị mất chữ (outline button)
   ═══════════════════════════════════════════════════════════════════ */
.wp-block-button.is-style-outline .wp-block-button__link,
.bf-btn-outline {
  background: transparent !important;
  color: var(--bf-white) !important;
  border: 2px solid var(--bf-white) !important;
  box-shadow: none;
  font-weight: 700 !important;
}

.wp-block-button.is-style-outline .wp-block-button__link:hover,
.bf-btn-outline:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: var(--bf-white) !important;
  transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #3: Heading bị đè/gạch ngang do lỗi spacing
   ═══════════════════════════════════════════════════════════════════ */
.wp-block-heading {
  margin-bottom: 1.5rem !important;
  line-height: 1.25 !important;
}

h2.wp-block-heading {
  margin-bottom: 1.75rem !important;
  padding-bottom: 0.5rem !important;
}

.wp-block-heading + p,
.wp-block-heading + .wp-block-paragraph {
  margin-top: 1rem !important;
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #4: Sao đánh giá bị lỗi icon font
   ═══════════════════════════════════════════════════════════════════ */
.bf-star,
.bf-testimonial-stars .bf-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--bf-gold, #F59E0B);
  line-height: 1;
  margin: 0;
  padding: 0;
}

.bf-star svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Fallback cho ký tự Unicode nếu icon font lỗi */
.bf-star::before {
  content: '★';
  font-family: 'Arial Unicode MS', 'Segoe UI Symbol', sans-serif;
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #5: Icon mạng xã hội ở footer bị vỡ
   ═══════════════════════════════════════════════════════════════════ */
.bf-social-icon,
.bf-footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  min-width: 40px;
  min-height: 40px;
  color: inherit;
}

.bf-social-icon svg,
.bf-footer-social a svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Hiển thị text fallback nếu icon không load */
.bf-social-icon::before {
  font-family: 'Arial Unicode MS', 'Segoe UI Symbol', sans-serif;
  font-size: 1.125rem;
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #6: Scroll indicator đè lên heading (z-index) + disappearing issue
   GUTENBERG SCROLL INDICATOR POSITIONING FIX
   ═══════════════════════════════════════════════════════════════════ */

/* CRITICAL: Keep scroll indicator ONLY in hero section, hide after scroll */
.bf-scroll-indicator {
  position: absolute !important;
  z-index: 1 !important;
  pointer-events: none;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
}

/* Hide scroll indicator when scrolled past hero section */
.bizflow-hero:not(:in-viewport) .bf-scroll-indicator,
body:not(.at-hero) .bf-scroll-indicator {
  display: none !important;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Ensure scroll indicator doesn't overflow parent or create stacking context */
.bizflow-hero {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

/* Card content should have higher z-index than scroll indicator */
.bf-card,
.bf-product-card,
.bf-team-card,
.bf-testimonial-card,
.bf-stat-item {
  position: relative;
  z-index: 2;
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #7: Card thống kê bị tràn/cắt viền phải
   ═══════════════════════════════════════════════════════════════════ */
.bf-stat-item {
  overflow: hidden;
  flex-basis: 100%;
  width: 100%;
}

.bf-stat-item::after {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.bf-stat-item:last-child::after {
  display: none;
}

/* Ensure grid doesn't overflow */
.wp-block-group.alignfull > .wp-block-group__inner-container,
.wp-block-group[class*="is-layout-grid"] {
  max-width: 100%;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #8: Badge "11+ Năm kinh nghiệm" bị tràn
   ═══════════════════════════════════════════════════════════════════ */
.bf-experience-badge {
  overflow: hidden;
  max-width: 160px;
  right: -0.5rem;
}

.bf-experience-badge .label {
  white-space: normal;
  font-size: 0.65rem;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #9: Nút CTA có viền cam lạ (focus state bị dính)
   ═══════════════════════════════════════════════════════════════════ */
.wp-block-button:not(.is-style-outline) .wp-block-button__link,
.bf-btn-primary {
  background: linear-gradient(135deg, #2563EB 0%, #0EA5E9 100%);
  color: var(--bf-white) !important;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
  border: none !important;
  outline: none !important;
}

.wp-block-button:not(.is-style-outline) .wp-block-button__link:focus,
.bf-btn-primary:focus {
  outline: none !important;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35) !important;
}

.wp-block-button:not(.is-style-outline) .wp-block-button__link:active,
.bf-btn-primary:active {
  outline: none !important;
  transform: translateY(-2px) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #10: Thẻ đội ngũ không đều hàng (text 2 dòng)
   ═══════════════════════════════════════════════════════════════════ */
.bf-team-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.bf-team-name {
  min-height: 2.5rem;
}

.bf-team-position {
  min-height: 2.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #11: Paragraph spacing & line-height fix
   ═══════════════════════════════════════════════════════════════════ */
.wp-block-paragraph {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.wp-block-group > p:first-child,
.wp-block-group > .wp-block-paragraph:first-child {
  margin-top: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #12: Nút mềm mại hơn, không có viền cứng
   ═══════════════════════════════════════════════════════════════════ */
.wp-block-button__link,
.bf-btn {
  border: none !important;
  outline: none !important;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wp-block-button__link:hover,
.bf-btn:hover {
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.35);
  transform: translateY(-3px);
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #13: Media queries cho responsive
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .bf-experience-badge {
    right: 0.5rem;
    bottom: 1.5rem;
  }
  
  .bf-stat-item {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 768px) {
  .bizflow-header .wp-block-navigation a,
  .bizflow-header .bf-nav a {
    font-weight: 600 !important;
  }
  
  h2.wp-block-heading {
    font-size: 1.75rem;
    margin-bottom: 1.5rem !important;
  }
  
  .bf-team-position {
    font-size: 0.8125rem;
  }
  
  .wp-block-heading + p,
  .wp-block-heading + .wp-block-paragraph {
    margin-top: 0.75rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   FIX #14: Scrollbar mất khi scroll qua section
   ENSURE VERTICAL SCROLLBAR ALWAYS VISIBLE
   ═══════════════════════════════════════════════════════════════════ */

/* Ensure scrollbar is always visible on vertical scroll */
html {
  overflow-y: scroll !important;
  scrollbar-gutter: stable !important;  /* Modern browsers */
}

body.bizflow-theme {
  overflow-x: hidden !important;
  overflow-y: auto !important;  /* Allow vertical scroll */
}

/* When mobile menu is open, prevent scrolling but keep scrollbar space */
body.bizflow-theme:has(.wp-block-navigation__responsive-container.is-menu-open) {
  overflow: hidden !important;
  height: 100vh !important;
}

/* Fallback for browsers that don't support :has() */
body.bizflow-menu-open {
  overflow: hidden !important;
  height: 100vh !important;
}
