/* Global Reset - Remove all white spaces */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Exact Design Copy Styles */
.exact-design-container {
  font-family: 'Alexandria', sans-serif;
  height: 100vh; /* Fallback for older browsers */
  height: 100dvh; /* Dynamic viewport height - adjusts for mobile browser UI */
  overflow: hidden;
  position: relative;
  background: #8F7F7F;
  margin: 0;
  padding: 0;
  width: 100vw;
}

/* Adjust for header height on homepage */
body.homepage .exact-design-container {
  height: 100vh; /* Fallback */
  height: 100dvh; /* Dynamic viewport height */
  margin-top: 0;
}

/* Ambient Background Video - Heavily Blurred and Scaled */
.ambient-video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.5);
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  filter: blur(100px) brightness(0.9) saturate(1.3);
  opacity: 1;
  pointer-events: none;
  will-change: transform;
}

/* Main Video - Clear and Centered */
.main-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
  visibility: visible;
  will-change: transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -o-transform: translateZ(0);
}

/* Desktop: Use min-width for larger screens */
@media (min-width: 1501px) {
  .main-video {
    min-width: 1500px;
  }
}

/* For screens narrower than 1500px, fit width and center vertically */
@media (max-width: 1500px) {
  .main-video {
    width: 100%;
    height: auto;
    min-height: 100vh; /* Fallback */
    min-height: 100dvh; /* Dynamic viewport height */

    object-fit: contain;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    -o-transform: translate(-50%, -50%);
  }
  
  /* Keep ambient video covering full screen with extreme blur */
  .ambient-video {
    transform: translate(-50%, -50%) scale(1.4);
    filter: blur(120px) brightness(0.85) saturate(1.4);
  }
  
  /* Even heavier fade for smaller screens */
  .main-video {
    mask-image: linear-gradient(to bottom, 
      rgba(0,0,0,0) 0%, 
      rgba(0,0,0,0.5) 5%, 
      rgba(0,0,0,1) 18%, 
      rgba(0,0,0,1) 82%, 
      rgba(0,0,0,0.5) 95%,
      rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to bottom, 
      rgba(0,0,0,0) 0%, 
      rgba(0,0,0,0.5) 5%, 
      rgba(0,0,0,1) 18%, 
      rgba(0,0,0,1) 82%, 
      rgba(0,0,0,0.5) 95%,
      rgba(0,0,0,0) 100%);
  }
}

/* Mobile optimization - ensure video covers full screen */
@media (max-width: 768px) {
  .exact-design-container {
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    height: 100vh; /* Fallback for older browsers */
  }
  
  .main-video {
    width: 100%;
    height: 100%;
    min-height: 100dvh; /* Dynamic viewport height */
    min-height: 100vh; /* Fallback */
    object-fit: fill;
    object-position: center;
    top: 0;
    transform: none;
    -webkit-transform: none;
    /* Remove edge blur/fade on mobile */
    mask-image: none !important;
    -webkit-mask-image: none !important;
  }
  
  /* Hide ambient video on mobile for better performance */
  .ambient-video {
    display: none !important;
  }
  
  body.homepage {
    height: 100dvh; /* Dynamic viewport height */
    height: 100vh; /* Fallback */
  }
}

/* Fallback Background Image */
.exact-design-container img {
  top: -1;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Prevent scrollbar on homepage */
body.homepage {
  overflow: hidden;
  height: 100vh; /* Fallback */
  height: 100dvh; /* Dynamic viewport height */
}

/* Header styles are now handled by main-ar.css and main-en.css for consistency */

/* Bottom Section - Responsive */
.bottom-section {
  position: absolute;
  bottom: 4.4vh; /* 64px from 1440px height */
  right: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 10;
  margin: 0;
  max-width: 1600px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
}

/* Partner Card */
.partner-card {
  width: 8.6vw; /* 124px from 1440px width */
  height: Auto;
  padding: 0.8vh 0.8vw; /* 12px padding */
}

.partner-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* Chat Button */
.chat-button {
  padding: 8px 24px; /* py-2 px-6 from reference */
  opacity: 0.50;
  background: white;
  border-radius: 44px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px; /* gap-2.5 from reference */
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  transform: translateY(0);
}

.chat-button:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

.chat-icon {
  width: 24px; /* w-6 from reference */
  height: 24px; /* h-6 from reference */
  position: relative;
}

.chat-icon-svg {
  width: 20px; /* w-5 from reference */
  height: 20px; /* h-5 from reference */
  position: absolute;
  left: 2.01px; /* left-[2.01px] from reference */
  top: 2px; /* top-[2px] from reference */
}

.chat-text {
  flex: 1;
  text-align: right;
  color: black;
  font-size: 16px; /* text-base from reference */
  font-weight: 500; /* font-medium from reference */
  line-height: 1.625; /* leading-relaxed from reference */
}

/* RTL Support for Arabic */
html[dir="rtl"] .bottom-section {
  direction: rtl;
}

html[dir="rtl"] .chat-button {
  justify-content: flex-end;
}

html[dir="rtl"] .chat-text {
  text-align: left;
}

/* RTL Order - Partner card on left, Chat button on right */
html[dir="rtl"] .partner-card {
  order: 1;
}

html[dir="rtl"] .chat-button {
  order: 2;
}

/* Responsive Design */
@media (max-width: 1920px) {
  .partner-text {
    font-size: 14px;
  }
  
  .partner-title {
    font-size: 24px;
  }
  
  .chat-text {
    font-size: 16px;
  }
}

@media (min-width: 1024px) {
  .bottom-section {
    padding: 0 3%;
  }
}


@media (max-width: 1400px) {
  .bottom-section {
    max-width: 100%;
    left: 0;
    transform: none;
  }
}

@media (max-width: 1200px) {
  .bottom-section {
    bottom: 3vh;
  }
}

@media (max-width: 1024px) {
  .bottom-section {
    flex-direction: row-reverse;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0;
    bottom: 16px;
    width: calc(100% - 32px);
    left: 16px;
    transform: none;
  }
  
  .partner-card {
    width: 124px;
    height: 135px;
    opacity: 0.50;
    background: transparent;
    order: 2;
  }
  
  .chat-button {
    width: 186px;
    padding: 8px 24px;
    opacity: 0.50;
    background: white;
    border-radius: 44px;
    order: 1;
  }
  
  /* Reset RTL order for mobile */
  html[dir="rtl"] .partner-card {
    order: 2;
  }
  
  html[dir="rtl"] .chat-button {
    order: 1;
  }
}

@media (max-width: 768px) {
  .bottom-section {
    bottom: 16px;
    width: calc(100% - 32px);
    left: 16px;
    transform: none;
  }
  
  .partner-card {
    width: 124px;
    height: 135px;
    opacity: 0.50;
    background: transparent;
    order: 2;
  }
  
  .chat-button {
    width: 186px;
    padding: 8px 24px;
    opacity: 0.50;
    background: white;
    border-radius: 44px;
    order: 1;
  }
  
  .chat-text {
    font-size: 16px;
    font-weight: 500;
  }
}

@media (max-width: 480px) {
  .bottom-section {
    bottom: 16px;
  }
  
  .partner-card {
    width: 124px;
    height: 135px;
  }
  
  .chat-button {
    width: 150px;
    padding: 8px 20px;
  }

  .chat-text {
    font-size: 12px;
  }
}

/* Video Poster Styles */

.video-poster {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  background: var(--bg-primary, #8F7F7F);
  display: flex; /* Visible by default */
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

.poster-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  /* Ensure image loads properly */
  max-width: 100%;
  max-height: 100%;
}

/* Enhanced video performance styles */
.main-video,
.ambient-video {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  /* Optimize rendering */
  image-rendering: optimizeSpeed;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: optimize-contrast;
  /* Smooth transitions */
  transition: opacity 0.3s ease-in-out;
}

/* Hide videos initially for smooth loading */
.main-video[preload="none"],
.ambient-video[preload="none"] {
  opacity: 0;
}

.main-video[preload="auto"],
.ambient-video[preload="auto"] {
  opacity: 1;
}

/* Optimize poster image loading */
.poster-image {
  image-rendering: optimizeSpeed;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: optimize-contrast;
  transition: opacity 0.3s ease-in-out;
}

/* Responsive adjustments for poster */
@media (max-width: 768px) {
  .video-poster {
    transition: opacity 0.4s ease-out;
  }
}

@media (max-width: 480px) {
  .video-poster {
    transition: opacity 0.5s ease-out;
  }
}
