/* ===================================
   Bootstrap Carousel Hero Section Styles
   =================================== */

/* ===================================
   Base Carousel Container Styles
   =================================== */

.hero-carousel-section {
  position: relative;
  width: 100vw;
  max-width: 100%;
  height: 100vh;
  min-height: 500px;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* Fix horizontal and vertical overflow */
html {
  overflow-x: hidden;
  width: 100%;
}

body {
  overflow-x: hidden;
  width: 100%;
  margin: 0;
  padding: 0;
}

#heroCarousel {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.carousel-inner {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.carousel-item {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

#heroCarousel {
  width: 100%;
  height: 100%;
}

.carousel-inner {
  height: 100%;
}

.carousel-item {
  height: 100%;
}

.carousel-slide-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* ===================================
   Logo Overlay Positioning and Animation
   =================================== */

.logo-overlay {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  pointer-events: none;
}

.logo-img {
  max-width: 200px;
  width: 80vw;
  height: auto;
  opacity: 0;
  transform: scale(0.5);
  transition: none;
}

/* Popup Animation */
.logo-img.show {
  animation: logoPopup 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes logoPopup {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===================================
   Responsive Styles
   =================================== */

/* Desktop (1024px+) - Default styles above */

/* Tablet (768px-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .hero-carousel-section {
    height: 70vh;
  }
  
  .logo-img {
    max-width: 180px;
  }
}

/* Mobile (<768px) */
@media (max-width: 767px) {
  .hero-carousel-section {
    height: 70vh;
    min-height: 500px;
  }
  
  .logo-img {
    max-width: 150px;
  }
}

/* ===================================
   Carousel Controls Styling
   =================================== */

.carousel-control-prev,
.carousel-control-next {
  width: 5%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.hero-carousel-section:hover .carousel-control-prev,
.hero-carousel-section:hover .carousel-control-next,
.carousel-control-prev:focus,
.carousel-control-next:focus {
  opacity: 0.8;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
  opacity: 1;
}

/* Ensure controls are keyboard accessible */
.carousel-control-prev:focus-visible,
.carousel-control-next:focus-visible {
  outline: 3px solid #0d6efd;
  outline-offset: 2px;
  opacity: 1;
}

/* ===================================
   Carousel Indicators Styling
   =================================== */

.carousel-indicators {
  display: none !important;
}

.carousel-indicators [data-bs-target] {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  background-color: transparent;
  opacity: 0.5;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.carousel-indicators [data-bs-target]:hover {
  opacity: 0.8;
  transform: scale(1.2);
}

.carousel-indicators [data-bs-target].active {
  opacity: 1;
  background-color: #fff;
  transform: scale(1.1);
}

/* Keyboard focus for indicators */
.carousel-indicators [data-bs-target]:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
  opacity: 1;
}

/* ===================================
   Reduced Motion Support
   =================================== */

@media (prefers-reduced-motion: reduce) {
  .carousel-fade .carousel-item {
    transition: none;
  }
  
  .logo-img.show {
    animation: none;
    opacity: 1;
    transform: scale(1);
  }
  
  .carousel-control-prev,
  .carousel-control-next,
  .carousel-indicators [data-bs-target] {
    transition: none;
  }
}

/* Hero Text Overlay - Signature for Each Page */
.hero-text-overlay {
  position: absolute;
  top: 70%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  text-align: center;
  z-index: 10;
  width: 90%;
  max-width: 1000px;
  margin: 0 auto;
  animation: fadeInUp 1s ease-out 0.5s both;
}

.hero-overlay-title {
  font-size: 4.5rem;
  font-weight: 900;
  font-family: 'Tajawal', Arial, Helvetica, sans-serif;
  color: #C8A041;
  margin: 0 auto 1.5rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  line-height: 1.2;
  text-align: center;
}

.hero-overlay-subtitle {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: 'Tajawal', Arial, Helvetica, sans-serif;
  color: #0A0F3C;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
  margin: 0 auto;
  line-height: 1.4;
  text-align: center;
}

/* Responsive Hero Text */
@media (max-width: 991px) {
  .hero-overlay-title {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
  }
  
  .hero-overlay-subtitle {
    font-size: 1.75rem;
  }
}

@media (max-width: 767px) {
  .hero-overlay-title {
    font-size: 2.75rem;
    margin-bottom: 1rem;
  }
  
  .hero-overlay-subtitle {
    font-size: 1.5rem;
  }
}

@media (max-width: 575px) {
  .hero-text-overlay {
    width: 95%;
  }
  
  .hero-overlay-title {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }
  
  .hero-overlay-subtitle {
    font-size: 1.25rem;
  }
}

/* ===================================
   Carousel Caption Custom Styles
   =================================== */

.carousel-caption-custom {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 12;
  text-align: center;
  width: 90%;
  max-width: 1200px;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

.slide-title {
  font-size: 4.5rem;
  font-weight: 900;
  font-family: 'Tajawal', Arial, Helvetica, sans-serif;
  color: #C8A041;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  margin-bottom: 1rem;
  letter-spacing: 2px;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.slide-subtitle {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: 'Tajawal', Arial, Helvetica, sans-serif;
  color: #0A0F3C;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
  margin: 0;
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.6s ease-in-out 0.2s;
}

/* Show text when slide is active */
.carousel-item.active .slide-title,
.carousel-item.active .slide-subtitle {
  opacity: 1;
}

/* Responsive Styles */
@media (max-width: 1200px) {
  .carousel-caption-custom {
    top: 56%;
  }
  
  .slide-title {
    font-size: 3rem;
  }
  
  .slide-subtitle {
    font-size: 1.6rem;
  }
}

@media (max-width: 992px) {
  .carousel-caption-custom {
    top: 50%;
  }
  
  .slide-title {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
  }
  
  .slide-subtitle {
    font-size: 1.4rem;
  }
}

@media (max-width: 768px) {
  .carousel-caption-custom {
    top: 48%;
    width: 95%;
  }
  
  .slide-title {
    font-size: 2rem;
    letter-spacing: 1px;
  }
  
  .slide-subtitle {
    font-size: 1.2rem;
  }
}

@media (max-width: 576px) {
  .carousel-caption-custom {
    top: 50%;
  }
  
  .slide-title {
    font-size: 1.6rem;
    margin-bottom: 0.6rem;
  }
  
  .slide-subtitle {
    font-size: 1rem;
  }
}


/* ===================================
   Fix Stability Across All Screen Sizes
   =================================== */

/* Large Screens */
@media (min-width: 1920px) {
  .hero-carousel-section {
    height: 100vh;
    max-height: 1080px;
  }
  
  .logo-overlay {
    top: 38%;
  }
  
  .carousel-caption-custom {
    top: 60%;
  }
}

/* Medium to Large Screens */
@media (min-width: 1400px) and (max-width: 1919px) {
  .hero-carousel-section {
    height: 100vh;
  }
  
  .logo-overlay {
    top: 36%;
  }
  
  .carousel-caption-custom {
    top: 58%;
  }
}

/* Tablets in Portrait */
@media (min-width: 768px) and (max-width: 991px) and (orientation: portrait) {
  .hero-carousel-section {
    height: 70vh;
    min-height: 500px;
  }
  
  .logo-overlay {
    top: 32%;
  }
  
  .carousel-caption-custom {
    top: 52%;
  }
}

/* Small Phones */
@media (max-width: 375px) {
  .hero-carousel-section {
    height: 100vh;
    min-height: 600px;
  }
  
  .logo-overlay {
    top: 35%;
  }
  
  .logo-img {
    max-width: 90px;
  }
  
  .carousel-caption-custom {
    top: 52%;
    width: 95%;
  }
  
  .slide-title {
    font-size: 1.1rem;
  }
  
  .slide-subtitle {
    font-size: 0.8rem;
  }
}

/* Very Tall Screens (Portrait) */
@media (min-height: 900px) and (orientation: portrait) {
  .hero-carousel-section {
    height: 70vh;
  }
  
  .logo-overlay {
    top: 30%;
  }
  
  .carousel-caption-custom {
    top: 48%;
  }
}

/* Short Screens */
@media (max-height: 500px) {
  .hero-carousel-section {
    height: 100vh;
    min-height: 450px;
  }
  
  .logo-overlay {
    top: 28%;
  }
  
  .logo-img {
    max-width: 70px;
  }
  
  .carousel-caption-custom {
    top: 52%;
  }
  
  .slide-title {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
  }
  
  .slide-subtitle {
    font-size: 0.85rem;
  }
}
