/*-----------------------------------*\
  #MOBILE GALLERY OPTIMIZED
\*-----------------------------------*/

/* Mobile Gallery Styles - Tối ưu cho performance */
.mobile-gallery {
  display: none;
  padding: 40px 0;
  background: var(--smoky-black-2);
  overflow: hidden;
}

@media (max-width: 768px) {
  .mobile-gallery {
    display: block;
  }

  .mobile-gallery-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 0 15px;
  }

  .mobile-gallery-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: var(--gold-crayola);
    margin-bottom: 10px;
    font-family: var(--fontFamily-forum);
  }

  .mobile-gallery-subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    color: var(--quick-silver);
    line-height: 1.5;
  }

  /* Container cho gallery */
  .mobile-gallery-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
  }

  /* Wrapper cho slides */
  .mobile-gallery-wrapper {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
  }

  /* Individual slide */
  .mobile-gallery-slide {
    flex: 0 0 100%;
    padding: 0 10px;
    position: relative;
  }

  /* Image wrapper với aspect ratio */
  .mobile-gallery-image-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 60%; /* 16:10 aspect ratio */
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: var(--smoky-black-3);
  }

  .mobile-gallery-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s ease;
    background: var(--smoky-black-3);
  }

  /* Hover effect */
  .mobile-gallery-slide:active .mobile-gallery-image {
    transform: scale(1.02);
  }

  /* Loading state */
  .mobile-gallery-image[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mobile-gallery-image.loaded {
    opacity: 1;
  }

  /* Navigation */
  .mobile-gallery-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 25px;
    padding: 0 15px;
  }

  /* Navigation buttons */
  .mobile-gallery-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border: 2px solid var(--gold-crayola);
    border-radius: 50%;
    background: transparent;
    color: var(--gold-crayola);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-gallery-btn:hover,
  .mobile-gallery-btn:focus {
    background: var(--gold-crayola);
    color: var(--smoky-black-1);
    transform: scale(1.05);
  }

  .mobile-gallery-btn:active {
    transform: scale(0.95);
  }

  .mobile-gallery-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
  }

  /* Dots pagination */
  .mobile-gallery-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
  }

  .mobile-gallery-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-gallery-dot.active {
    background: var(--gold-crayola);
    transform: scale(1.2);
  }

  .mobile-gallery-dot:hover {
    background: var(--white);
  }

  /* Touch feedback */
  .mobile-gallery-slide {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

  /* Swipe hint */
  .mobile-gallery-hint {
    text-align: center;
    color: var(--quick-silver);
    font-size: 0.8rem;
    margin-top: 15px;
    opacity: 0.7;
    padding: 0 15px;
  }

  /* Performance optimizations */
  .mobile-gallery-wrapper {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  .mobile-gallery-image {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .mobile-gallery-image-wrapper {
    padding-bottom: 65%; /* Slightly taller on very small screens */
    border-radius: 12px;
  }

  .mobile-gallery-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .mobile-gallery-dot {
    width: 8px;
    height: 8px;
  }

  .mobile-gallery-container {
    padding: 0 10px;
  }

  .mobile-gallery-slide {
    padding: 0 5px;
  }
}

/* High DPI displays */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
  .mobile-gallery-image-wrapper {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  }
}

/* Landscape mode on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .mobile-gallery {
    padding: 30px 0;
  }

  .mobile-gallery-image-wrapper {
    padding-bottom: 45%; /* Shorter in landscape */
  }
}
