/* Shared UI Components Styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
  font-size: 14px;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gold);
  color: var(--primary-navy);
}

.btn-primary:hover {
  background: var(--accent-gold-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-navy {
  background: var(--primary-navy);
  color: #fff;
}

.btn-navy:hover {
  background: var(--primary-slate);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-navy);
  color: var(--primary-navy);
}

.btn-outline:hover {
  background: var(--primary-navy);
  color: #fff;
}

/* Light / Transparent Outline Button for Dark Banners */
.btn-outline-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff !important;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer !important;
  text-decoration: none;
  pointer-events: auto !important;
  opacity: 1 !important;
  transition: all 0.3s ease;
  user-select: none;
}

.btn-outline-white i,
.btn-outline-white svg {
  color: #ffffff !important;
  font-size: 15px;
  transition: color 0.3s ease;
}

.btn-outline-white:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--accent-gold, #F59E0B);
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.btn-outline-white:hover i,
.btn-outline-white:hover svg {
  color: var(--accent-gold, #F59E0B) !important;
}

.btn-outline-white:active {
  transform: translateY(0);
}


.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--primary-navy);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

.alert {
  padding: 14px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.alert-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.page-banner {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(30, 41, 59, 0.78)), url('../../images/home-hero.png') center/cover no-repeat;
  padding: 70px 0;
  color: #fff;
  text-align: center;
}

.page-banner h1 {
  color: #fff;
  font-size: 38px;
  margin-bottom: 12px;
}

.breadcrumb {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-light);
}

.breadcrumb a {
  color: var(--accent-gold);
}

/* Section Title Component */
.section-title {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 50px;
}

.section-title span {
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: block;
  margin-bottom: 8px;
}

.section-title h2 {
  font-size: 32px;
  margin-bottom: 14px;
}

.section-title p {
  color: var(--text-muted);
}

/* Badge Component */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.badge-category {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
}

/* Form Grid 2 Columns */
.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .form-grid-2col {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

/* Table Responsive Container */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
}

/* Responsive Components Pass */
@media (max-width: 767px) {
  .page-banner {
    padding: 46px 0;
  }
  .page-banner h1 {
    font-size: 26px;
    line-height: 1.3;
  }
  .section-title {
    margin-bottom: 32px;
  }
  .section-title h2 {
    font-size: 24px;
    line-height: 1.3;
  }
  .btn {
    min-height: 44px;
  }
  .form-control {
    min-height: 44px;
    font-size: 15px;
  }
}

/* Accessibility & SEO utility for screen readers and search bots */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}


/* ==========================================================================
   Floating Action Buttons (FAB Contact Cluster) - PNMEC
   ========================================================================== */
.fab-contact-group {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  pointer-events: auto;
}

.fab-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  color: #ffffff;
  text-decoration: none;
  border: none;
  outline: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.fab-btn:hover {
  transform: scale(1.08);
}

.fab-btn:active {
  transform: scale(0.95);
}

/* Zalo Button */
.fab-btn--zalo {
  background-color: #0068FF;
  box-shadow: 0 4px 15px rgba(0, 104, 255, 0.45);
}

.fab-btn--zalo:hover {
  background-color: #0053cc;
  box-shadow: 0 6px 20px rgba(0, 104, 255, 0.65);
}

/* Phone / SIM Call Button */
.fab-btn--phone {
  background-color: #25D366;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.45);
}

.fab-btn--phone:hover {
  background-color: #1eb956;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.65);
}

/* Sóng lan tỏa (Pulse / Ripple wave) */
.fab-btn::before,
.fab-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-color: inherit;
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

.fab-btn::before {
  animation: fab-ripple-wave 2.4s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

.fab-btn::after {
  animation: fab-ripple-wave 2.4s cubic-bezier(0.24, 0, 0.38, 1) infinite 0.8s;
}

@keyframes fab-ripple-wave {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.25;
  }
  100% {
    transform: scale(1.68);
    opacity: 0;
  }
}

/* Subtle icon animations */
.fab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.fab-btn--phone .fab-icon svg {
  animation: fab-phone-wiggle 3s ease-in-out infinite;
  transform-origin: center center;
}

@keyframes fab-phone-wiggle {
  0%, 100% {
    transform: rotate(0deg);
  }
  10%, 30% {
    transform: rotate(-14deg);
  }
  20%, 40% {
    transform: rotate(14deg);
  }
  50% {
    transform: rotate(-8deg);
  }
  60% {
    transform: rotate(8deg);
  }
  70% {
    transform: rotate(0deg);
  }
}

.fab-btn--zalo .fab-icon svg {
  animation: fab-zalo-bounce 3s ease-in-out infinite 0.5s;
}

@keyframes fab-zalo-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-2px);
  }
  50% {
    transform: translateY(1px);
  }
  70% {
    transform: translateY(0);
  }
}

/* Tooltip on Hover (Desktop) */
.fab-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.fab-tooltip::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent transparent rgba(15, 23, 42, 0.92);
}

.fab-btn:hover .fab-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .fab-contact-group {
    bottom: 18px;
    right: 18px;
    gap: 12px;
  }

  .fab-btn {
    width: 44px;
    height: 44px;
  }

  .fab-btn--zalo svg {
    width: 22px;
    height: 22px;
  }

  .fab-btn--phone svg {
    width: 19px;
    height: 19px;
  }

  .fab-tooltip {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fab-btn::before,
  .fab-btn::after,
  .fab-btn--phone .fab-icon svg,
  .fab-btn--zalo .fab-icon svg {
    animation: none !important;
  }
}




/* ==========================================================================
   Page Transition & Modern Slide-Up Navigation System
   (Fade-In + Slide-Up, Staggered Layers & Scroll Reveal)
   ========================================================================== */

/* 1. Kích hoạt Cross-Document View Transitions tự động trên trình duyệt hỗ trợ */
@view-transition {
  navigation: auto;
}

/* 2. Keyframes hiệu ứng Fade-In & Slide-Up */
@keyframes pageFadeSlideUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 40px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Keyframes phụ cho lớp nội dung kế tiếp (Sub-hero nhịp 2) */
@keyframes subHeroSlideUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Keyframes Fade Out khi chuyển trang */
@keyframes pageFadeOut {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, -16px, 0);
  }
}

/* Alias tương thích ngược */
@keyframes pageFadeIn {
  0% {
    opacity: 0;
    transform: translate3d(0, 40px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* 3. Phần tử nội dung chính của toàn bộ các trang: Áp dụng Animation pageFadeSlideUp */
#main-content,
.page-content,
.page-fade-slide-up,
.page-fade-in {
  display: block;
  position: relative;
  width: 100%;
  min-height: calc(100vh - 350px);
  outline: none;
  animation: pageFadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, transform;
}

/* 4. Hiệu ứng trượt nối tiếp theo lớp (Staggered Slide-Up):
   - Phần Banner / Tiêu đề chính (Hero section): Trượt lên ngay lập tức (delay: 0s)
   - Phần nội dung kế tiếp ngay bên dưới: Trượt lên trễ hơn 1 nhịp (delay: 0.12s, 30px -> 0)
*/
#main-content > :first-child,
.page-banner,
.h-hero-banner,
.ab-hero,
.srv-hero,
.proj-hero {
  animation: pageFadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0s both;
  will-change: opacity, transform;
}

#main-content > :nth-child(2),
.page-sub-hero {
  animation: subHeroSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
  will-change: opacity, transform;
}

/* 5. Cấu hình View Transitions API:
   - root & main-content sử dụng animation trượt từ dưới lên
   - Header, Topbar và Floating Buttons tách riêng, đứng yên tuyệt đối không bị gián đoạn
*/
.topbar {
  view-transition-name: site-topbar;
}

.main-header {
  view-transition-name: site-header;
}

.mobile-drawer,
.mobile-drawer-backdrop {
  view-transition-name: none;
}

.fab-contact-group {
  view-transition-name: site-fab-group;
}

#main-content {
  view-transition-name: main-content;
}

/* Giữ Header và cụm nút nổi đứng yên 100%, không bị chớp nháy hay trượt */
::view-transition-group(site-topbar),
::view-transition-group(site-header),
::view-transition-group(site-fab-group) {
  animation-duration: 0s !important;
}

/* Chuyển cảnh View Transitions: old fade out, new slide up */
::view-transition-old(root),
::view-transition-old(main-content) {
  animation: 0.18s cubic-bezier(0.4, 0, 1, 1) both pageFadeOut;
}

::view-transition-new(root),
::view-transition-new(main-content) {
  animation: 0.6s cubic-bezier(0.16, 1, 0.3, 1) both pageFadeSlideUp;
}

/* 6. Hiệu ứng cuộn trang mượt mà (Scroll Reveal với IntersectionObserver):
   Cho các section và card bên dưới màn hình đầu tiên trượt từ dưới lên (32px -> 0)
*/
.scroll-reveal {
  opacity: 0;
  transform: translate3d(0, 32px, 0);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.scroll-reveal.is-visible {
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) !important;
}

/* Delay phân tầng cho các card trong cùng hàng */
.scroll-reveal-delay-1 { transition-delay: 0.08s; }
.scroll-reveal-delay-2 { transition-delay: 0.16s; }
.scroll-reveal-delay-3 { transition-delay: 0.24s; }
.scroll-reveal-delay-4 { transition-delay: 0.32s; }

/* 7. Tối ưu Accessibility: Tôn trọng cài đặt giảm chuyển động của hệ điều hành */
@media (prefers-reduced-motion: reduce) {
  #main-content,
  .page-content,
  .page-fade-slide-up,
  .page-fade-in,
  #main-content > :first-child,
  #main-content > :nth-child(2),
  .scroll-reveal {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    will-change: auto !important;
    transition: none !important;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ==========================================================================
   Responsive PC / Mobile Content Switcher for Rich Detail Articles
   ========================================================================== */
.content-pc-view { display: block; }
.content-mobile-view { display: none; }

@media (max-width: 768px) {
  .content-pc-view { display: none !important; }
  .content-mobile-view { display: block !important; }
}

@media (min-width: 769px) {
  .content-pc-view { display: block !important; }
  .content-mobile-view { display: none !important; }
}

/* Rich Content Formatting */
.rich-detail-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px auto;
  display: block;
}
.rich-detail-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
}
.rich-detail-content th,
.rich-detail-content td {
  border: 1px solid #cbd5e1;
  padding: 10px 14px;
  text-align: left;
}
.rich-detail-content th {
  background: #f1f5f9;
  font-weight: 700;
}
.rich-detail-content p {
  line-height: 1.85;
  margin-bottom: 16px;
  color: #334155;
  font-size: 15.5px;
}

.rich-detail-content p.service-detail-summary,
.rich-detail-content .service-detail-summary,
.rich-detail-content .project-detail-summary,
.rich-detail-content .news-detail-lead,
.service-detail-summary {
  font-size: 16px !important;
  font-weight: 600 !important;
  color: #ea580c !important; /* Rich vibrant orange */
  margin-bottom: 24px !important;
  line-height: 1.6 !important;
  font-family: 'Montserrat', sans-serif !important;
}
.rich-detail-content h1,
.rich-detail-content h2,
.rich-detail-content h3,
.rich-detail-content h4 {
  color: var(--primary-navy, #0f172a);
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
}
.rich-detail-content a {
  color: var(--accent-gold, #f59e0b);
  text-decoration: underline;
}


/* ── Universal Clickable Card (Stretched Link) ── */
.stretched-link::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  content: "";
  cursor: pointer;
}

.srv-card,
.news-card,
.proj-card,
.h-proj__card {
  position: relative;
  cursor: pointer;
}

/* Decorative overlays, badges and span buttons pass clicks to stretched-link */
.srv-card__overlay,
.srv-card__overlay-btn,
.srv-card__badge-code,
.srv-card__action-btn,
.srv-card__proj-btn:not(a),
.proj-card__thumb-overlay,
.proj-card__quick-view,
.proj-card__badge,
.proj-card__group-tag,
.proj-card__more-btn,
.proj-card__meta-list,
.proj-card__meta-item,
.proj-card__desc,
.news-card__badge-code {
  pointer-events: none;
}

/* Secondary independent actionable links (Báo giá, Quote) remain clickable */
.srv-card a:not(.stretched-link),
.proj-card a:not(.stretched-link),
.news-card a:not(.stretched-link),
.srv-card__proj-btn[href],
.proj-card__quote-btn[href] {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}
