/* ==================== 📷 사진 메모 미니 앨범 팝업 ==================== */

/* 팝업 배경 오버레이 */
.photo-album-popup {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(4px);
  display: none !important;
  justify-content: center !important;
  align-items: center !important;
  z-index: 10002 !important;
  animation: fadeIn 0.2s ease;
  padding: 20px 0 !important; /* 상하 여백 추가 */
  overflow-y: auto !important; /* 스크롤 가능하게 */
}

.photo-album-popup[style*="display: flex"] {
  display: flex !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 팝업 컨테이너 */
.photo-album-container {
  width: 300px;
  height: 480px;                    /* 전체 높이 살짝 줄이기 */
  max-height: calc(100vh - 32px);   /* 화면 상하 여백도 조금 축소 */
  background: linear-gradient(135deg, #fde68a 0%, #fca5a5 50%, #c4b5fd 100%);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
  padding: 12px;
  box-sizing: border-box;
  margin: auto; /* 자동 센터링 */
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 헤더 */
.photo-album-header {
  position: relative;                 /* 닫기 버튼 절대위치 기준 */
  display: flex;
  justify-content: center;            /* 제목 블록을 항상 중앙에 */
  align-items: flex-start;
  margin-bottom: 8px;                /* 아래 여백 축소 */
  padding-bottom: 6px;               /* 내부 여백 축소 */
  border-bottom: 2px solid rgba(255, 255, 255, 0.5);
}

.photo-album-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;                 /* 다국어 제목 중앙 정렬 */
}

.photo-album-title {
  margin: 0;
  font-size: 20px;              /* 사진메모 제목 조금 더 크게 */
  font-weight: 800;
  color: #4c1d95;               /* 배경과 대비되는 선명한 인디고 계열 */
  text-shadow: 0 2px 4px rgba(255, 255, 255, 0.5);
  letter-spacing: -0.5px;
  white-space: nowrap; /* 사진메모를 한 줄로 유지 */
}

.photo-album-subtitle {
  position: relative;
  flex: 0 0 100%;                    /* 제목 아래 전체 폭 차지 */
  margin-top: 2px;
  overflow: hidden;
  white-space: nowrap;
}

.photo-album-subtitle-inner {
  display: inline-block;
  padding-left: 100%;           /* 오른쪽 밖에서부터 시작 */
  font-size: 15px;
  white-space: nowrap;
  animation: albumSubtitleMarquee 12s linear infinite;
}

.photo-album-subtitle-text {
  /* 파란 → 보라 그라데이션 텍스트 */
  background: linear-gradient(90deg, #1d4ed8, #7c3aed);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  font-weight: 800;
}

.photo-album-subtitle-heart {
  margin-left: 4px;
  font-size: 15px;
}

@keyframes albumSubtitleMarquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.photo-album-close {
  position: absolute;
  top: 2px;       /* 제목과 거의 같은 높이에서 2px 위로 조정 */
  right: 10px;    /* 오른쪽 끝에서 10px 안쪽으로 */
  width: 26px;   /* 기존 32px → 26px로 축소 */
  height: 26px;
  border: none;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border-radius: 50%;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  line-height: 1;
}

.photo-album-close:hover {
  background: rgba(220, 38, 38, 1);
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

/* 검색창 */
.photo-album-search {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  background: rgba(254, 202, 202, 0.6);
  padding: 6px 8px;
  border-radius: 12px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#album-search-input {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 12px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  outline: none;
  transition: border-color 0.2s ease;
}

#album-search-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

#album-search-btn {
  padding: 8px 10px;
  /* 버튼 배경을 밝게, 아이콘은 진한 색으로 */
  background: #ffffff;
  color: #4c1d95; /* 진한 보라색 아이콘 */
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px; /* 돋보기 이모지 조금 더 크게 */
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(76, 29, 149, 0.25);
}

#album-search-clear {
  padding: 3px 6px;
  background: #ef4444;
  border: none;
  color: white;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  align-self: center;
}

#album-search-clear:hover {
  background: #dc2626;
}

#album-search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.4);
}

#album-search-btn:active {
  transform: translateY(0);
}

/* 사진 목록 영역 */
.photo-album-list {
  flex: 1;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 10px;
  overflow-y: auto;
  margin-bottom: 8px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #1e3a8a;
}

.album-section-title {
  font-size: 16px;              /* 기존 14px → 16px로 확대 */
  font-weight: 700;
  color: #0b1120;               /* 하늘색 배경과 대비되는 진한 남색 */
  margin-bottom: 8px;
  padding: 6px 10px;
  background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 100%);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(56, 189, 248, 0.3);
  text-align: center;
}

/* 사진 아이템 */
.photo-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photo-item {
  /* ✅ 기본(1장 카드): 기존 레이아웃 유지 (큰 썸네일 1장 + 오른쪽 정보) */
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
}

.photo-item.menu-open {
  z-index: 50;
}

.photo-item:hover {
  border-color: #8b5cf6;
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

/* ✅ 여러장 카드: 상단 썸네일 스트립 + 하단 제목/날짜/메뉴 */
.photo-item.multi-photos {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

/* ✅ 썸네일 가로 스트립 (최소 4개 보이고, 그 이상은 가로 스크롤) */
.photo-thumb-strip {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
}

.photo-thumb-strip::-webkit-scrollbar {
  height: 6px;
}
.photo-thumb-strip::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.35);
  border-radius: 6px;
}

.photo-thumb {
  width: 50px;              /* 기존 카드 썸네일과 동일 크기 */
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%);
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.photo-thumb.selected {
  outline: 3px solid rgba(29, 78, 216, 0.95);
  outline-offset: -2px;
  box-shadow: 0 6px 18px rgba(29, 78, 216, 0.25);
}

.photo-thumb.placeholder {
  color: rgba(76, 29, 149, 0.7);
  font-weight: 800;
}

/* 하단: 제목/날짜/메뉴 */
.photo-item-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 사진 메뉴 버튼 */
.photo-menu-btn {
  /* ✅ 기본(1장 카드): 카드 오른쪽 아래 고정 */
  position: absolute;
  bottom: 8px;
  right: 8px;
  margin-left: 0;
  padding: 6px 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
}

/* ✅ 여러장 카드: 하단 라인에 자연스럽게 배치 */
.photo-item.multi-photos .photo-menu-btn {
  position: static;
  margin-left: auto;
}

.photo-menu-btn span {
  display: block;
  width: 20px;
  height: 3px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  border-radius: 2px;
  transition: all 0.2s ease;
}

.photo-menu-btn:hover span {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  transform: scaleX(1.1);
}

/* 드롭다운 메뉴 */
.photo-menu-dropdown {
  position: absolute;
  bottom: 40px;           /* 기본: 버튼 위쪽으로 열림 */
  right: 8px;
  background: transparent;
  border: 1px solid #1e3a8a;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 90px;
  z-index: 60;            /* 같은 카드 안에서 항상 위로 */
  display: none;
  overflow: visible;
}

.photo-menu-dropdown.open-down {
  bottom: auto;
  top: 40px;              /* 아래로 열릴 때는 버튼 아래쪽으로 */
}

.photo-menu-dropdown.active {
  display: block;
  animation: menuSlideUp 0.2s ease;
}

.photo-menu-dropdown.open-down.active {
  animation: menuSlideDown 0.2s ease;
}

@keyframes menuSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes menuSlideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.photo-menu-item {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.photo-menu-item:first-child {
  border-radius: 6px 6px 0 0;
  background: rgba(168, 85, 247, 1);
  border: 1px solid #1e3a8a;
  border-bottom: none;
}

.photo-menu-item:nth-child(2) {
  background: rgba(34, 197, 94, 1);
  border-left: 1px solid #1e3a8a;
  border-right: 1px solid #1e3a8a;
}

.photo-menu-item:last-child {
  border-radius: 0 0 6px 6px;
  background: rgba(239, 68, 68, 1);
  border: 1px solid #1e3a8a;
  border-top: none;
}

.photo-menu-item:hover {
  transform: scale(1.05);
  font-weight: 700;
}

.photo-menu-item:first-child:hover {
  background: rgba(126, 34, 206, 1);
  color: white;
}

.photo-menu-item:nth-child(2):hover {
  background: rgba(22, 163, 74, 1);
  color: white;
}

.photo-menu-item:last-child:hover {
  background: rgba(220, 38, 38, 1);
  color: white;
}

/* (호환 유지) 단일 썸네일 구형 클래스도 유지 */
.photo-thumbnail {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%);
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.photo-info {
  flex: 1;
  min-width: 0;
}

.photo-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-date {
  font-size: 11px;
  color: #6b7280;
}

/* 지난 사진메모 보기 */
.photo-album-past {
  display: flex;
  gap: 4px;                 /* 요소 간 기본 간격 */
  align-items: center;
  justify-content: space-between;  /* 왼쪽(라벨~Set)과 오른쪽(X)을 양 끝으로 배치 */
  padding: 8px;             /* 위아래 패딩 살짝 줄이기 */
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  flex-wrap: nowrap;        /* 한 줄로 유지 */
  font-size: 11px;          /* 전체 영역 기본 폰트 조금 축소 */
}

.past-label {
  font-size: 13px;   /* 영어 등 긴 라벨에서 1px 축소 */
  font-weight: 700;
  color: #1f2937;
  white-space: nowrap;
}

.album-select {
  padding: 3px 4px;     /* 셀렉트 박스 폭을 더 줄임 */
  border: 2px solid #d1d5db;
  border-radius: 6px;
  font-size: 11px;
  background: white;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.album-select:focus {
  border-color: #8b5cf6;
}

.album-btn-view {
  padding: 3px 8px;     /* 버튼 폭을 조금 더 줄임 */
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 10px;      /* 한국어에서도 두 줄로 줄바꿈되지 않도록 살짝 축소 */
  font-weight: 600;
  white-space: nowrap;  /* 버튼 텍스트 줄바꿈 방지 */
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.album-btn-view:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.album-btn-reset {
  padding: 3px 6px;     /* X 버튼도 조금 더 컴팩트하게 */
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.album-btn-reset:hover {
  background: #dc2626;
}

/* 스크롤바 스타일 */
.photo-album-list::-webkit-scrollbar {
  width: 6px;
}

.photo-album-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.photo-album-list::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.5);
  border-radius: 3px;
}

.photo-album-list::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.7);
}

/* 빈 상태 메시지 */
.album-empty {
  padding: 40px 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
}

.album-empty-icon {
  font-size: 48px;
  margin-bottom: 10px;
  opacity: 0.5;
}
