/* --- Photo Integration Styles --- */

/* Photo Marker: 확장형 메모리 카드 스타일 */
.photo-marker {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid #ff7f50;
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease-out;
  position: relative;
  overflow: visible;
  z-index: 100;
}

.photo-marker.is-expanded {
  width: 240px;
  height: 240px;
  border-radius: 20px;
  z-index: 5000;
  cursor: default;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5), 0 0 0 4px rgba(255,127,80,0.3);
}

.marker-controls {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0.2s;
  background: linear-gradient(to bottom, rgba(0,0,0,0.4), transparent 30%, transparent 70%, rgba(0,0,0,0.6));
  border-radius: 20px;
}

.photo-marker.is-expanded .marker-controls {
  opacity: 1;
  pointer-events: auto;
}

.marker-top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.marker-nav-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
}

.marker-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.3);
  transition: all 0.2s;
}

.marker-btn:hover {
  background: white;
  color: #333;
  transform: scale(1.1);
}

.marker-btn.btn-close-card {
  background: rgba(255, 71, 87, 0.3);
  border-color: rgba(255, 71, 87, 0.4);
}

.marker-btn.btn-close-card:hover {
  background: #ff4757;
  color: white;
}

/* 확장 시 아래쪽 포인터 숨기기 */
.photo-marker.is-expanded::after {
  opacity: 0;
}

/* 위치 정보 없는 사진 바구니 */
.photo-bucket {
  border: 4px double white !important;
  box-shadow:
    3px 3px 0 rgba(255,255,255,0.3),
    6px 6px 0 rgba(255,255,255,0.1),
    0 8px 16px rgba(0,0,0,0.5) !important;
}

/* 아래쪽 포인터 삼각형 */
.photo-marker::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 15px solid #ff7f50;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.2));
}

/* 비콘(맥박) 애니메이션 */
.photo-marker::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  opacity: 0;
  animation: photo-beacon 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

.photo-marker:hover {
  transform: translateY(-8px) scale(1.15);
  z-index: 5000 !important;
  filter: brightness(1.1);
  box-shadow: 0 15px 30px rgba(0,0,0,0.4);
}

/* 로딩 스피너 */
.photo-marker.is-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #ff7f50;
  animation: marker-spin 0.8s linear infinite;
  z-index: 5;
}

@keyframes marker-spin {
  to { transform: rotate(360deg); }
}

/* 확장 상태에서 스피너 형태 조정 */
.photo-marker.is-expanded.is-loading::before {
  border-radius: 20px;
}

/* Lightbox Modal */
#modal-lightbox {
  display: flex;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#modal-lightbox:not(.hidden) {
  opacity: 1 !important;
  pointer-events: auto;
}

.lightbox-content img {
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#modal-lightbox:not(.hidden) .lightbox-content img {
  transform: scale(1);
}

/* Photo Floating Button in Detail View */
#btn-upload-photo {
  transition: all 0.3s;
}

#btn-upload-photo:hover {
  background: rgba(0,255,136,0.2) !important;
  transform: translateY(-1px);
}

/* Gallery Section Styles */
.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  padding: 8px;
}

.gallery-item {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  background-color: rgba(255,255,255,0.05);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 1.5px solid var(--glass-border);
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.gallery-item:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: var(--color-primary);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  z-index: 10;
}

.gallery-item .item-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  right: auto !important;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 1px solid rgba(255,255,255,0.2);
}

.gallery-empty-state {
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
  background: rgba(255,255,255,0.02);
  border-radius: 16px;
  border: 1px dashed var(--glass-border);
  color: var(--text-muted);
  font-size: 14px;
}

/* 사진 묶음 숫자 뱃지 */
.stack-count-badge {
  position: absolute;
  top: -12px;
  right: -12px;
  background: #ff7f50;
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  border: 2.5px solid white;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 10;
}

/* 지도 미리보기 팝업 */
.map-preview-popup {
  padding: 10px;
  text-align: center;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: white;
}

.popup-img-container {
  width: 100%;
  height: 140px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  background-color: #f0f0f0;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
  transition: opacity 0.3s ease;
}

.popup-img-container.loaded {
  background-color: transparent;
}

.popup-info-text {
  margin: 0;
  font-weight: 700;
  color: #ff7f50;
  font-size: 14px;
}

.popup-btn {
  width: 100% !important;
  margin: 0 !important;
  padding: 10px 0 !important;
  font-size: 14px !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* Google Maps InfoWindow 커스텀 */
.gm-style-iw {
  padding: 0 !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3) !important;
}

.gm-style-iw-d {
  overflow: hidden !important;
  padding: 0 !important;
}

.gm-style-iw-tc::after {
  background: rgba(255, 255, 255, 0.95) !important;
}

/* Map Distance Labels */
.distance-label {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 50;
  text-align: center;
}

/* AI Optimization Preview */
.ai-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  transition: transform 0.2s;
}

.ai-preview-item .index-badge {
  width: 24px;
  height: 24px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.ai-preview-item .place-name {
  font-size: 14px;
  font-weight: 600;
  color: white;
}
