/* ========================================
   Gallery Section
   ======================================== */

.photo-gallery {
  padding: 20px 20px 0 20px;
  overflow-y: auto;
  width: 100%;
  color: #ffffff;
  border: none;
  outline: none;
  margin-bottom: 0;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 0;
  position: relative;
}

body.front-page .gallery-header h3 {
  text-align: left;
  margin: 0;
  color: #ffffff;
  font-family: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  font-size: 22px;
  padding-bottom: 0;
}

.gallery-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-controls {
  display: flex;
  gap: 10px;
}

.sort-dropdown {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-size: 12px;
  font-weight: normal;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  outline: none;
  min-width: 120px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255, 255, 255, 0.9)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  transform: none;
}

.sort-dropdown:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: none;
}

.sort-dropdown:focus {
  border-color: rgba(0, 122, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.sort-dropdown option {
  background: #1b1e46;
  color: white;
  padding: 8px;
}

.delete-all-btn {
  padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-all-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.delete-all-btn:active {
  transform: translateY(0);
}

.delete-all-btn svg {
  width: 16px;
  height: 16px;
}

/* Gallery Container */
.gallery-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
  padding-bottom: 0;
  margin-bottom: 0;
  border: none;
  outline: none;
}

/* Photo Items */
.photo-item {
  position: relative;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  width: 100%;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.photo-item:hover {
  transform: scale(1.05);
}

.photo-item img {
  width: 100%;
  height: auto;
  display: block;
}

.photo-item-img {
  cursor: pointer;
}

.photo-item .delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255, 0, 0, 0.8);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Photo Info Display */
.photo-info {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 10;
}



/* No Photos Message */
.no-photos-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  width: 100%;
  min-height: 60vh;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.no-photos-icon {
  font-size: 48px;
  margin-bottom: 20px;
  opacity: 0.7;
}

.no-photos-text {
  font-size: 18px;
  font-weight: normal;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.8);
}

.no-photos-subtext {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.4;
}

/* Gallery Note (注釈) */
.gallery-note {
  display: block;
  width: 100%;
  color: #ccc;
  font-family: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  margin-top: 5px;
  text-align: left;
  white-space: normal;
  order: 3;
  /* スマホでは最後に表示（改行される） */
  margin-left: 2px;
  font-size: 11px;
  /* スマホ用フォントサイズ縮小 */
}

/* レスポンシブ改行タグ */
.responsive-br {
  display: inline;
}

/* スマホ表示時の順序制御 */
@media (max-width: 767px) {
  .gallery-header h3 {
    order: 1;
  }

  .gallery-controls {
    order: 2;
  }
}

@media (min-width: 768px) {
  .gallery-note {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 4px;
    width: auto;
    margin-top: 0;
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
    text-align: center;
    text-align: center;
    order: unset;
  }

  .responsive-br {
    display: none;
    /* PCでは改行しない */
  }
}