/* ========================================
   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;
}

/* 全てZIP保存ボタン（ゴミ箱ボタンと同テイスト） */
.save-all-zip-btn {
  padding: 6px 12px;
  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: 16px;
  height: 32px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-family: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
}

.save-all-zip-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);
}

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

.save-all-zip-btn .material-icons {
  font-size: 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;
}

.video-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.36));
  pointer-events: none;
}

.video-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 7px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
}

.video-badge .material-icons {
  font-size: 14px;
}

.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;
}

.goods-sales-panel {
  margin: 0 0 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.goods-sales-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.goods-sales-header h4 {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

.goods-sales-header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.goods-sales-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.goods-sales-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  min-height: 120px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.goods-sales-image {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
}

.goods-sales-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.goods-sales-body h5 {
  margin: 0;
  color: #fff;
  font-size: 14px;
  line-height: 1.35;
}

.goods-sales-catch,
.goods-sales-description {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.45;
}

.goods-sales-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.goods-sales-meta {
  margin-top: auto;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.goods-sales-buy {
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: #00a66a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.goods-sales-buy:disabled {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.54);
  cursor: not-allowed;
}

.sc-reaccess-panel {
  width: min(720px, calc(100% - 32px));
  margin: 20px auto;
  padding: 18px;
  color: #1f2937;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  box-sizing: border-box;
}

.sc-reaccess-head h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.sc-reaccess-head p,
.sc-reaccess-pwa,
.sc-reaccess-status {
  margin: 0;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.6;
}

.sc-reaccess-url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 14px 0;
}

.sc-reaccess-url-row input,
.sc-reaccess-actions input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #111827;
  background: #fff;
  box-sizing: border-box;
}

.sc-reaccess-url-row button,
.sc-reaccess-actions button,
.sc-reaccess-continue {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: #0f766e;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.sc-reaccess-main {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: start;
}

.sc-reaccess-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
}

.sc-reaccess-qr-wrap img {
  width: 160px;
  height: 160px;
}

.sc-reaccess-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sc-reaccess-actions label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
}

.sc-reaccess-status {
  min-height: 20px;
  margin-top: 12px;
}

.sc-reaccess-status[data-status-type="error"] {
  color: #b91c1c;
}

.sc-reaccess-status[data-status-type="ready"] {
  color: #047857;
}

.sc-reaccess-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.sc-reaccess-continue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
}

.sc-reaccess-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 99999;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  color: #fff;
  background: rgba(17, 24, 39, 0.92);
  border-radius: 8px;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sc-reaccess-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 640px) {
  .goods-sales-header {
    display: block;
  }

  .goods-sales-header p {
    margin-top: 4px;
  }

  .goods-sales-card {
    grid-template-columns: 64px 1fr;
  }

  .goods-sales-image {
    width: 64px;
    height: 64px;
  }

  .sc-reaccess-url-row,
  .sc-reaccess-main {
    grid-template-columns: 1fr;
  }

  .sc-reaccess-url-row button {
    width: 100%;
  }
}



/* 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;
}

/* 画像保存時の太字表示 */
.save-only-bold {
  font-weight: bold !important;
}

/* スマホ表示時の順序制御 */
@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では改行しない */
  }
}
