/* ============================================
   Main Stylesheet
   引入设计令牌和基础样式
   ============================================ */

/* 引入设计令牌系统 */
@import url('design-tokens.css');

/* CSS Variables - 保持向后兼容 */
:root {
  --color-primary: #00476b;
  --color-secondary: #3b82f6;
  --color-accent: #2563eb;
  --color-light: #f9fafb;
  --color-dark: #1e293b;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
}

/* Base Styles */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--color-dark);
  background-color: var(--color-light);
}

/* Components */
.content-auto {
  content-visibility: auto;
}

.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px -5px rgba(0, 86, 179, 0.1), 0 10px 10px -5px rgba(0, 86, 179, 0.04);
}

.card-shadow {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn-primary {
  background-color: #00476B;
  color: white;
  padding: 0.75rem 1.75rem;
  border-radius: 0.375rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 6px -1px rgba(0, 71, 107, 0.1), 0 2px 4px -1px rgba(0, 71, 107, 0.06);
  transition: all 0.3s;
}

.btn-primary:hover {
  background-color: #003350;
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn-primary:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7), 0 0 0 4px rgba(0, 86, 179, 0.5);
}

.btn-secondary {
  background-color: white;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.3s;
}

.btn-secondary:hover {
  background-color: rgba(0, 86, 179, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7), 0 0 0 4px rgba(0, 86, 179, 0.5);
}

.text-shadow {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gradient-bg {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
}

.nav-link {
  position: relative;
  padding: 0.5rem 0.75rem;
  color: white;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: white;
  opacity: 0.9;
}

/* Responsive navigation for longer text (Japanese, etc.) */
@media (max-width: 1280px) {
  header nav {
    gap: 0.5rem !important;
  }
  
  .nav-link {
    padding: 0.4rem 0.5rem;
    font-size: 0.8125rem;
  }
  
  .group > .nav-link {
    padding: 0.5rem;
    min-height: 48px;
  }
}

@media (max-width: 1024px) {
  header nav {
    gap: 0.25rem !important;
  }
  
  .nav-link {
    padding: 0.35rem 0.4rem;
    font-size: 0.75rem;
  }
  
  .group > .nav-link {
    padding: 0.4rem;
    min-height: 44px;
  }
  
  .nav-link i {
    font-size: 0.625rem;
  }
}

@media (max-width: 900px) {
  header nav {
    gap: 0.125rem !important;
  }
  
  .nav-link {
    padding: 0.3rem 0.3rem;
    font-size: 0.6875rem;
    letter-spacing: 0;
  }
  
  .group > .nav-link {
    padding: 0.3rem;
    min-height: 40px;
  }
}

/* For light background navigation */
.nav-light .nav-link {
  color: var(--color-primary);
  font-weight: 500;
}

.nav-light .nav-link:hover {
  color: var(--color-secondary);
  opacity: 1;
}

/* Logo styles */
header .logo-text {
  fill: white;
  transition: fill 0.3s ease;
}

/* Image logo styles */
header .logo-image {
  /* Default state - will be filtered to white */
  filter: brightness(0) invert(1);
  transition: filter 0.3s ease, all 0.3s ease;
  height: auto; /* Let height scale proportionally */
  width: auto;
  max-height: 3rem; /* 48px - base size for desktop */
  max-width: 200px;
  min-width: 80px;
  display: block;
}

/* Responsive adjustments for logo based on device width */
@media (max-width: 1200px) {
  header .logo-image {
    max-height: 2.75rem; /* 44px */
    max-width: 180px;
  }
}

@media (max-width: 992px) {
  header .logo-image {
    max-height: 2.5rem; /* 40px */
    max-width: 160px;
  }
}

@media (max-width: 768px) {
  header .logo-image {
    max-height: 2.25rem; /* 36px */
    max-width: 140px;
    min-width: 70px;
  }
}

@media (max-width: 576px) {
  header .logo-image {
    max-height: 2.25rem; /* 36px - same as tablet size */
    max-width: 140px; /* same as tablet size */
    min-width: 70px; /* same as tablet size */
  }
}

/* Footer logo styles */
footer .logo-image {
  /* Ensure logo is white in footer */
  filter: brightness(0) invert(1);
  height: auto;
  width: auto;
  max-height: 2.5rem; /* Match header logo size */
  max-width: 180px;
  min-width: 70px;
  display: block;
}

/* Responsive adjustments for footer logo */
@media (max-width: 768px) {
  footer .logo-image {
    max-height: 2.25rem; /* 36px - match tablet size */
    max-width: 140px;
    min-width: 70px;
  }
}

@media (max-width: 576px) {
  footer .logo-image {
    max-height: 2.25rem; /* 36px - same as tablet size */
    max-width: 140px; /* same as tablet size */
    min-width: 70px; /* same as tablet size */
  }
}

/* Ensure logo stays visible when navbar background changes */
.nav-light .logo-text {
  fill: var(--color-primary);
}

.nav-light .logo-image {
  /* Floating state - remove filter to show original colors */
  filter: none;
}

/* Prevent logo color change on hover */
header a:hover .logo-text {
  fill: inherit;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0.125rem;
  background-color: white;
  transition: width 0.3s ease;
}

.nav-light .nav-link::after {
  background-color: var(--color-primary);
}

.nav-link:hover::after {
  width: 80%;
}

.progress-bar {
  height: 0.25rem;
  background-color: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-value {
  height: 100%;
  transition: all 1s ease-out;
  border-radius: 9999px;
}

/* Custom Button Styles */
.btn-outline-contact {
  border: 2px solid var(--color-primary);
  color: white;
  background-color: transparent;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-weight: 500;
  transition: all 0.3s;
}

.btn-outline-contact:hover {
  background-color: var(--color-primary);
  color: white;
}

/* For light background navigation */
.bg-white .btn-outline-contact {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.bg-white .btn-outline-contact:hover {
  background-color: var(--color-primary);
  color: white;
}

/* Utilities */
.text-balance {
  text-wrap: balance;
}

.perspective-1000 {
  perspective: 1000px;
}

.preserve-3d {
  transform-style: preserve-3d;
}

.backface-hidden {
  backface-visibility: hidden;
}

.rotate-y-180 {
  transform: rotateY(180deg);
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Touch Swipe Styles */
.touch-swipe {
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-x;
  cursor: grab;
  will-change: transform;
  /* Ensure smooth performance */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  perspective: 1000px;
  -webkit-perspective: 1000px;
}

.touch-swipe:active {
  cursor: grabbing;
}

.touch-swipe.swiping-active {
  /* Remove scale effect that might interfere with movement */
  transform: scale(1.05);
  transition: transform 0.1s ease;
}

/* Ensure scroll thumb container allows movement */
#scrollThumb {
  position: absolute;
  left: 0;
  /* Ensure it can be moved */
  will-change: transform;
}

/* Responsive display utility */
.banner-content-desktop {
  display: block;
}

/* Hide on small tablets and mobile devices */
@media (max-width: 576px) {
  .banner-content-desktop {
    display: none;
  }
}

/* Dropdown Menu Styles */
.dropdown-menu {
  position: fixed;
  left: 0;
  right: 0;
  background-color: white;
  border-radius: 0.375rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-out, visibility 3s ease-out; /* Increased from 0.5s to 0.8s for slower disappearance */
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 1000; /* Increased from 100 to 1000 to ensure dropdown is above floating navigation */
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 正常状态下的下拉菜单位置 */
header:not(.nav-light) .dropdown-menu {
  top: 90px;
}

/* 滚动状态下的下拉菜单位置 */
header.nav-light .dropdown-menu {
  top: 110px; /* Increased from 100px to 120px for even larger top margin when navigation is floating */
}

/* Group container that wraps both the menu item and dropdown */
.group {
  position: relative;
  display: inline-block;
}

/* Style for the product menu item to ensure it has enough hover space */
.group > .nav-link {
  position: relative;
  padding: 1rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  min-height: 56px;
}

/* Create an invisible pseudo-element to bridge the gap */
.group > .nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 25px; /* Increased from 15px to 25px for better hover experience */
  background: transparent;
}

/* Show dropdown when hovering over group container */
.group:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* 增强下拉菜单的悬停区域 */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -15px;
  left: 0;
  right: 0;
  height: 15px;
  background: transparent;
  z-index: 1001;
  pointer-events: auto;
}

/* 为下拉菜单添加平滑过渡效果 */
.dropdown-menu {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Arrow rotation animation */
.group:hover .nav-link i {
  color: var(--color-accent);
  transform: rotate(180deg);
}

/* Custom badge for "定制" label */
.custom-badge {
  background-color: #1a365d;
  color: white;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 500;
}

/* Dropdown menu link styles */
.dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--color-text-primary);
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.dropdown-menu a:hover {
  background-color: #f3f4f6;
  color: var(--color-primary);
}

/* Dropdown columns with borders */
.dropdown-menu .category-column,
.dropdown-menu .subcategory-column,
.dropdown-menu .info-column {
  border-right: 1px solid #f0f0f0;
}

/* Product info section styles */
.dropdown-menu .bg-white {
  margin-bottom: 1rem;
}

.dropdown-menu .bg-white img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.dropdown-menu h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.75rem;
}

.dropdown-menu .grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.dropdown-menu .text-center .text-xl {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2563eb;
}

.dropdown-menu .text-center .text-xs {
  font-size: 0.75rem;
  color: #6b7280;
}

.dropdown-menu button {
  width: 100%;
  background-color: var(--color-primary); /* Changed to primary color #00476b */
  color: white;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropdown-menu button:hover {
  background-color: #003b58; /* Darker shade of primary color for hover effect */
}

/* You may be looking for section */
.dropdown-menu h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #111827;
}

/* Nested menu styles */
  .dropdown-menu .border-l-2 {
    border-left: 2px solid #e5e7eb;
  }

  /* Responsive adjustments for dropdown menu */
  @media (min-width: 1024px) {
    .dropdown-menu .flex {
      flex-wrap: nowrap;
    }
  }

  @media (max-width: 1023px) {
    .dropdown-menu {
      width: 95vw;
      max-width: 4xl;
    }

    .dropdown-menu .flex {
      flex-wrap: wrap;
    }

    .dropdown-menu .category-column,
    .dropdown-menu .subcategory-column,
    .dropdown-menu .info-column,
    .dropdown-menu .related-links-column {
      width: 50%;
      margin-bottom: 1rem;
    }
  }

  @media (max-width: 767px) {
    .dropdown-menu .category-column,
    .dropdown-menu .subcategory-column,
    .dropdown-menu .info-column,
    .dropdown-menu .related-links-column {
      width: 100%;
      border-right: none;
      border-bottom: 1px solid #f0f0f0;
      padding-bottom: 1rem;
      margin-bottom: 1rem;
    }
    
    .dropdown-menu .flex {
      padding: 1rem;
    }
  }

  /* Chevron icon styles */
  .fa.fa-chevron-right {
    color: #9ca3af;
    transition: color 0.2s ease;
  }
  
  a:hover .fa.fa-chevron-right {
    color: #2563eb;
  }

/* Adjust dropdown styles for light navigation */
.header-scrolled .group:hover .nav-link i {
  color: var(--color-primary);
}

/* Ensure dropdown works correctly with sticky header */
.header-scrolled .dropdown-menu {
  background-color: white;
}

.header-scrolled .dropdown-menu a {
  color: var(--color-text-primary);
}

/* Dropdown menu visibility when hovered */
.group:hover .dropdown-menu {
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Mobile Menu Styles */
.mobile-menu-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  transition: transform 0.3s ease;
}

.mobile-menu-btn:hover {
  transform: scale(1.1);
}

/* Mobile Navigation Links */
.mobile-nav-link {
  display: flex;
  align-items: center;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.3s ease;
}

.mobile-nav-link:hover {
  padding-left: 0.5rem;
}

/* Header Animations */
header {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: visible;
}

/* Ensure body and html don't overflow */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Scroll to Top Button Styles */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 71, 107, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999; /* 提高z-index确保在所有元素之上 */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  visibility: hidden;
  pointer-events: none; /* 默认隐藏时不响应点击 */
  font-size: 1.25rem;
}

.scroll-top-btn:hover {
  background-color: var(--color-secondary);
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 71, 107, 0.4);
  pointer-events: auto;
}

.scroll-top-btn:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 71, 107, 0.2), 0 4px 12px rgba(0, 71, 107, 0.3);
}

.scroll-top-btn:active {
  transform: translateY(-2px) scale(1.02);
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .scroll-top-btn {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* Banner Slider Styles */
.banner-slide {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.banner-slide.active {
  display: block;
}

/* Banner Navigation Buttons */
.banner-prev,
.banner-next {
  opacity: 0.7;
  transition: all 0.3s ease;
  border: none;
  outline: none;
  cursor: pointer;
}

.banner-prev:hover,
.banner-next:hover {
  opacity: 1;
  transform: translateY(-2px);
  background-color: rgba(255, 255, 255, 0.4);
}

/* Responsive adjustments for banner buttons */
@media (max-width: 768px) {
  .banner-prev,
  .banner-next {
    width: 2.5rem;
    height: 2.5rem;
  }
  
  .banner-prev i,
  .banner-next i {
    font-size: 1rem;
  }
}

/* Animation Classes */
.animate-slide-left {
  animation: slideLeft 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-right {
  animation: slideRight 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.2s;
}

.animate-slide-up {
  animation: slideUp 1s ease-out forwards;
  animation-delay: 0.4s;
}

/* Keyframes for animations */
@keyframes slideLeft {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideRight {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideUp {
  0% {
    transform: translateY(50px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.banner-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.banner-dot.active {
  background-color: white;
  transform: scale(1.2);
}

/* Header Animations (duplicate - can be removed) */