/* ═══════════════════════════════════════════════
   Premium 3D Image Lightbox Gallery — Responsive
   ═══════════════════════════════════════════════ */

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }
}

/* Gallery Item */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  height: 280px;
  background: linear-gradient(135deg, rgba(0,119,182,0.1), rgba(72,202,228,0.1));
  border: 1px solid rgba(72,202,228,0.3);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
  transform-style: preserve-3d;
  will-change: transform, box-shadow;
}

@media (max-width: 480px) {
  .gallery-item {
    height: 200px;
  }
}

.gallery-item:hover {
  transform: translateY(-12px) scale(1.02) rotateX(2deg);
  box-shadow: 0 30px 60px rgba(0, 119, 182, 0.4), 0 0 40px rgba(72, 202, 228, 0.25);
  border-color: rgba(72,202,228,0.6);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.5s ease;
  filter: brightness(0.9) contrast(1.1);
}

.gallery-item:hover img {
  transform: scale(1.1) rotate(2deg);
  filter: brightness(1.1) contrast(1.2);
}

/* Gallery Overlay */
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.3), rgba(0,119,182,0.4));
  opacity: 0;
  transition: opacity 0.4s ease;
  display: flex;
  align-items: flex-end;
  padding: 1.5rem;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-label {
  color: white;
  font-size: 1rem;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.gallery-view-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.95);
  color: #0077b6;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.4s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  font-size: 1.5rem;
}

.gallery-item:hover .gallery-view-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.gallery-view-btn:hover {
  background: white;
  transform: translate(-50%, -50%) scale(1.25);
  box-shadow: 0 12px 32px rgba(0,119,182,0.5);
}

/* ═══ LIGHTBOX MODAL ═══ */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(8px);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: fadeIn 0.4s ease;
}

.lightbox-overlay.active {
  display: flex;
  opacity: 1;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 1rem;
  position: relative;
}

/* Lightbox Content */
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: slideUp 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,119,182,0.5), 0 0 60px rgba(72,202,228,0.3);
  object-fit: contain;
}

@media (max-width: 768px) {
  .lightbox-content {
    max-width: 95vw;
    max-height: 85vh;
  }
  
  .lightbox-image {
    border-radius: 8px;
  }
}

/* Lightbox Controls */
.lightbox-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.lightbox-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(72,202,228,0.5);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  backdrop-filter: blur(10px);
}

.lightbox-btn:hover {
  background: rgba(72,202,228,0.2);
  border-color: rgba(72,202,228,0.8);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(72,202,228,0.3);
}

.lightbox-btn:active {
  transform: translateY(0);
}

/* Close Button */
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(72,202,228,0.5);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(10px);
}

.lightbox-close:hover {
  background: rgba(255,50,50,0.3);
  border-color: rgba(255,100,100,0.8);
  transform: rotate(90deg) scale(1.1);
}

/* Navigation Arrows */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(72,202,228,0.5);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10001;
  backdrop-filter: blur(10px);
}

.lightbox-nav:hover {
  background: rgba(72,202,228,0.3);
  border-color: rgba(72,202,228,0.8);
  transform: translateY(-50%) scale(1.15);
}

.lightbox-nav-prev {
  left: 1rem;
}

.lightbox-nav-next {
  right: 1rem;
}

@media (max-width: 768px) {
  .lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .lightbox-nav-prev {
    left: 0.5rem;
  }
  
  .lightbox-nav-next {
    right: 0.5rem;
  }
}

/* Image Info */
.lightbox-info {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(72,202,228,0.5);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 50px;
  backdrop-filter: blur(10px);
  text-align: center;
  max-width: 90%;
  z-index: 10001;
}

.lightbox-info-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

.lightbox-info-count {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}

/* ═══ PHONE MOCKUP ═══ */
.phone-mockup-container {
  position: relative;
  display: inline-block;
  width: 340px;
  height: 680px;
  perspective: 1200px;
}

.phone-mockup {
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 30%, #2a2a2a, #0a0a0a);
  border-radius: 60px;
  padding: 14px;
  box-shadow: 
    0 0 40px rgba(0,0,0,0.8),
    inset 0 0 40px rgba(0,0,0,0.5),
    -20px 0 60px rgba(0,0,0,0.5);
  transform: rotateY(-15deg) rotateX(5deg);
  transition: transform 0.6s ease;
}

.phone-mockup:hover {
  transform: rotateY(-8deg) rotateX(2deg);
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 28px;
  background: #0a0a0a;
  border-radius: 0 0 30px 30px;
  z-index: 10;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.phone-home-indicator {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  background: #0a0a0a;
  border-radius: 2px;
  z-index: 10;
}

/* Phone reflection effect */
.phone-reflection {
  position: absolute;
  bottom: -60px;
  left: 0;
  width: 100%;
  height: 60px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
  border-radius: 0 0 30px 30px;
  opacity: 0.5;
  filter: blur(8px);
}

/* ═══ ANDROID DEVICE MOCKUP ═══ */
.android-device {
  position: relative;
  display: inline-block;
  width: 360px;
  height: 720px;
  perspective: 1200px;
  margin: 0 auto;
}

.android-frame {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
  border-radius: 40px;
  padding: 12px;
  box-shadow: 
    0 20px 60px rgba(0,0,0,0.9),
    inset 0 0 20px rgba(255,255,255,0.1),
    -15px 0 50px rgba(0,0,0,0.7);
  transform: rotateY(12deg) rotateX(-5deg);
  transition: transform 0.6s ease;
}

.android-frame:hover {
  transform: rotateY(8deg) rotateX(-3deg);
}

.android-display {
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 36px;
  overflow: hidden;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.15);
}

.android-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.android-camera {
  position: absolute;
  top: 8px;
  right: 15px;
  width: 30px;
  height: 30px;
  background: radial-gradient(circle at 30% 30%, #333, #111);
  border-radius: 50%;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

.android-camera::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: radial-gradient(circle at 30% 30%, #222, #000);
  border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
}

.android-speaker {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 6px;
  background: #111;
  border-radius: 3px;
  z-index: 10;
}

.android-buttons {
  position: absolute;
  right: -4px;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.android-btn {
  width: 4px;
  height: 40px;
  background: #333;
  border-radius: 2px;
  box-shadow: -2px 2px 4px rgba(0,0,0,0.5);
}

.android-reflection {
  position: absolute;
  bottom: -80px;
  left: 0;
  width: 100%;
  height: 80px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, transparent 100%);
  border-radius: 0 0 40px 40px;
  opacity: 0.6;
  filter: blur(12px);
}

/* ═══ RESPONSIVE ADJUSTMENTS ═══ */
@media (max-width: 1024px) {
  .phone-mockup-container {
    width: 280px;
    height: 560px;
  }
  
  .android-device {
    width: 300px;
    height: 600px;
  }
}

@media (max-width: 768px) {
  .phone-mockup-container {
    width: 220px;
    height: 440px;
  }
  
  .android-device {
    width: 240px;
    height: 480px;
  }
  
  .lightbox-nav {
    display: none;
  }
  
  .lightbox-overlay {
    padding: 0.5rem;
  }
}

/* ═══ LOADING ANIMATION ═══ */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.gallery-item.loading {
  background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ═══ ACCESSIBILITY ═══ */
.gallery-item:focus-visible,
.lightbox-btn:focus-visible,
.lightbox-close:focus-visible {
  outline: 2px solid #48cae4;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
