/* Page Loading Animation */
.page-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
  animation: spin 1.5s linear infinite;
}

.spinner-ring:nth-child(1) {
  width: 100%;
  height: 100%;
  border-top-color: #00A19A;
  animation-delay: 0s;
}

.spinner-ring:nth-child(2) {
  width: 80%;
  height: 80%;
  border-right-color: #00C4B4;
  animation-delay: 0.15s;
  animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
  width: 60%;
  height: 60%;
  border-bottom-color: #00E5D4;
  animation-delay: 0.3s;
}

.loading-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Page transition fade effect */
.main {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Skeleton loading for content */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.banner .banner-info .banner-content .banner-title .span-gradient {
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ===== CLS (Cumulative Layout Shift) Fixes ===== */

/* Reserve header height to prevent CLS */
.header {
  min-height: 80px;
}

/* ===== Slick Slider - Prevent CLS during init ===== */
/* Hide content before Slick initializes, show after */

/* News slider */
.slider--news:not(.slick-initialized) {
  visibility: hidden;
  min-height: 450px;
}

.slider--news.slick-initialized {
  visibility: visible;
}

.slider--news .news-card,
.slider--news .news-card > a,
.slider--news .news-card .news-content {
  min-width: 0;
}

@media (max-width: 768px) {
  .slider--news .news-card,
  .slider--news .news-card > a,
  .slider--news .news-card .news-content {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  /* Full-width card on mobile (override fixed 320px to prevent broken layout) */
  .slider--news .news-card a {
    width: 100% !important;
    max-width: 100%;
  }
}

/* ===== News slider dots (navigator) - same style as homepage banner ===== */
.slider--news.slick-initialized .slick-dots {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0 0;
  margin: 0;
  list-style: none;
}
.slider--news .slick-dots li {
  height: initial;
  width: 40px;
  margin: 0 4px;
  background: none;
  background-position: unset;
}
.slider--news .slick-dots li button {
  width: 100%;
  height: 5px;
  padding: 0;
  border: none;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.12);
  color: transparent;
  font-size: 0;
  cursor: pointer;
  transition: background 0.2s ease;
}
.slider--news .slick-dots li.slick-active button {
  background: linear-gradient(180deg, #0081C2 0%, #0098C2 100%);
}
.slider--news .slick-dots li:hover button {
  background: linear-gradient(180deg, #0081C2 0%, #0098C2 100%);
}

/* News box - latest section - reserve space */
.newsBox--latest {
  min-height: 580px;
}

/* Latest section: same card flex layout as list so .news-text line-clamp matches on all viewports (e.g. iPad) */
.newsBox--latest .slider--news .news-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}
.newsBox--latest .slider--news .news-card > a {
  min-width: 0;
}

.newsBox .detailBody a,
.newsBox .detailContent a {
  color: #007bff;
  text-decoration: underline;
}

.newsBox .detailBody a:hover,
.newsBox .detailContent a:hover {
  text-decoration: underline;
  opacity: 0.9;
}

.news-card .news-content .news-text,
.newsBox .header-detail .quote {
  white-space: pre-line;
}
.newsBox--latest .slider--news .news-card .news-content {
  flex: 1;
  min-height: 160px;
  min-width: 0;
}

/* Related news section */
.relatedNews {
  min-height: 500px;
}

.relatedNews .slider--news:not(.slick-initialized) {
  min-height: 400px;
}

/* Related news section */
.relatedNews {
  min-height: 450px;
}

/* Page news: related section – same layout/navigator as homepage, mobile fix */
.page-news .relatedNews {
  overflow: visible;
  padding-bottom: 48px;
}

/* Navigator (dots) – same as homepage, always visible */
.page-news .relatedNews .slider--news.slick-initialized .slick-dots,
.relatedNews .slider--news.slick-initialized .slick-dots {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0 0;
  margin: 0;
  list-style: none;
}

@media (max-width: 768px) {
  .page-news .relatedNews .wrap {
    padding-left: 24px;
    padding-right: 24px;
  }

  .page-news .relatedNews .slider--news,
  .relatedNews .slider--news {
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  .page-news .relatedNews .slider--news .slick-list,
  .relatedNews .slider--news .slick-list {
    width: 100% !important;
    margin-left: 0 !important;
    overflow: visible;
  }

  .page-news .relatedNews .slider--news .slick-track .slick-slide,
  .relatedNews .slider--news .slick-track .slick-slide {
    padding: 0 8px;
  }

  .page-news .relatedNews .slider--news .news-card,
  .page-news .relatedNews .slider--news .news-card > a,
  .relatedNews .slider--news .news-card,
  .relatedNews .slider--news .news-card > a {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .page-news .relatedNews .slider--news .slick-dots,
  .relatedNews .slider--news .slick-dots {
    display: flex !important;
    padding: 24px 0 0;
  }
}

/* All news wrapper */
.newsWrap {
  min-height: 600px;
}

/* ===== News List - Ensure 3 columns layout ===== */
.list-news ul {
  display: flex !important;
  flex-wrap: wrap !important;
  margin-left: -24px !important;
}

.list-news ul li {
  width: 33.333333% !important;
  padding: 48px 0 0 24px !important;
  box-sizing: border-box;
}

/* News card stable dimensions */
.list-news .news-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}
.list-news .news-card > a {
  min-width: 0;
}

.list-news .news-card .news-thumb {
  position: relative;
  padding-bottom: 56.18%; /* 550/309 aspect ratio */
  overflow: hidden;
  background-color: #f5f5f5;
}

.list-news .news-card .news-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-news .news-card .news-content {
  flex: 1;
  min-height: 160px;
  min-width: 0; /* allow shrink so -webkit-line-clamp works in flex layout (e.g. iPad portrait) */
}

@media (max-width: 991px) {
  .list-news ul li {
    width: 50% !important;
  }
}

@media (max-width: 767px) {
  .header {
    min-height: 60px;
  }

  .slider--news {
    min-height: 350px;
  }

  .newsBox--latest {
    min-height: 400px;
  }

  .relatedNews {
    min-height: 400px;
  }

  .list-news ul {
    margin-left: -8px !important;
  }

  .list-news ul li {
    width: 100% !important;
    padding: 24px 0 0 8px !important;
  }

  .list-news .news-card .news-content {
    min-height: 140px;
  }

  .newsBox--latest .slider--news .news-card .news-content {
    min-height: 140px;
  }
}

/* ===== Toast Notification ===== */
.toast-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}

.toast-notification,
.success-toast {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  animation: toastSlideDown 0.3s ease-out;
}

@keyframes toastSlideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.toast-notification-inner,
.success-toast-inner {
  display: flex;
  align-items: center;
  background-color: #2E7D32;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 800px;
  gap: 16px;
}

/* Error variant */
.toast-notification--error .toast-notification-inner {
  background-color: #D84315;
}

.toast-notification-left,
.success-toast-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.toast-icon,
.success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-title,
.success-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.toast-notification-divider,
.success-toast-divider {
  width: 1px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.toast-notification-message,
.success-toast-message {
  flex: 1;
  font-size: 14px;
  color: #fff;
  line-height: 1.5;
}

.toast-notification-close,
.success-toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s;
}

.toast-notification-close:hover,
.success-toast-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 767px) {
  .toast-notification,
  .success-toast {
    top: 80px;
    left: 16px;
    right: 16px;
    transform: none;
  }

  @keyframes toastSlideDown {
    from {
      opacity: 0;
      transform: translateY(-20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .toast-notification-inner,
  .success-toast-inner {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 12px;
  }

  .toast-notification-divider,
  .success-toast-divider {
    display: none;
  }

  .toast-notification-message,
  .success-toast-message {
    flex-basis: 100%;
    order: 3;
  }

  .toast-notification-close,
  .success-toast-close {
    margin-left: auto;
  }
}

/* ===== Subscribe Form Layout Fix ===== */
.footerTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 20px;
}

.footerTop .subscribe {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
  flex-shrink: 0;
}

.footerTop .subscribe-label {
  white-space: nowrap;
  flex-shrink: 0;
}

.footerTop .subscribe-form {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}

.footerTop .subscribe-form .form-control {
  flex: 1;
  min-width: 200px;
}

.footerTop .subscribe-form .btn {
  flex-shrink: 0;
}

@media (max-width: 991px) {
  .banner-contact .banner-btn {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }

  .banner-contact .banner-btn > a,
  .banner-contact .banner-btn > * {
    width: 100%;
    max-width: 100%;
    margin-right: 0 !important;
    margin-bottom: 12px;
  }

  .banner-contact .banner-btn > a:last-child,
  .banner-contact .banner-btn > *:last-child {
    margin-bottom: 0;
  }

  .banner-contact .banner-btn .btn {
    width: 100%;
    margin-right: 0;
    box-sizing: border-box;
  }

  .footerTop {
    flex-wrap: wrap;
    justify-content: flex-start;
    text-align: left;
  }

  .footerTop .subscribe {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
    padding-left: 0 !important;
  }

  .footerTop .subscribe-form {
    width: 100%;
    max-width: 400px;
  }

  .footerTop .subscribe-form .form-control {
    flex: 1;
    min-width: 0;
  }
}

/* Trademark cards: align bottom links on same row (laptop/desktop) */
@media (min-width: 991px) {
  .trademark-company .trademark-list.trademark-list--col3 .collapse {
    display: flex;
    flex-flow: column;
    min-height: 0;
  }
  .trademark-company .trademark-list.trademark-list--col3 .trademark-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  .trademark-company .trademark-list.trademark-list--col3 .trademark-info {
    flex: 1;
  }
  .trademark-company .trademark-list.trademark-list--col3 .trademark-link {
    margin-top: auto;
  }
}
