/* ========================
   Gallery Page Base
======================== */
.gallery-page {
  background-color: #1a1a1a;
  color: #f0ece6;
}

.gallery-header {
  background: linear-gradient(135deg, rgba(60,100,60,0.9) 0%, rgba(30,70,30,0.9) 100%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 2rem 1.5rem 1.75rem;
  position: relative;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  transition: color 0.2s;
}

.back-btn:hover {
  color: #fff;
}

/* ========================
   Password Gate
======================== */
.gallery-main {
  display: block;
  width: 100%;
  box-sizing: border-box;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.gallery-gate {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50vh;
}

.gate-card {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.gate-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6a9e6a, #3d7a3d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  margin: 0 auto 1.25rem;
  box-shadow: 0 4px 14px rgba(60,120,60,0.4);
}

.gate-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.1rem;
  color: #f0ece6;
  margin-bottom: 0.3rem;
}

.gate-subtitle {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 1.5rem;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gate-input {
  width: 100%;
  padding: 0.65rem 1.1rem;
  border: 1.5px solid #444;
  border-radius: 50px;
  background: #1a1a1a;
  color: #f0ece6;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.gate-input:focus {
  border-color: #6a9e6a;
}

.gate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #6a9e6a, #3d7a3d);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.65rem 1.5rem;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(60,120,60,0.35);
  transition: opacity 0.2s;
}

.gate-btn:hover {
  opacity: 0.9;
}

/* ========================
   Gallery Toolbar
======================== */
.gallery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #2e2e2e;
  gap: 1rem;
  flex-wrap: wrap;
}

.gallery-count {
  font-size: 0.9rem;
  color: #aaa;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gallery-count i {
  color: #6a9e6a;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.collapse-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #888;
  background: none;
  border: 1px solid #444;
  border-radius: 50px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.collapse-all-btn:hover {
  color: #f0ece6;
  border-color: #666;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #888;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid #444;
  border-radius: 50px;
  transition: color 0.2s, border-color 0.2s;
}

.logout-btn:hover {
  color: #f0ece6;
  border-color: #666;
}

/* ========================
   Year Sections (collapsible)
======================== */
.year-section {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 1rem;
  border: 1px solid #333;
  border-radius: 16px;
  background: #181818;
  min-width: 0;
}

.year-header {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #f0ece6;
  font-family: 'Noto Serif JP', serif;
  font-size: 1.15rem;
  font-weight: 700;
  transition: background 0.2s;
  gap: 1rem;
}

.year-header:hover {
  background: rgba(255,255,255,0.03);
}

.year-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  letter-spacing: 0.04em;
}

.year-folder-icon {
  color: #6a9e6a;
  font-size: 1rem;
}

.year-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #666;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 400;
  white-space: nowrap;
}

.year-chevron {
  font-size: 0.85rem;
  transition: transform 0.3s ease;
  color: #555;
}

.year-section.expanded .year-chevron {
  transform: rotate(180deg);
}

.year-body {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 0.75rem 0.75rem;
}

/* ========================
   Month Sections (collapsible)
======================== */
.month-section {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.5rem;
  border: 1px solid #2e2e2e;
  border-radius: 14px;
  background: #1e1e1e;
}

.month-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #f0ece6;
  font-family: 'Noto Serif JP', serif;
  font-size: 1rem;
  transition: background 0.2s;
  gap: 1rem;
}

.month-header:hover {
  background: rgba(255,255,255,0.04);
}

.month-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.month-label i {
  color: #6a9e6a;
  font-size: 0.9rem;
}

.month-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #777;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 400;
  white-space: nowrap;
}

.month-chevron {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  color: #666;
}

.month-section.expanded .month-chevron {
  transform: rotate(180deg);
}

/* ── Collapsible body ── */
.month-body {
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* ========================
   Day Groups
======================== */
.day-group {
  padding: 0.75rem 1rem 0.25rem;
  border-top: 1px solid #2a2a2a;
}

.day-group:first-child {
  border-top: none;
}

.day-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #888;
  margin-bottom: 0.6rem;
  letter-spacing: 0.03em;
}

.day-dot {
  font-size: 0.4rem;
  color: #6a9e6a;
  flex-shrink: 0;
}

.day-count {
  font-size: 0.78rem;
  color: #555;
  margin-left: 0.25rem;
}

/* ========================
   Gallery Grid
======================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  padding: 0 0 0.75rem;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  background: #2a2a2a;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-item:hover img,
.gallery-item:hover video {
  transform: scale(1.05);
}

.video-play-icon {
  font-size: 2rem !important;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}

.is-video .gallery-item-overlay {
  background: rgba(0,0,0,0.25);
  color: rgba(255,255,255,0.85);
}

.is-video:hover .gallery-item-overlay {
  background: rgba(0,0,0,0.45);
  color: #fff;
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: rgba(255,255,255,0);
  transition: background 0.25s, color 0.25s;
  border-radius: 8px;
}

.gallery-item:hover .gallery-item-overlay {
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.9);
}

/* ========================
   Admin UI
======================== */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(220, 80, 80, 0.15);
  color: #e07070;
  border: 1px solid rgba(220, 80, 80, 0.3);
  border-radius: 50px;
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  margin-left: 0.5rem;
}

.admin-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #aaa;
  background: none;
  border: 1px solid #444;
  border-radius: 50px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.admin-select-btn:hover,
.admin-select-btn.active {
  color: #fff;
  border-color: #e07070;
  background: rgba(220, 80, 80, 0.15);
}

.admin-delete-btn {
  display: none;
  align-items: center;
  gap: 0.4rem;
  color: #fff;
  background: linear-gradient(135deg, #e05555, #b03030);
  border: none;
  border-radius: 50px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(200, 50, 50, 0.35);
  transition: opacity 0.2s;
}

.admin-delete-btn:hover { opacity: 0.88; }

/* Checkbox on each item */
.item-checkbox {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.5);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s, border-color 0.2s;
}

.item-checkbox i {
  color: #fff;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.item-checkbox.checked {
  background: #e05555;
  border-color: #e05555;
}

.item-checkbox.checked i { opacity: 1; }

/* Show checkboxes and dim cursor when in select mode */
body.select-mode .item-checkbox {
  display: flex;
}

body.select-mode .gallery-item {
  cursor: pointer;
}

body.select-mode .gallery-item.selected {
  outline: 3px solid #e05555;
  outline-offset: -3px;
}

body.select-mode .gallery-item.selected .gallery-item-overlay {
  background: rgba(220, 50, 50, 0.25);
}

/* ========================
   Day Descriptions
======================== */

/* Displayed text (all users) */
.day-description {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.9rem;
  background: rgba(106, 158, 106, 0.08);
  border-left: 3px solid #6a9e6a;
  border-radius: 0 8px 8px 0;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.88rem;
  color: #bbb;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.day-description.day-description-empty {
  display: none;
}

/* Admin edit form */
.day-desc-form {
  margin: 0 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.desc-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 0.85rem;
  background: #1a1a1a;
  border: 1.5px solid #333;
  border-radius: 10px;
  color: #e0dcd6;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.88rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.desc-textarea:focus {
  border-color: #6a9e6a;
}

.desc-textarea::placeholder {
  color: #555;
}

.desc-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.save-desc-btn,
.clear-desc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  border-radius: 50px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.8rem;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.save-desc-btn {
  background: linear-gradient(135deg, #6a9e6a, #3d7a3d);
  color: #fff;
  box-shadow: 0 2px 8px rgba(60, 120, 60, 0.3);
}

.clear-desc-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #888;
  border: 1px solid #3a3a3a;
}

.save-desc-btn:hover  { opacity: 0.88; }
.clear-desc-btn:hover { opacity: 0.8; color: #bbb; }

/* Status feedback label */
.desc-status {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.78rem;
  margin-left: 0.25rem;
  transition: color 0.2s;
}

.desc-status.saving { color: #888; }
.desc-status.saved  { color: #6a9e6a; }
.desc-status.error  { color: #e07070; }

/* ========================
   Empty State
======================== */
.gallery-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: #666;
}

.gallery-empty i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  color: #444;
}

.gallery-empty p {
  font-size: 0.95rem;
  line-height: 1.8;
}

/* ========================
   Lightbox
======================== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.93);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
}

.lightbox.active {
  display: flex;
}

.lightbox img,
.lightbox video {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.lightbox-caption {
  color: rgba(255,255,255,0.45);
  font-size: 0.78rem;
  text-align: center;
  letter-spacing: 0.03em;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 1001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255,255,255,0.25);
}

.lightbox-close { top: 1.25rem; right: 1.25rem; }
.lightbox-prev  { left: 1.25rem; top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 1.25rem; top: 50%; transform: translateY(-50%); }

/* ========================
   Responsive
======================== */
@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
    padding: 0.5rem 0.75rem 0.75rem;
  }

  .month-header {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
}
