/*
Theme Name: Khang Minh Logistics Theme
Theme URI: https://khangminhlogistics.vn/
Description: Theme tùy chỉnh cho Khang Minh Logistics.
Version: 10.2 (Sticky Header Fix)
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: khangminh
*/

/* === START: GLOBAL TYPOGRAPHY === */
html,
body {
  font-size: 16px;
  line-height: 1.4;
}
body,
input,
textarea,
select,
button {
  font-family: "Google Sans Flex", sans-serif;
}
/* === END: GLOBAL TYPOGRAPHY === */

/* === START: HEADER STYLING === */
#header {
  /* Trạng thái mặc định: có nền gradient */
  background-color: #a8d5e5;
  background-image: linear-gradient(to bottom, #a8d5e5 0%, #ffffff 100%);
  height: 6rem;
  transition:
    background-color 0.4s ease,
    background-image 0.4s ease; /* Thêm hiệu ứng chuyển đổi mượt mà */
}

.custom-logo {
  max-width: 180px;
}

#mobile-menu-button svg {
  stroke: #374151;
}
/* === END: HEADER STYLING === */

/* === START: HIỆU ỨNG MENU CHÍNH & ICON (DESKTOP) === */
nav.desktop-menu ul > li.menu-item > a {
  display: flex !important;
  align-items: center !important;
  position: relative !important;
  transition:
    color 0.2s ease-in-out,
    background-color 0.2s ease-in-out,
    text-shadow 0.4s ease !important;
  padding: 8px 16px !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  font-size: 1rem !important;
  color: #374151 !important;
  background-color: transparent !important;
}

/* Thêm bóng mờ cho chữ khi header trong suốt để dễ đọc */
#header.header-transparent nav.desktop-menu ul > li.menu-item > a {
  text-shadow:
    0 0 5px #ffffff,
    0 0 8px #ffffff;
}

/* Icon trong menu desktop */
nav.desktop-menu ul > li.menu-item > a .menu-icon {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  opacity: 0.7;
  transition:
    opacity 0.2s ease-in-out,
    filter 0.4s ease;
  stroke: #374151;
}

/* Thêm bóng mờ cho icon khi header trong suốt */
#header.header-transparent nav.desktop-menu ul > li.menu-item > a .menu-icon {
  filter: drop-shadow(0 0 3px #ffffff);
}

/* Hiệu ứng khi trỏ chuột vào (desktop) */
nav.desktop-menu ul > li.menu-item > a:hover {
  background-color: #fce7f3 !important;
  color: #dc2626 !important;
}
nav.desktop-menu ul > li.menu-item > a:hover .menu-icon {
  opacity: 1;
}

/* Kiểu cho mục menu đang được chọn (desktop) */
nav.desktop-menu ul > li.current-menu-item > a,
nav.desktop-menu ul > li.current-page-ancestor > a,
nav.desktop-menu ul > li.current-page-parent > a {
  background-color: #fef9c3 !important;
  color: #f97316 !important;
}
nav.desktop-menu ul > li.current-menu-item > a .menu-icon,
nav.desktop-menu ul > li.current-page-ancestor > a .menu-icon {
  opacity: 1;
}

/* Dropdown menu (desktop) */
.desktop-menu .menu-item-has-children {
  position: relative;
}
.desktop-menu .sub-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  background-color: white;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  z-index: 100;
  min-width: 240px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  padding-top: 8px;
  padding-bottom: 8px;
}
.desktop-menu .menu-item-has-children:hover .sub-menu {
  display: block;
}

.desktop-menu .sub-menu a {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  transition:
    background-color 0.2s ease-in-out,
    color 0.2s ease-in-out;
  color: #374151;
  white-space: nowrap;
}
.desktop-menu .sub-menu a:hover {
  background-color: #eff6ff;
  color: #1d4ed8;
}
/* === END: HIỆU ỨNG MENU CHÍNH & ICON (DESKTOP) === */

/* === START: MOBILE MENU STYLING === */
#mobile-menu .menu-item a {
  display: flex !important;
  align-items: center !important;
  padding: 12px 16px !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
  transition:
    background-color 0.2s ease-in-out,
    color 0.2s ease-in-out !important;
}

/* Icon trên mobile */
#mobile-menu .menu-icon {
  display: inline-block !important;
  width: 18px;
  height: 18px;
  margin-right: 12px;
}

/* Hiệu ứng khi chạm/trỏ chuột vào trên mobile */
#mobile-menu .menu-item a:hover {
  background-color: #fce7f3 !important;
  color: #dc2626 !important;
}

/* Kiểu cho mục menu đang được chọn (active) trên mobile */
#mobile-menu .current-menu-item > a,
#mobile-menu .current-page-ancestor > a,
#mobile-menu .current-page-parent > a {
  background-color: #fef9c3 !important;
  color: #f97316 !important;
}

/* Dropdown menu trên mobile */
#mobile-menu .sub-menu {
  display: none;
  padding-left: 1rem;
  background-color: #f8f9fa;
  border-left: 2px solid #e5e7eb;
  margin-left: 10px;
  padding-top: 5px;
  padding-bottom: 5px;
}
#mobile-menu .menu-item-has-children > a {
  padding-right: 2.5rem !important;
}
/* === END: MOBILE MENU STYLING === */

/* === START: CONTACT PAGE FORM STYLING === */
.contact-form-wrapper .wpcf7-form-control {
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 12px 16px;
  border-radius: 8px;
  width: 100%;
  transition:
    border-color 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out;
  box-shadow: inset 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.contact-form-wrapper .wpcf7-form-control:focus {
  border-color: #f97316;
  outline: none;
  box-shadow: 0 0 0 3px rgb(249 115 22 / 0.2);
}
.contact-form-wrapper .wpcf7-submit {
  background-color: #facc15 !important;
  color: #424242 !important;
  font-weight: bold !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease-in-out !important;
  border: none !important;
  padding: 12px 16px !important;
  border-radius: 8px !important;
  width: 100% !important;
}
.contact-form-wrapper .wpcf7-submit:hover {
  background-color: #eab308 !important;
}
.contact-form-wrapper .wpcf7-submit:active {
  background-color: #f97316 !important;
}
/* === END: CONTACT PAGE FORM STYLING === */

/* === START: FOOTER STYLING (Updated for Light Blue Theme) === */
#footer {
  background-color: #e0f2fe;
  color: #374151;
}
.footer-slogan {
  font-size: 1rem;
  font-weight: 700;
  color: #ca8a04; /* Đổi màu slogan thành vàng (yellow-600) */
  margin-top: 1rem;
  font-style: normal;
  text-shadow: none;
}
#footer-contact-info h3 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: #111827;
}
#footer-contact-info ul li span {
  font-weight: 600;
  color: #374151;
  font-size: 1rem;
}
#footer .border-t {
  border-color: #9ca3af;
}
#footer .copyright-text {
  color: #4b5563;
}
/* === END: FOOTER STYLING === */

/* === START: RESPONSIVE CONTENT FIXES === */
.prose {
  max-width: 100%;
  overflow-x: hidden;
}
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  width: 100%;
}
.prose thead,
.prose tbody,
.prose tr {
  width: 100%;
}
.prose iframe {
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 8px;
}
.prose pre {
  white-space: pre-wrap;
  word-wrap: break-word;
}
/* === END: RESPONSIVE CONTENT FIXES === */

/* === START: GLOBAL RESPONSIVE IMAGE FIX (IMPROVED) === */
main img,
main .wp-block-image img {
  max-width: 100%;
  height: auto;
  display: block;
}
main .wp-block-image {
  max-width: 100% !important;
}
main .alignwide,
main .alignfull {
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 100% !important;
  width: 100% !important;
}
/* === END: GLOBAL RESPONSIVE IMAGE FIX (IMPROVED) === */

/* === START: SNOW EFFECT STYLING === */
#snow-canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
/* === END: SNOW EFFECT STYLING === */

/* === START: CUSTOM LAYOUT ADJUSTMENTS (Restored) === */
/* Quy tắc riêng: Trang chi tiết bài viết (single.php) có chiều rộng hẹp hơn để dễ đọc */
@media (min-width: 1024px) {
  body.single-post main .container {
    max-width: 1024px !important; /* Chiều rộng tối đa cho bài viết */
  }
}
/* === END: CUSTOM LAYOUT ADJUSTMENTS (Restored) === */

/* === START: SCROLL TO TOP BUTTON === */
#scroll-to-top {
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0.3s;
}

#scroll-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
/* === END: SCROLL TO TOP BUTTON === */

/* === START: CTA BUTTON IN MENU === */
/* Biến mục menu có lớp .nut-bao-gia thành một cái nút */
li.nut-bao-gia {
  margin-left: 1.5rem; /* Tạo khoảng cách với các mục menu khác */
}

li.nut-bao-gia a {
  background-color: #f97316 !important; /* Màu cam */
  color: #ffffff !important;
  font-weight: 600 !important;
  padding: 8px 24px !important;
  border-radius: 6px !important;
  box-shadow:
    0 1px 3px 0 rgb(0 0 0 / 0.1),
    0 1px 2px -1px rgb(0 0 0 / 0.1);
}

/* Hiệu ứng khi trỏ chuột vào nút */
li.nut-bao-gia a:hover {
  background-color: #ea580c !important; /* Màu cam đậm hơn */
  color: #ffffff !important;
}
/* === END: CTA BUTTON IN MENU === */

/* === START: HOMEPAGE NEWS SLIDER === */
.news-slider {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.news-slider-viewport {
  overflow: hidden;
  width: 100%;
  padding-bottom: 20px;
}

.news-slider-track {
  display: flex;
  gap: 1rem;
  transition: transform 0.4s ease;
  will-change: transform;
}

.news-slide {
  padding: 0;
}

.news-card-thumb {
  height: 220px;
  overflow: hidden;
}

.news-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.news-slide:hover .news-card-thumb img {
  transform: scale(1.05);
}

.news-card-title,
.news-card-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-title {
  -webkit-line-clamp: 2;
}

.news-card-excerpt {
  -webkit-line-clamp: 3;
}

.news-slider-btn {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid #dbeafe;
  color: #1e40af;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.news-slider-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #eff6ff;
}

.news-slider-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 767px) {
  .news-slider {
    gap: 0.5rem;
  }

  .news-slider-track {
    gap: 0.75rem;
  }

  .news-card-thumb {
    height: 200px;
  }

  .news-slider-btn {
    width: 2.25rem;
    height: 2.25rem;
  }
}
/* === END: HOMEPAGE NEWS SLIDER === */

/* === START: HOMEPAGE INTRO + CONTACT === */
.home-intro-content p,
.home-contact-content p {
  margin-bottom: 1rem;
}

.home-intro-content p:last-child,
.home-contact-content p:last-child {
  margin-bottom: 0;
}

#home-contact-form input,
#home-contact-form textarea {
  background-color: #ffffff;
}

/* === START: SERVICE CARD IMAGE === */
.service-card-thumb {
  position: relative;
  width: 100%;
  padding-top: 65%;
  overflow: hidden;
  background-color: #e2e8f0;
}

.service-card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.service-card-thumb-placeholder {
  position: absolute;
  inset: 0;
  background-color: #dbeafe;
}

.bg-white.rounded-xl.shadow-lg.overflow-hidden:hover .service-card-thumb img {
  transform: scale(1.04);
}
/* === END: SERVICE CARD IMAGE === */

/* === START: WHY CHOOSE US ITEMS === */
.why-choose-item {
  width: 100%;
}

@media (min-width: 640px) {
  .why-choose-cols-2 .why-choose-item {
    width: calc(50% - 1rem);
  }
  .why-choose-cols-3 .why-choose-item {
    width: calc(50% - 1rem);
  }
  .why-choose-cols-4 .why-choose-item {
    width: calc(50% - 1rem);
  }
}

@media (min-width: 1024px) {
  .why-choose-cols-2 .why-choose-item {
    width: calc(50% - 1rem);
  }
  .why-choose-cols-3 .why-choose-item {
    width: calc(33.333% - 1.334rem);
  }
  .why-choose-cols-4 .why-choose-item {
    width: calc(25% - 1.5rem);
  }
}
/* === END: WHY CHOOSE US ITEMS === */

/* === START: CONTACT INFO ITEMS === */
.home-contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.home-contact-info-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  background-color: #f0f9ff;
  border: 1px solid #bae6fd;
  text-decoration: none;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.home-contact-info-item:hover {
  background-color: #e0f2fe;
  border-color: #7dd3fc;
}

.home-contact-info-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background-color: #0ea5e9;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.home-contact-info-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.home-contact-info-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.home-contact-info-value {
  font-size: 0.975rem;
  font-weight: 700;
  color: #0c4a6e;
}
/* === END: CONTACT INFO ITEMS === */

.home-toast-container {
  position: fixed;
  right: 1rem;
  top: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 360px;
  pointer-events: none;
}

.home-toast {
  border-radius: 10px;
  padding: 0.85rem 1rem;
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
  transform: translateY(-8px);
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  font-weight: normal;
}

.home-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.home-toast-success {
  background: #16a34a;
}

.home-toast-error {
  background: #dc2626;
}

@media (max-width: 767px) {
  .home-toast-container {
    left: 1rem;
    right: 1rem;
    max-width: 100%;
  }
}
/* === END: HOMEPAGE INTRO + CONTACT === */

/* === START: POST LIST THUMB 65% === */
.post-thumb-65 {
  position: relative;
  width: 100%;
  padding-top: 65%;
  overflow: hidden;
}

.post-thumb-65-img,
.post-thumb-65-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.post-thumb-65-img {
  object-fit: cover;
}
/* === END: POST LIST THUMB 65% === */
