body {
  background: radial-gradient(1200px 600px at 50% -300px, rgba(0, 0, 0, 0.04), rgba(255, 255, 255, 0)), linear-gradient(180deg, #ffffff 0%, #f6f7f9 100%);
  color: #111111;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.page-content {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

.card {
  box-shadow: 0 10px 30px rgba(17, 17, 17, 0.06);
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  color: #111111;
}

.card-header {
  background: linear-gradient(180deg, #ffffff, #fafafa);
  color: #111111;
  font-weight: 600;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 14px 14px 0 0 !important;
  padding: 18px 20px;
}

.card-body {
  padding: 30px;
}

h1 {
  color: #111111;
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* Logo styling */
.logo {
  height: 4rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  display: block;
}

/* Responsive logo sizing */
@media (max-width: 768px) {
  .logo {
    height: 3rem;
  }

  .display-4 {
    font-size: 2rem !important;
  }
}

@media (max-width: 480px) {
  .logo {
    height: 2.5rem;
  }

  .display-4 {
    font-size: 1.75rem !important;
  }
}

.lead {
  color: #6b7280;
}

.text-white-50 {
  color: #6b7280 !important;
}

.lead {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Enhanced section card styling */
.section-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(17, 17, 17, 0.04);
  transition: box-shadow 0.2s ease-in-out;
}

.section-card:hover {
  box-shadow: 0 4px 16px rgba(17, 17, 17, 0.08);
}

.section-header .section-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.section-timestamp {
  font-size: 0.8rem;
}

/* Badge styling for topic hints and entities */
.badge.bg-info.me-1,
.badge.bg-primary.bg-opacity-25,
.badge.bg-success.bg-opacity-25,
.badge.bg-warning.bg-opacity-25,
.badge.bg-info.bg-opacity-25,
.badge.bg-secondary.bg-opacity-25 {
  font-size: 0.75rem;
  padding: 0.35em 0.65em;
  border-radius: 0.375rem;
}

/* Entity category styling */
.text-primary {
  color: #0d6efd !important;
}

.text-success {
  color: #198754 !important;
}

.text-warning {
  color: #ffc107 !important;
}

.text-info {
  color: #0dcaf0 !important;
}

.text-secondary {
  color: #6c757d !important;
}

/* Decision and question lists */
.section-card ul {
  padding-left: 1.2rem;
}

.section-card li {
  margin-bottom: 0.25rem;
}

/* Evidence blockquotes */
.section-card blockquote.blockquote-footer {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  font-style: italic;
}

/* Responsive section content */
@media (max-width: 768px) {
  .section-card {
    padding: 15px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .section-timestamp {
    margin-top: 0.5rem;
  }
}

/* 推奨画像のスタイリング */
.gallery-image.recommended {
  border-color: #ffc107 !important;
  box-shadow: 0 0 15px rgba(255, 193, 7, 0.3) !important;
  position: relative;
}

.recommended-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  background: linear-gradient(135deg, #ffc107, #ffb300);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.recommended-badge i {
  margin-right: 2px;
}

/* 編集提案ボタンのスタイリング */
.edit-suggestions {
  border: 1px solid #e3f2fd;
  border-radius: 8px;
  padding: 12px;
  background-color: #f8f9fa;
}

.suggestion-btn {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 20px;
  transition: all 0.2s ease;
}

.suggestion-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

/* 解析結果サマリーのスタイリング */
#analysis-summary-section .alert {
  border-left: 4px solid #0dcaf0;
  background: linear-gradient(135deg, #e3f2fd 0%, #f8f9fa 100%);
}

#analysis-summary-section .alert-heading {
  color: #0d6efd;
  font-weight: 600;
}

.display-4 {
  font-weight: 300;
  font-size: 32px;
}

.progress {
  height: 8px;
  border-radius: 10px;
  background-color: #eeeeee;
}

.progress-bar {
  background: linear-gradient(90deg, #111111, #3a3a3a);
  border-radius: 10px;
}

.spinner-border {
  color: #111111;
}

#transcript-text,
#email-content {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background: #ffffff;
  color: #111111;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#transcript-text:focus,
#email-content:focus {
  border-color: #111111;
  box-shadow: 0 0 0 0.2rem rgba(17, 17, 17, 0.08);
}

.btn {
  border-radius: 9px;
  padding: 12px 42px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-hero-orange {
  background: #f2682a;
  /* vivid orange */
  color: #ffffff;
}

.btn-hero-orange:hover {
  color: #ffffff;
  filter: brightness(0.95);
  transform: translateY(-1px);
}

.btn-hero-black {
  background: #111111;
  color: #ffffff;
}

.btn-hero-black:hover {
  background: #111111;
  /* keep solid black */
  color: #fff;
  border-color: #111111;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25), 0 0 0 3px rgba(255, 255, 255, .08);
  /* soft white ring */
  text-shadow: 0 0 6px rgba(255, 255, 255, .35);
  /* improves readability on dark bg */
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* Disabled hero buttons remain fully colored and readable */
.btn-hero-orange:disabled,
.btn-hero-black:disabled {
  opacity: 1;
  filter: none;
  cursor: default;
}

.btn-primary {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
  box-shadow: 0 6px 18px rgba(17, 17, 17, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: #000000;
  border-color: #000000;
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.25);
}

.btn-success {
  background: #1f2937;
  color: #ffffff;
  border-color: #1f2937;
  box-shadow: 0 6px 18px rgba(17, 17, 17, 0.18);
}

.btn-success:hover {
  transform: translateY(-1px);
  background: #111827;
  border-color: #111827;
}

.btn-secondary {
  background: transparent;
  color: #111111;
  border-color: #111111;
}

.btn-outline-primary {
  border: 1.5px solid #111111;
  color: #111111;
  background: transparent;
}

.btn-outline-primary:hover {
  background: #111111;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-outline-warning {
  border: 1.5px solid #ffc107;
  color: #ffc107;
  background: transparent;
}

.btn-outline-warning:hover {
  background: #ffc107;
  color: #ffffff;
}
.form-control {
  background: #ffffff;
  color: #111111;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control::placeholder {
  color: #9ca3af;
}

.form-label,
label {
  color: #111111;
}

.form-control:focus {
  border-color: #111111;
  box-shadow: 0 0 0 0.2rem rgba(17, 17, 17, 0.08);
}

.form-text {
  color: #6b7280;
  font-size: 0.875rem;
}

.alert {
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #111111;
}

/* Restore Bootstrap variant colors for alerts that should be contextual */
.alert-danger {
  background-color: #f8d7da !important;
  border-color: #f5c2c7 !important;
  color: #842029 !important;
}

.loading-container {
  text-align: center;
  padding: 40px 20px;
}

.loading-text {
  color: #111111;
  font-weight: 500;
  margin-top: 15px;
}

/* プログレスバー強化 */
.progress-container {
  position: relative;
  margin-bottom: 20px;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
  font-weight: 600;
  color: #111111;
}

/* アニメーション効果 */
.btn:active {
  transform: translateY(0) !important;
}

.fade-in {
  animation: fadeIn 0.8s ease-out;
}

/* カードホバー効果 */
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(17, 17, 17, 0.12);
  transition: all 0.3s ease;
}

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .card-body {
    padding: 20px;
  }

  .btn {
    margin-bottom: 10px;
  }

  .display-4 {
    font-size: 2rem;
  }

  .d-flex.gap-2 {
    flex-direction: column;
  }

  .flex-fill {
    width: 100% !important;
  }
}

/* セクション表示スタイル */
.section-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  transition: all 0.3s ease;
}

.section-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.section-title {
  font-weight: 600;
  color: #111111;
  margin: 0;
}

.section-timestamp {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.section-content {
  color: #111111;
  line-height: 1.7;
  margin: 0;
}

.section-content.editable {
  background: #ffffff;
  color: #111111;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  min-height: 60px;
  resize: vertical;
}

.btn-check:checked+.btn-outline-primary {
  background-color: #111111;
  border-color: #111111;
  color: #ffffff;
}

/* 画像ギャラリー用スタイル */
.image-gallery {
  overflow-y: auto;
  padding: 10px;
  background-color: #f8f9fa;
  border-radius: 5px;
}

.gallery-image {
  cursor: pointer;
  transition: all 0.3s ease;
  border: 3px solid transparent;
}

.gallery-image:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.gallery-image.selected {
  border-color: #007bff;
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.gallery-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 5px;
}

.gallery-image-name {
  font-size: 0.8rem;
  text-align: center;
  margin-top: 5px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.image-preview {
  max-height: 500px;
  object-fit: cover;
}

/* User Menu Styles */
#user-menu {
  background-color: #f8f9fa;
  padding: 10px 20px;
  border-radius: 50px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
}

#user-menu:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  background-color: #ffffff;
}

#user-email {
  color: #111111;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Auth status indicator */
.bi-person-circle {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.8;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.8;
  }
}

/* Header Styles */
.main-header {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  z-index: 1000;
}

.main-header .container-fluid {
  padding-top: 0.1rem;
  padding-bottom: 0.rem;
}

.header-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.nav-link-custom {
  color: #6c757d;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.9rem;
}

.nav-link-custom:hover {
  color: #111111;
  background-color: #f8f9fa;
  text-decoration: none;
}

.auth-section {
  min-width: 120px;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Responsive Header */
@media (max-width: 991px) {
  .main-header .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .auth-section {
    min-width: auto;
  }
}

@media (max-width: 768px) {
  .header-logo {
    height: 24px;
  }

  .main-header h5 {
    font-size: 0.9rem;
  }

  .main-header small {
    font-size: 0.7rem;
  }

  .main-header .container-fluid {
    padding-top: 0.33rem;
    padding-bottom: 0.33rem;
  } 
  .main-header .d-flex {
    flex-wrap: wrap;
    flex-direction: column;
    justify-content: center;
  }
}

/* ログページの画像表示スタイル */
.image-container {
  min-height: 100px;
  align-items: center !important;
}

.input-image-wrapper, .output-image-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.image-label {
  font-size: 0.75rem;
  color: #6c757d;
  font-weight: 500;
  text-align: center;
}

.log-image {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e9ecef;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.log-image:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.input-image {
  border-color: #007bff;
}

.output-image {
  border-color: #28a745;
}

.no-image {
  width: 80px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  font-size: 0.7rem;
  color: #6c757d;
  text-align: center;
}

.video-thumbnail {
  width: 80px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.video-thumbnail:hover {
  background-color: #e9ecef;
}

.video-label {
  font-size: 0.6rem;
  color: #007bff;
  margin-top: 2px;
}

.failed-output {
  width: 80px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
}

.error-label {
  font-size: 0.7rem;
  color: #721c24;
  margin-top: 2px;
}

.error-message {
  font-size: 0.6rem;
  color: #721c24;
  text-align: center;
  margin-top: 2px;
}

.processing-output {
  width: 80px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
}

.processing-label {
  font-size: 0.7rem;
  color: #856404;
  margin-top: 4px;
}

.arrow-right {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 60px;
}

.prompt-cell {
  max-width: 300px;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  line-clamp: 3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3; /* show 3 lines before truncating */
  white-space: normal;
}

.prompt-hover-modal {
  position: fixed;
  max-width: 40vw;
  max-height: 50vh;
  overflow-y: auto;
  background: #ffffff;
  color: #212529;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .image-container {
    flex-direction: column;
    gap: 10px !important;
  }
  
  .arrow-right {
    transform: rotate(90deg);
    width: 60px;
    height: 30px;
  }
  
  .log-image, .no-image, .video-thumbnail, .failed-output, .processing-output {
    width: 100px;
    height: 75px;
  }
  
  .prompt-cell {
    max-width: 200px;
  }
}

/* Responsive Modal */
@media (max-width: 991px) {
  .modal-dialog {
    max-width: 90% !important;
  }
}

/* ==================== 画像プレビューモーダル用スタイル ==================== */

/* クリック可能な画像のスタイル */
.image-preview,
#original-comparison-image,
#edited-comparison-image,
#composite-left-preview-img,
#composite-right-preview-img,
#multi-image-result-img {
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.image-preview:hover,
#original-comparison-image:hover,
#edited-comparison-image:hover,
#composite-left-preview-img:hover,
#composite-right-preview-img:hover,
#multi-image-result-img:hover {
  transform: scale(1.02);
  border-color: #007bff;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* 画像プレビューモーダルのスタイル */
#imagePreviewModal .modal-dialog {
  /* max-width: 95vw; */
  max-height: 95vh;
}

#imagePreviewModal .modal-body {
  padding: 0;
  background-color: #f8f9fa;
}

#imagePreviewModal .modal-body img {
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* 画像比較コンテナのスタイル */
.comparison-image-container {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 1rem;
  transition: all 0.3s ease;
}

.comparison-image-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.comparison-image-container img {
  transition: all 0.3s ease;
}

.comparison-image-container:hover img {
  transform: scale(1.05);
}

/* 合成画像プレビューコンテナのスタイル */
#composite-left-preview-container,
#composite-right-preview-container {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 1rem;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

#composite-left-preview-container:hover,
#composite-right-preview-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: #007bff;
}

#composite-left-preview-container img,
#composite-right-preview-container img {
  transition: all 0.3s ease;
}

#composite-left-preview-container:hover img,
#composite-right-preview-container:hover img {
  transform: scale(1.05);
}

/* 複数画像合成結果のスタイル */
#multi-image-result-img {
  position: relative;
  transition: all 0.3s ease;
  border-radius: 0.5rem;
}

#multi-image-result-img:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
}

/* 画像プレビューコンテナのスタイル */
.image-preview-container {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 1rem;
  transition: all 0.3s ease;
}

.image-preview-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.image-preview-container img {
  transition: all 0.3s ease;
}

.image-preview-container:hover img {
  transform: scale(1.05);
}

/* モーダル内の画像のレスポンシブ対応 */
@media (max-width: 768px) {
  #imagePreviewModal .modal-dialog {
    max-width: 98vw;
    margin: 1vh auto;
  }
  
  #imagePreviewModal .modal-body img {
    max-height: 70vh;
  }
}

/* 共有ボタンのスタイル */
#shareImageBtn,
#shareImageModalBtn,
#shareVideoModalBtn {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  border: none;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#shareImageBtn:hover,
#shareImageModalBtn:hover,
#shareVideoModalBtn:hover {
  background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

#shareImageBtn:active,
#shareImageModalBtn:active,
#shareVideoModalBtn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
}

/* 共有ボタンのアイコンアニメーション */
#shareImageBtn i,
#shareImageModalBtn i,
#shareVideoModalBtn i {
  transition: transform 0.3s ease;
}

#shareImageBtn:hover i,
#shareImageおおModalBtn:hover i,
#shareVideoModalBtn:hover i {
  transform: scale(1.1);
}