/* Kayan Al Khalij - Professional Fixes and Enhancements */
/* Version: 1.0.0 - Complete Optimization */

/* ===== MOBILE MENU IMPROVEMENTS ===== */
@media (max-width: 768px) {
  /* Ensure mobile menu is properly positioned */
  .main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .nav-flex {
    position: relative;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    background: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 1rem;
    flex-direction: column;
    gap: 0;
    z-index: 1001;
    animation: slideDown 0.3s ease;
  }

  .main-nav.mobile-active {
    display: flex;
  }

  .main-nav a {
    width: 100%;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    justify-content: flex-start;
  }

  .main-nav a:last-child {
    border-bottom: none;
  }

  .mobile-menu-btn {
    display: flex;
    z-index: 1002;
  }

  /* Top bar responsive */
  .top-bar .container {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .top-bar-right {
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
  }

  .top-bar-item {
    flex: 1 1 auto;
    min-width: 140px;
  }

  .working-hours {
    font-size: 0.7rem;
    text-align: center;
    width: 100%;
  }

  .lang-switcher {
    order: -1;
  }
}

@media (min-width: 769px) {
  .main-nav {
    display: flex !important;
  }

  .mobile-menu-btn {
    display: none !important;
  }
}

/* ===== ANIMATION KEYFRAMES ===== */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ===== IMPROVED TOUCH TARGETS FOR MOBILE ===== */
@media (max-width: 768px) {
  .btn,
  button,
  a {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .main-nav a {
    min-height: 48px;
    padding: 0.75rem 1rem;
  }
}

/* ===== HERO SECTION FIX ===== */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.hero-bg img.active {
  opacity: 1;
}

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

.intro-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.intro-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  margin-bottom: 2rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.intro-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .hero {
    min-height: 50vh;
  }

  .intro-content {
    padding: 1rem;
  }

  .intro-actions {
    flex-direction: column;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  .intro-actions .btn {
    width: 100%;
  }
}

/* ===== CAROUSEL FIX ===== */
.showcase-carousel-section {
  padding: 3rem 0;
  background: #f8f9fa;
}

.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease;
}

.carousel-slide {
  min-width: 100%;
  position: relative;
}

.carousel-slide img {
  width: 100%;
  height: 500px;
  object-fit: cover;
}

.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: white;
}

.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.carousel-control:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
}

.carousel-control.prev {
  right: 20px;
}

.carousel-control.next {
  left: 20px;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0;
}

.carousel-dots button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-dots button[aria-selected="true"] {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

@media (max-width: 768px) {
  .carousel-slide img {
    height: 300px;
  }

  .carousel-caption {
    padding: 1rem;
  }

  .carousel-caption h3 {
    font-size: 1.2rem;
  }

  .carousel-caption p {
    font-size: 0.9rem;
  }

  .carousel-control {
    width: 40px;
    height: 40px;
  }
}

/* ===== STATS SECTION FIX ===== */
.stats-section {
  padding: 4rem 0;
  background: var(--gradient-primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.stat-item {
  text-align: center;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-5px);
}

.stat-icon {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .stat-item {
    padding: 1.5rem 1rem;
  }

  .stat-number {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== SERVICES SECTION FIX ===== */
.services-section {
  padding: 4rem 0;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.service-card {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color);
}

.service-icon {
  width: 60px;
  height: 60px;
  background: var(--gradient-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.8rem;
  color: white;
}

.service-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.service-card p {
  color: var(--text-secondary);
  line-height: 1.6;
}

@media (max-width: 768px) {
  .services-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ===== TESTIMONIALS SECTION FIX ===== */
.testimonials-section {
  padding: 4rem 0;
  background: #f8f9fa;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.testimonial-card {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.testimonial-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.rating-stars {
  color: #ffc107;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.testimonial-card p {
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.testimonial-author {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.testimonial-author strong {
  color: var(--text-primary);
  font-weight: 600;
}

.testimonial-author span {
  color: var(--text-light);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .testimonials-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== FOOTER FIX ===== */
.footer {
  background: var(--secondary-color);
  color: white;
  padding: 3rem 0 1rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-logo-block {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.footer-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.footer ul {
  list-style: none;
  padding: 0;
}

.footer ul li {
  margin-bottom: 0.75rem;
}

.footer a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer a:hover {
  color: var(--primary-color);
}

.footer-socials {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-socials a {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

.footer-socials a:hover {
  background: var(--primary-color);
  transform: translateY(-3px);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-logo-block {
    flex-direction: column;
    align-items: center;
  }

  .footer-socials {
    justify-content: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== BACK TO TOP BUTTON FIX ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

/* ===== FORM IMPROVEMENTS ===== */
.contact-form,
.testimonial-form,
.comment-form {
  max-width: 600px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.1);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

/* ===== WHATSAPP WIDGET FIX ===== */
.whatsapp-widget {
  position: fixed;
  bottom: 100px;
  right: 2rem;
  width: 350px;
  max-height: 500px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.whatsapp-widget.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.whatsapp-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  background: #25d366;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  z-index: 1001;
}

.whatsapp-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .whatsapp-widget {
    width: calc(100% - 2rem);
    right: 1rem;
    bottom: 90px;
  }

  .whatsapp-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 55px;
    height: 55px;
  }

  .back-to-top {
    bottom: 1rem;
    left: 1rem;
    width: 45px;
    height: 45px;
  }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 0 0 4px 0;
  z-index: 10000;
}

.skip-link:focus {
  top: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ===== DARK MODE SUPPORT ===== */
body.dark-mode {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --border-color: #404040;
}

body.dark-mode .main-header,
body.dark-mode .top-bar {
  background: #2d2d2d;
  border-color: #404040;
}

body.dark-mode .service-card,
body.dark-mode .testimonial-card,
body.dark-mode .product-card,
body.dark-mode .project-card {
  background: #2d2d2d;
  border-color: #404040;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Smooth font rendering */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hardware acceleration for animations */
.service-card,
.testimonial-card,
.product-card,
.project-card,
.carousel-control,
.whatsapp-toggle,
.back-to-top {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}
