/* ========================================
   Modal Components
   ======================================== */

/* Photo Modal */
.photo-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  margin: 0;
}

.photo-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 85vh;
  /* アクションボタンのスペースを確保 */
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}

/* Navigation Buttons */
.nav-btn {
  position: absolute;
  top: 45%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: normal;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  touch-action: manipulation;
}

.nav-btn:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.prev-btn {
  left: -50px;
  /* より外側に配置 */
}

.next-btn {
  right: -50px;
  /* より外側に配置 */
}

#modalImage,
#modalVideo {
  max-width: 100%;
  max-height: 70vh;
  /* アクションボタンのスペースを確保 */
  border-radius: 5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  object-fit: contain;
  /* アスペクト比を保持 */
  display: block;
}

#modalVideo {
  background: #000;
}

.photo-modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-shrink: 0;
  /* ボタンエリアが縮まないようにする */
  padding: 0 20px;
  /* 左右の余白を確保 */
  width: 100%;
  box-sizing: border-box;
}

.share-btn {
  background: #007AFF;
  color: white;
  border: none;
  padding: 10px 24px;
  /* 2025/09/10 change */
  border-radius: 25px;
  font-size: 16px;
  /* 少し大きく */
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

.share-btn:hover {
  background: #0056CC;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

/* シェアテキストコピーエリア */
.share-text-container {
  position: relative;
  margin-bottom: 15px;
}

.share-text-area {
  width: 300px;
  height: 50px;
  padding: 10px 55px 10px 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: #FFFFFF;
  font-size: 11px;
  line-height: 1.4;
  resize: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  backdrop-filter: blur(10px);
  margin: 0 auto;
  text-align: left;
}

.share-text-area:focus {
  outline: none;
  border-color: rgba(0, 122, 255, 0.6);
}

.copy-text-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 122, 255, 0.9);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-text-btn:hover {
  background: rgba(0, 122, 255, 1);
  transform: scale(1.05);
}

.copy-text-btn:active {
  transform: scale(0.95);
}

/* SNSシェアボタン */
.social-share-buttons {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
  justify-content: center;
}

/* デスクトップではSNSボタンを非表示 */
.social-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  color: white;
  cursor: pointer;
  display: none;
  /* デフォルトで非表示 */
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.social-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.social-btn-x {
  background: #000000;
  border: 2px solid #FFFFFF;
}

.social-btn-facebook {
  background: #1877F2;
}

.social-btn-instagram {
  background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF, #515BD4);
}

.social-btn-tiktok {
  background: #000000;
  border: 2px solid #00F2EA;
}

/* PC用のダウンロードボタン（デフォルト表示） */
.download-btn-desktop {
  display: block;
}

/* モバイルでのみSNSボタンとシェアテキストを表示 */
@media (max-width: 768px) {

  /* PC用ボタンを非表示 */
  .download-btn-desktop {
    display: none !important;
  }

  .share-text-container {
    display: block !important;
  }

  .photo-modal-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .social-share-buttons {
    display: flex !important;
    align-items: center;
    margin-bottom: 15px !important;
  }

  /* モバイルでSNSボタンを表示 */
  .social-btn {
    display: flex !important;
  }

  /* 画像保存ボタンをSNSボタンの右に小さく表示 */
  #sharePhotoBtn {
    margin-left: 8px;
    padding: 0;
    font-size: 12px;
    /* 少し大きく */
    white-space: nowrap;
    width: 100px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Mobile adjustments for action buttons */
@media (max-width: 480px) {
  .photo-modal-content {
    max-width: 95%;
    max-height: 90vh;
    /* モバイルでは少し余裕を持たせる */
  }

  #modalImage,
  #modalVideo {
    max-height: 60vh;
    /* モバイルでは画像を小さくしてボタンエリアを確保 */
  }

  .photo-modal-actions {
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 15px;
    margin-top: 15px;
  }

  .share-btn {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    font-size: 15px;
    white-space: nowrap;
    /* テキストの改行を防ぐ */
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* 非常に小さな画面での対応 */
@media (max-width: 320px) {
  .photo-modal-content {
    max-width: 98%;
    max-height: 95vh;
  }

  #modalImage,
  #modalVideo {
    max-height: 55vh;
  }

  .photo-modal-actions {
    padding: 0 10px;
    margin-top: 10px;
  }

  .share-btn {
    max-width: 280px;
    padding: 10px 12px;
    font-size: 14px;
  }
}



/* Sound Dialog */
.sound-dialog {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.sound-dialog.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sound-dialog-content {
  background: #1a1a1a;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  animation: dialogSlideIn 0.3s ease-out;
  border: 2px solid #ffffff;
}

@keyframes dialogSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sound-dialog-header {
  background: linear-gradient(45deg, #2196F3, #1976D2);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body.front-page .sound-dialog-header h3 {
  margin: 0;
  font-size: 20px;
  font-family: "Itim", cursive;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sound-dialog-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

/* 起動時音声ダイアログ */
.startup-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

#startupDialog {
  margin: 0;
}

.startup-dialog.active {
  opacity: 1;
  visibility: visible;
}

.startup-dialog-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.startup-dialog.active .startup-dialog-content {
  transform: scale(1);
}

body.front-page .startup-dialog-header h3 {
  color: #ffffff;
  margin: 0 0 30px 0;
  font-size: 20px;
  font-weight: normal;
  font-family: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 写真削除ダイアログのタイトル */
/* 写真削除ダイアログのタイトル */
#deletePhotoDialogTitle {
  color: #333333 !important;
  font-weight: bold !important;
  font-family: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

#deletePhotoDialog .startup-dialog-content {
  background: #ffffffde;
}

#deletePhotoDialog .startup-dialog-body p {
  color: #333333 !important;
}

.startup-dialog-body {
  margin-top: 10px;
  margin-bottom: 25px;
}

.startup-dialog-body p {
  color: #ffffff;
  margin: 0 0 10px 0;
  font-size: 14px;
  line-height: 1.5;
  font-family: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* 音声エラーダイアログのスタイル */
#audioErrorDialog .startup-dialog-body p,
#audioErrorDialog .startup-dialog-body li {
  color: #ffffff;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "MS PGothic", "Osaka", -apple-system, BlinkMacSystemFont, sans-serif;
}

#audioErrorDialog .startup-dialog-body ul {
  color: #ffffff;
}

#audioErrorDialog .startup-dialog-header h3 {
  color: #ffffff;
}

/* スタートアップダイアログのヘッダー文字色 */
#startupDialog .startup-dialog-header h3 {
  color: #ffffff !important;
  font-family: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.startup-dialog-footer {
  display: flex;
  justify-content: center;
}

.startup-dialog-btn {
  background: linear-gradient(45deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: normal;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.startup-dialog-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.startup-dialog-btn:active {
  transform: translateY(0);
}

/* START ボタン専用のスタイル */
.startup-dialog-btn.start-button {
  font-family: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
