/* Custom styles for Reborn Transport website */

/* Performance optimizations */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Ensure proper stacking context for the entire page */
body {
  position: relative;
  z-index: 0;
}

/* Ensure no element can overlay the header */
* {
  z-index: auto !important;
}

header, #mobile-menu {
  z-index: 9999 !important;
}

/* Ensure header elements are not affected by AOS or other animations */
header .flex.items-center:first-child,
header .language-switcher,
header nav {
  animation: none !important;
  transition: none !important;
}

/* Additional protection for header stability */
header {
  animation: none !important;
  transition: none !important;
  transform: none !important;
  will-change: auto !important;
}

/* Prevent AOS from affecting header */
header [data-aos],
header [data-aos-delay],
header [data-aos-duration] {
  animation: none !important;
  transition: none !important;
  opacity: 1 !important;
  transform: none !important;
  visibility: visible !important;
  animation-delay: 0s !important;
  transition-delay: 0s !important;
}

/* Header styling */
header {
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  height: 80px;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  z-index: 9999;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  will-change: transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  contain: layout style;
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

/* Ensure header layout is stable */
header .container {
  contain: layout style;
}

header .flex.justify-between.items-center {
  contain: layout style;
}

/* Prevent any animation on header elements */
header [data-aos] {
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Specifically prevent AOS from affecting header layout */
header * {
  animation-delay: 0s !important;
  transition-delay: 0s !important;
  transform: none !important;
}

/* Tablet responsiveness */
@media (max-width: 1024px) and (min-width: 769px) {
  header {
    height: 75px;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
  }
  
  header .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .language-switcher a {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 768px) {
  header {
    height: 70px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
  
  header .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  .language-switcher a {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    min-width: 32px;
    min-height: 32px;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  header {
    height: 65px;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }
  
  .language-switcher a {
    padding: 0.25rem 0.4rem;
    font-size: 0.8rem;
    min-width: 28px;
    min-height: 28px;
  }
  
  /* Reduce navigation spacing on very small screens */
  header nav ul {
    margin-right: 0.5rem;
  }
}

/* Language switcher improvements for all devices */
.language-switcher a {
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1024px) and (min-width: 769px) {
  .language-switcher a {
    min-width: 32px;
    min-height: 32px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 768px) {
  .language-switcher a {
    min-width: 32px;
    min-height: 32px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  .language-switcher a {
    min-width: 28px;
    min-height: 28px;
    padding: 0.25rem 0.4rem;
    font-size: 0.8rem;
  }
  
  /* On very small screens, we might need to adjust the Chinese text */
  .language-switcher a[data-lang="zh"] {
    font-size: 0.7rem;
  }
}

/* Ensure language switcher stays within header bounds */
.language-switcher {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  contain: layout style;
}

/* Ensure logo container stays in place */
header .flex.items-center:first-child {
  flex-shrink: 0;
  contain: layout style;
}

/* Ensure navigation stays in place */
header nav {
  flex-shrink: 1;
  contain: layout style;
}

/* Ensure header content doesn't overflow */
header .flex.justify-between.items-center {
  flex-wrap: nowrap;
  width: 100%;
  gap: 1rem;
  contain: layout style;
}

@media (max-width: 768px) {
  header .flex.justify-between.items-center {
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  header .flex.justify-between.items-center {
    gap: 0.25rem;
  }
}

/* Prevent navigation links from wrapping */
header nav ul {
  flex-wrap: nowrap;
  align-items: center;
}

header nav ul li {
  white-space: nowrap;
}

/* Navigation responsive adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
  header nav ul {
    margin-right: 1rem;
  }
  
  header nav ul li a {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
  }
}

@media (max-width: 768px) {
  header nav ul {
    margin-right: 0.75rem;
  }
  
  header nav ul li a {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
  }
}

@media (max-width: 480px) {
  header nav ul {
    margin-right: 0.5rem;
  }
  
  header nav ul li a {
    font-size: 0.8rem;
    padding: 0.25rem 0.4rem;
  }
}

/* Logo styling */
header img[alt*="Logo"] {
  max-height: 60px;
  width: auto;
  object-fit: contain;
}

/* Logo responsive adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
  header img[alt*="Logo"] {
    max-height: 55px;
  }
}

@media (max-width: 768px) {
  header img[alt*="Logo"] {
    max-height: 50px;
  }
}

@media (max-width: 480px) {
  header img[alt*="Logo"] {
    max-height: 45px;
  }
}

/* Language switcher responsive adjustments */
.language-switcher {
  flex-shrink: 0;
  min-width: 100px;
}



.language-switcher a:hover {
  transform: scale(1.05);
}

/* Mobile menu button improvements */
#mobile-menu-button {
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#mobile-menu-button:hover {
  transform: scale(1.1);
}

/* Mobile menu improvements */
#mobile-menu {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

/* Mobile menu animation */
#mobile-menu {
  transform: translateY(-10px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#mobile-menu:not(.hidden) {
  transform: translateY(0);
  opacity: 1;
}

/* Hero section */
.hero-section {
  height: 100vh;
  position: relative;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
}

.hero-content {
  position: relative;
  z-index: 2;
  color: white;
  text-align: center;
  padding: 2rem;
}

/* Enhanced hero text visibility */
.hero-title {
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
  font-weight: 800;
  background-color: rgba(0, 0, 0, 0.3);
  padding: 10px 20px;
  border-radius: 5px;
  display: inline-block;
}

.hero-subtitle {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  font-weight: 600;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 8px 16px;
  border-radius: 5px;
  display: inline-block;
}

/* Drop shadow utility classes for better text visibility */
.drop-shadow-2xl {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.drop-shadow-3xl {
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
}

/* Service cards */
.service-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Fleet gallery */
.fleet-item {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.fleet-item img {
  transition: transform 0.5s ease;
}

.fleet-item:hover img {
  transform: scale(1.05);
}

.fleet-item .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fleet-item:hover .overlay {
  opacity: 1;
}

/* Testimonials */
.testimonial-card {
  transition: transform 0.3s ease;
}

.testimonial-card:hover {
  transform: translateY(-5px);
}

/* FAQ Section */
.faq-item {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.faq-question {
  padding: 1.5rem;
  background-color: #f8fafc;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-align: left;
}

.faq-answer {
  padding: 0 1.5rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-answer.open {
  padding: 0 1.5rem 1.5rem;
  max-height: 500px;
}

/* Booking section */
.booking-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.booking-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Gallery */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.gallery-item .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .overlay {
  opacity: 1;
}

/* Footer */
footer ul li a {
  transition: color 0.3s ease;
}

footer ul li a:hover {
  color: #ffffff;
  padding-left: 5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2.5rem;
  }
  
  .hero-content p {
    font-size: 1.2rem;
  }
  
  .service-card {
    margin-bottom: 2rem;
  }
  
  .fleet-item {
    margin-bottom: 2rem;
  }
  
  /* Adjust hero section for mobile */
  .hero-section {
    height: 70vh;
  }
  
  /* Adjust grid layouts for mobile */
  .grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3 {
    grid-template-columns: 1fr !important;
  }
  
  .grid-cols-1.md\:grid-cols-2.lg\:grid-cols-4 {
    grid-template-columns: 1fr !important;
  }
  
  .grid-cols-1.md\:grid-cols-3 {
    grid-template-columns: 1fr !important;
  }
  
  /* Adjust section padding for mobile */
  section.py-16 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  /* Adjust service sections for mobile */
  .service-section {
    flex-direction: column !important;
  }
  
  .service-section .p-6,
  .service-section .p-8 {
    padding: 1rem !important;
  }
  
  .service-section .h-64 {
    height: 16rem !important;
  }
  
  /* Adjust button sizes for mobile */
  .btn-primary, .bg-blue-600, .bg-white {
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
  }
  
  /* Adjust footer grid for mobile */
  footer .grid.grid-cols-1.md\:grid-cols-4 {
    grid-template-columns: 1fr 1fr !important;
  }
  
  /* Adjust how it works section for mobile */
  .flex.flex-wrap.justify-center .w-full.md\:w-1\/5 {
    width: 50% !important;
    margin-bottom: 1rem !important;
  }
  
  /* Adjust form layouts for mobile */
  .grid.grid-cols-1.md\:grid-cols-2.gap-6 {
    grid-template-columns: 1fr !important;
  }
  
  /* Adjust contact info layout for mobile */
  .grid.grid-cols-1.md\:grid-cols-2.gap-8 {
    grid-template-columns: 1fr !important;
  }
  
  /* Header improvements for different screen sizes */
  header .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  @media (max-width: 1024px) and (min-width: 769px) {
    header .container {
      padding-left: 1rem;
      padding-right: 1rem;
    }
  }
  
  @media (max-width: 768px) {
    header .container {
      padding-left: 0.75rem;
      padding-right: 0.75rem;
    }
  }
  
  @media (max-width: 480px) {
    header .container {
      padding-left: 0.5rem;
      padding-right: 0.5rem;
    }
  }
  
  /* Language switcher adjustments for mobile */
  .language-switcher a {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.875rem;
    min-width: 32px;
    min-height: 32px;
  }
  
  /* Mobile menu adjustments */
  #mobile-menu ul {
    padding: 1rem;
  }
  
  #mobile-menu li a {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
  
  /* Ensure header content doesn't overflow on mobile */
  header .flex.justify-between.items-center {
    flex-wrap: nowrap;
  }
  
  header nav ul {
    flex-wrap: nowrap;
  }
  
  header nav ul li {
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  /* Further adjustments for small screens */
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .hero-content p {
    font-size: 1rem;
  }
  
  /* Stack buttons vertically on very small screens */
  .flex.flex-wrap.gap-4 {
    flex-direction: column;
    align-items: center;
  }
  
  .flex.flex-wrap.gap-4 a {
    width: 80%;
    text-align: center;
  }
  
  /* Adjust footer for very small screens */
  footer .grid.grid-cols-1.md\:grid-cols-4 {
    grid-template-columns: 1fr !important;
  }
  
  /* Adjust how it works section for very small screens */
  .flex.flex-wrap.justify-center .w-full.md\:w-1\/5 {
    width: 100% !important;
  }
  
  /* Adjust button sizes for very small screens */
  .text-3xl.font-bold.mb-6 {
    font-size: 1.5rem !important;
  }
  
  .text-xl.mb-8 {
    font-size: 1.125rem !important;
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
}

/* Button hover effects */
.btn-primary {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 14px rgba(0, 0, 0, 0.18);
}

.btn-primary:active {
  transform: translateY(-1px);
}

/* Form styling */
.form-input {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Social media links */
.social-link {
  transition: transform 0.3s ease, color 0.3s ease;
}

.social-link:hover {
  transform: translateY(-3px);
}

/* WhatsApp button */
.whatsapp-btn {
  background-color: #25D366;
  transition: background-color 0.3s ease;
}

.whatsapp-btn:hover {
  background-color: #128C7E;
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .service-card:hover,
  .fleet-item:hover img,
  .testimonial-card:hover,
  .booking-card:hover,
  .gallery-item:hover .overlay {
    transform: none;
    box-shadow: none;
    opacity: 1;
  }
  
  /* Make buttons more touch-friendly */
  button, .btn-primary, .bg-blue-600, .bg-white {
    min-height: 36px;
    min-width: 36px;
  }
  
  /* Improve touch targets */
  a, button, input, select, textarea {
    min-height: 36px;
    min-width: 36px;
  }
  
  /* Language switcher touch improvements */
  .language-switcher a {
    min-height: 36px;
    min-width: 36px;
    padding: 0.25rem 0.5rem !important;
  }
  
  /* Mobile menu item touch improvements */
  #mobile-menu a {
    min-height: 36px;
    padding: 0.75rem !important;
  }
}