/* Modern Mobile AI Services Carousel with 3D Effects */
/* ================================================== */

@media screen and (max-width: 991px) {
  /* Services section perspective for 3D */
  #services {
    perspective: 1200px;
    overflow: visible;
    position: relative;
  }

  /* Carousel wrapper with depth */
  .services-carousel-wrapper {
    position: relative;
    padding: 20px 0 40px 0;
    margin: 0 -20px;
  }

  /* Enhanced carousel container */
  .services-grid {
    display: flex !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    gap: 20px !important;
    padding: 40px 20px !important;
    margin: 0 !important;
    position: relative;
    transform-style: preserve-3d;
  }

  /* Hide scrollbar */
  .services-grid::-webkit-scrollbar {
    display: none !important;
  }

  /* Modern card with 3D floating effect */
  .service-card {
    flex: 0 0 85% !important;
    max-width: 85% !important;
    scroll-snap-align: center !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 420px !important;
    padding: 30px 25px !important;
    background: linear-gradient(135deg, 
      rgba(255, 255, 255, 0.95) 0%, 
      rgba(249, 250, 251, 0.95) 100%) !important;
    border-radius: 20px !important;
    box-shadow: 
      0 10px 40px rgba(0, 0, 0, 0.08),
      0 2px 10px rgba(0, 0, 0, 0.05) !important;
    transform: scale(0.9) translateZ(-50px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid rgba(255, 76, 96, 0.1) !important;
    position: relative;
    overflow: visible;
  }

  /* Active/center card - floating effect */
  .service-card.active {
    transform: scale(1) translateZ(0) translateY(-10px) !important;
    box-shadow: 
      0 20px 60px rgba(255, 76, 96, 0.2),
      0 15px 40px rgba(0, 0, 0, 0.1),
      0 5px 20px rgba(255, 76, 96, 0.1) !important;
    background: linear-gradient(135deg, 
      rgba(255, 255, 255, 1) 0%, 
      rgba(249, 250, 251, 1) 100%) !important;
    border-color: rgba(255, 76, 96, 0.3) !important;
  }


  /* First and last card spacing */
  .service-card:first-child {
    margin-left: calc((100% - 85%) / 2) !important;
  }

  .service-card:last-child {
    margin-right: calc((100% - 85%) / 2) !important;
  }

  /* Modern arrow navigation */
  .carousel-nav-arrow {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 50px !important;
    height: 50px !important;
    background: linear-gradient(135deg, #ff4c60 0%, #ff6b7a 100%) !important;
    border: none !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 100 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 
      0 4px 15px rgba(255, 76, 96, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.1) !important;
    color: white !important;
    font-size: 18px !important;
    opacity: 0.9 !important;
  }

  .carousel-nav-arrow:hover {
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 
      0 6px 25px rgba(255, 76, 96, 0.4),
      0 4px 12px rgba(0, 0, 0, 0.15) !important;
    opacity: 1 !important;
  }

  .carousel-nav-arrow:active {
    transform: translateY(-50%) scale(0.95) !important;
  }

  .carousel-nav-arrow.prev {
    left: 10px !important;
    background: linear-gradient(135deg, #ff4c60 0%, #ff7a8a 100%) !important;
  }

  .carousel-nav-arrow.next {
    right: 10px !important;
    background: linear-gradient(135deg, #ff6b7a 0%, #ff4c60 100%) !important;
  }

  /* Arrow icons with animation */
  .carousel-nav-arrow i {
    transition: transform 0.3s ease;
  }

  .carousel-nav-arrow:hover i {
    transform: translateX(-2px);
  }

  .carousel-nav-arrow.next:hover i {
    transform: translateX(2px);
  }

  /* Enhanced carousel indicators */
  .carousel-indicators {
    display: flex !important;
    justify-content: center;
    gap: 12px;
    margin-top: 30px;
    padding-bottom: 20px;
    position: relative;
    z-index: 10;
  }

  .carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 76, 96, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
  }

  .carousel-dot:hover {
    background: rgba(255, 76, 96, 0.4);
    transform: scale(1.2);
  }

  .carousel-dot.active {
    width: 32px;
    border-radius: 16px;
    background: linear-gradient(135deg, #ff4c60 0%, #ff6b7a 100%);
    border-color: rgba(255, 76, 96, 0.2);
    box-shadow: 0 2px 10px rgba(255, 76, 96, 0.3);
  }

  .carousel-dot.active::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 20px;
    background: radial-gradient(circle, 
      rgba(255, 76, 96, 0.2) 0%, 
      transparent 70%);
    animation: pulse 2s ease-in-out infinite;
  }

  @keyframes pulse {
    0%, 100% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
  }

  /* Modern navigation hints */
  .carousel-nav-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 20px;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.3s;
  }

  @keyframes fadeInUp {
    from { 
      opacity: 0; 
      transform: translateY(20px); 
    }
    to { 
      opacity: 1; 
      transform: translateY(0); 
    }
  }

  .swipe-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #ff4c60;
    font-weight: 500;
    background: rgba(255, 76, 96, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 76, 96, 0.2);
  }

  .swipe-hint i {
    font-size: 18px;
    animation: swipeIcon 2s ease-in-out infinite;
  }

  @keyframes swipeIcon {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
  }

  /* Card counter with modern style */
  .card-counter {
    font-size: 14px;
    color: #ff6b7a;
    font-weight: 600;
    background: linear-gradient(135deg, 
      rgba(255, 76, 96, 0.1) 0%, 
      rgba(255, 107, 122, 0.05) 100%);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 76, 96, 0.2);
  }

  .card-counter .current-card {
    font-size: 16px;
    color: #ff4c60;
    font-weight: 700;
  }

  /* Dark mode enhancements */
  [data-theme="dark"] .service-card {
    background: linear-gradient(135deg, 
      rgba(22, 22, 31, 0.95) 0%, 
      rgba(30, 30, 41, 0.95) 100%) !important;
    border-color: rgba(255, 76, 96, 0.2) !important;
    box-shadow: 
      0 10px 40px rgba(0, 0, 0, 0.3),
      0 2px 10px rgba(255, 76, 96, 0.1) !important;
  }

  [data-theme="dark"] .service-card.active {
    background: linear-gradient(135deg, 
      rgba(22, 22, 31, 1) 0%, 
      rgba(30, 30, 41, 1) 100%) !important;
    box-shadow: 
      0 20px 60px rgba(255, 76, 96, 0.3),
      0 15px 40px rgba(0, 0, 0, 0.4),
      0 5px 20px rgba(255, 76, 96, 0.2),
      inset 0 1px 0 rgba(255, 76, 96, 0.2) !important;
    border-color: rgba(255, 76, 96, 0.4) !important;
  }


  [data-theme="dark"] .carousel-nav-arrow {
    background: linear-gradient(135deg, #ff7a8a 0%, #ff4c60 100%) !important;
    box-shadow: 
      0 4px 15px rgba(255, 107, 122, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.2) !important;
  }

  [data-theme="dark"] .swipe-hint {
    background: rgba(255, 76, 96, 0.15);
    border-color: rgba(255, 76, 96, 0.3);
    color: #ff7a8a;
  }

  [data-theme="dark"] .card-counter {
    background: linear-gradient(135deg, 
      rgba(255, 76, 96, 0.15) 0%, 
      rgba(255, 107, 122, 0.08) 100%);
    border-color: rgba(255, 76, 96, 0.3);
    color: #ff7a8a;
  }

  [data-theme="dark"] .carousel-dot {
    background: rgba(255, 76, 96, 0.3);
  }

  [data-theme="dark"] .carousel-dot.active {
    background: linear-gradient(135deg, #ff7a8a 0%, #ff4c60 100%);
    border-color: rgba(255, 107, 122, 0.3);
    box-shadow: 0 2px 15px rgba(255, 107, 122, 0.4);
  }

  /* Touch feedback */
  .service-card:active {
    transform: scale(0.88) translateZ(-60px) !important;
    transition: transform 0.1s ease !important;
  }

  .service-card.active:active {
    transform: scale(0.98) translateZ(0) translateY(-10px) !important;
  }

  /* Performance optimizations */
  @media (prefers-reduced-motion: reduce) {
    .service-card,
    .carousel-nav-arrow,
    .carousel-dot {
      animation: none !important;
      transition: opacity 0.3s ease !important;
    }

    .service-card.active::before {
      animation: none !important;
    }
  }

  /* Small mobile adjustments */
  @media screen and (max-width: 576px) {
    .service-card {
      flex: 0 0 90% !important;
      max-width: 90% !important;
      min-height: 400px !important;
      padding: 25px 20px !important;
    }

    .service-card:first-child {
      margin-left: 5% !important;
    }

    .service-card:last-child {
      margin-right: 5% !important;
    }

    .carousel-nav-arrow {
      width: 44px !important;
      height: 44px !important;
      font-size: 16px !important;
    }

    .carousel-nav-hint {
      flex-direction: column;
      gap: 10px;
      align-items: stretch;
    }

    .swipe-hint,
    .card-counter {
      justify-content: center;
      text-align: center;
    }
  }

  /* Landscape adjustments */
  @media screen and (max-width: 991px) and (orientation: landscape) {
    .service-card {
      min-height: 320px !important;
      flex: 0 0 70% !important;
      max-width: 70% !important;
    }

    .service-card:first-child {
      margin-left: 15% !important;
    }

    .service-card:last-child {
      margin-right: 15% !important;
    }
  }
}

/* Hide arrows on very small screens */
@media screen and (max-width: 400px) {
  .carousel-nav-arrow {
    width: 40px !important;
    height: 40px !important;
    font-size: 14px !important;
  }

  .carousel-nav-arrow.prev {
    left: 5px !important;
  }

  .carousel-nav-arrow.next {
    right: 5px !important;
  }
}

/* Desktop - keep original grid */
@media screen and (min-width: 992px) {
  .carousel-indicators,
  .carousel-nav-hint,
  .carousel-nav-arrow,
  .services-carousel-wrapper {
    display: none !important;
  }
}