/* 名刺めくり - 専用スタイル */

/* カメラボタン */
.camera-button {
  display: none;
  width: 100%;
  padding: 15px;
  margin-top: 20px;
  background-color: #0087F7;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
}

.camera-button:hover {
  background-color: #0066cc;
}

/* プレビューボタン */
.preview-actions {
  text-align: center;
  margin: 30px 0;
  display: none; /* 初期状態では非表示 */
}

.preview-actions.show {
  display: block; /* 処理完了後に表示 */
}

.preview-actions.always-show {
  display: block !important; /* 常に表示 */
}

.preview-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.preview-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
  color: white;
}

.preview-button:active:not(:disabled) {
  transform: translateY(0);
}

.preview-button:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.preview-button i {
  font-size: 20px;
}

.preview-count {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.preview-button[style*="opacity: 0.6"] {
  cursor: not-allowed;
}

.preview-button[style*="opacity: 0.6"]:hover {
  transform: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

@media (max-width: 768px) {
  .camera-button {
    display: block;
  }
  
  .preview-button {
    font-size: 14px;
    padding: 12px 24px;
    gap: 8px;
  }
  
  .preview-button i {
    font-size: 18px;
  }
  
  .preview-count {
    font-size: 12px;
    padding: 3px 6px;
  }
}

/* 結果表示エリア - データグリッド + プレビュー形式 */
.results-container {
  margin: 20px 32px;
  max-width: 1600px;
  display: flex;
  gap: 24px;
  min-height: 600px;
}

/* モダンダッシュボード */
.summary-dashboard {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 24px;
  padding: 32px;
  margin: 32px;
  max-width: 1600px;
  box-shadow: 
    0 20px 40px rgba(0,0,0,0.1),
    0 10px 20px rgba(0,0,0,0.05),
    inset 0 1px 0 rgba(255,255,255,0.8);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.summary-dashboard::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
}

.dashboard-header {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
}

.dashboard-title {
  font-size: 1.8em;
  font-weight: 700;
  color: #2d3748;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.dashboard-title i {
  color: #667eea;
  font-size: 0.9em;
}

.dashboard-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

/* メトリックカード */
.metric-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 
    0 8px 32px rgba(0,0,0,0.08),
    0 4px 16px rgba(0,0,0,0.04);
  border: 1px solid rgba(255,255,255,0.6);
  backdrop-filter: blur(20px);
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.metric-card:hover {
  transform: translateY(-8px);
  box-shadow: 
    0 16px 48px rgba(0,0,0,0.12),
    0 8px 24px rgba(0,0,0,0.08);
}

.metric-card:hover::before {
  transform: scaleX(1);
}

.metric-card.primary {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-color: rgba(102, 126, 234, 0.3);
}

.metric-card.primary .metric-number {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8em;
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
  flex-shrink: 0;
}

.metric-card.secondary .metric-icon {
  background: linear-gradient(135deg, #cbd5e0 0%, #a0aec0 100%);
  box-shadow: 0 8px 16px rgba(160, 174, 192, 0.2);
  color: #4a5568;
}

.metric-info {
  flex: 1;
  min-width: 0;
}

.metric-number {
  font-size: 3.2em;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
  color: #2d3748;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.metric-card.secondary .metric-number {
  font-size: 2.4em;
  color: #4a5568;
}

.metric-label {
  font-size: 1.1em;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.metric-subtitle {
  font-size: 0.9em;
  color: #718096;
  font-weight: 400;
  opacity: 0.8;
}

/* データグリッド部分 */
.data-grid {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.grid-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.grid-title {
  font-size: 1.3em;
  font-weight: bold;
  margin: 0;
}

.grid-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-box {
  padding: 8px 12px;
  border: none;
  border-radius: 20px;
  background: rgba(255,255,255,0.2);
  color: white;
  placeholder-color: rgba(255,255,255,0.7);
  min-width: 200px;
}

.search-box::placeholder {
  color: rgba(255,255,255,0.7);
}

.control-button {
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-button:hover {
  background: rgba(255,255,255,0.3);
}

.control-button i {
  font-size: 0.9em;
}

/* データテーブル */
.data-table-container {
  flex: 1;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.data-table th {
  background: #f8f9fa;
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #dee2e6;
  vertical-align: middle;
}

.data-table tbody tr {
  cursor: pointer;
  transition: all 0.2s ease;
}

.data-table tbody tr:hover {
  background-color: #f8f9fa;
}

.data-table tbody tr.selected {
  background-color: #e3f2fd;
  border-left: 4px solid #2196f3;
}

.data-cell {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
}

.data-cell.name {
  font-weight: 600;
  color: #495057;
}

.data-cell.company {
  color: #6c757d;
}

/* title属性ツールチップ用のスタイル */
.data-cell[title]:not([title=""]) {
  cursor: help;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 500;
}

.status-new { background: #d4edda; color: #155724; }
.status-edited { background: #fff3cd; color: #856404; }
.status-duplicate { background: #f8d7da; color: #721c24; }

/* プレビュー部分 */
.preview-panel {
  flex: 0 0 600px; /* 500px → 600pxに拡大 */
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-header {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-title {
  font-size: 1.2em;
  font-weight: bold;
  margin: 0;
}

.preview-content {
  flex: 1;
  padding: 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.preview-empty {
  text-align: center;
  color: #6c757d;
  padding: 40px 20px;
}

.preview-empty i {
  font-size: 3em;
  margin-bottom: 16px;
  opacity: 0.5;
}

.card-image {
  text-align: center;
  margin-bottom: 20px;
  min-height: 400px; /* 200px → 400pxに拡大 */
  max-height: 600px; /* 最大高さを設定 */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  flex: 1; /* 利用可能なスペースを最大限活用 */
}

.card-image img {
  max-width: 95%; /* 100% → 95%で少し余白を確保 */
  max-height: 550px; /* 500px → 550pxに拡大 */
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
  object-fit: contain;
}

.card-image .loading,
.card-image .error {
  color: #6c757d;
  font-size: 0.9em;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}

/* 新しい回転コントロール */
.rotation-control {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  border: 1px solid #e9ecef;
}

.rotation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dee2e6;
}

.rotation-title {
  font-weight: 600;
  color: #495057;
}

.rotation-value {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}

.rotation-buttons {
  margin-bottom: 12px;
}

.rotation-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
}

.rotation-row:last-child {
  margin-bottom: 0;
}

.rotation-btn {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.75em;
  min-width: 50px;
  flex: 1;
  max-width: 70px;
}

.rotation-btn.large-btn {
  padding: 8px 12px;
  font-size: 0.8em;
  min-width: 80px;
  max-width: 120px;
}

.rotation-btn i {
  font-size: 1.2em;
  margin-bottom: 2px;
}

.rotation-btn:hover {
  border-color: #667eea;
  background: #f0f8ff;
  transform: translateY(-1px);
}

.rotation-btn:active {
  transform: translateY(0) scale(0.95);
}

.rotation-btn.quick-btn {
  color: #495057;
}

.rotation-btn.quick-btn:hover {
  color: #667eea;
}

.rotation-btn.zero-btn {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border-color: transparent;
}

.rotation-btn.zero-btn:hover {
  background: linear-gradient(135deg, #218838 0%, #1ea384 100%);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.rotation-btn.reset-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
}

.rotation-btn.reset-btn:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.rotation-fine-control {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid #dee2e6;
}

.rotation-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e9ecef;
  outline: none;
  -webkit-appearance: none;
}

.rotation-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.rotation-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.fine-control-label {
  font-size: 0.8em;
  color: #6c757d;
  font-weight: 500;
  white-space: nowrap;
}

.rotation-apply-all {
  padding-top: 8px;
  border-top: 1px solid #dee2e6;
  margin-top: 8px;
}

.apply-all-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85em;
  color: #495057;
  font-weight: 500;
}

.apply-all-input {
  width: 16px;
  height: 16px;
  accent-color: #0087F7;
  cursor: pointer;
}

.apply-all-label {
  cursor: pointer;
  user-select: none;
}

/* 詳細プレビュー用回転ツールバー */
.rotation-toolbar {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid #e9ecef;
}

.rotation-toolbar .rotation-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.rotation-toolbar .rotation-btn {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #495057;
}

.rotation-toolbar .rotation-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.rotation-toolbar .rotation-btn:active {
  transform: scale(0.95);
}

.rotation-toolbar .rotation-fine {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.rotation-toolbar .rotation-slider {
  flex: 1;
  max-width: 200px;
}

.rotation-toolbar .rotation-value {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
}

.rotation-toolbar .rotation-note {
  font-size: 0.8em;
  color: #6c757d;
  margin-left: 8px;
}

.card-details {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
}

.detail-group {
  margin-bottom: 12px;
}

.detail-label {
  font-weight: 600;
  color: #495057;
  margin-bottom: 4px;
  font-size: 0.9em;
}

.detail-value {
  color: #6c757d;
  padding: 8px 12px;
  background: white;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  cursor: pointer;
  transition: all 0.2s ease;
}

.detail-value:hover {
  background: #f0f0f0;
}

.detail-value.editing {
  background: #fff;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.action-button {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.action-button.primary {
  background: #007bff;
  color: white;
}

.action-button.primary:hover {
  background: #0056b3;
}

.action-button.secondary {
  background: #6c757d;
  color: white;
}

.action-button.secondary:hover {
  background: #545b62;
}


textarea.csv-output {
  width: 100%;
  height: 200px;
  font-family: monospace;
  white-space: pre;
}

/* メールボタン */
.mail-button {
  margin-left: 8px;
  background: #D93025;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-weight: bold;
}

.mail-button:hover {
  background: #B1221A;
}

.large-swal-popup {
  width: 800px !important;
}

.large-swal-html {
  max-height: 400px !important;
}

.editable-field {
  display: inline-block;
  min-width: 100px;
  padding: 2px 4px;
  margin: -2px 0;
  cursor: pointer;
}

.editable-field:hover {
  background-color: #f0f0f0;
  border-radius: 3px;
}

.editable-field.editing {
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 1px 3px;
}

.edit-button {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 4px;
  font-size: 12px;
}

.edit-button:hover {
  color: #333;
}

/* モバイル専用CSSは削除されました - showPreviewを使用 */

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .results-container {
    flex-direction: column;
    gap: 16px;
    margin: 10px 16px;
    max-width: none;
  }
  
  .preview-panel {
    flex: 1;
    max-width: none;
    margin-top: 16px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
  }
  
  .preview-panel.active {
    display: flex;
  }
  
  .preview-content {
    max-height: 100vh;
    overflow-y: auto;
  }
  
  .card-image {
    min-height: 200px;
    max-height: 40vh;
  }
  
  .card-image img {
    max-height: 35vh;
  }
  
  .rotation-toolbar {
    margin-bottom: 12px;
    padding: 10px;
  }
  
  .rotation-toolbar .rotation-buttons {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
  }
  
  .rotation-toolbar .rotation-btn {
    padding: 6px 10px;
    font-size: 0.85em;
  }
  
  .rotation-toolbar .rotation-fine {
    flex-wrap: wrap;
  }
  
  .rotation-toolbar .rotation-slider {
    width: 100%;
    margin: 8px 0;
  }
  
  .rotation-toolbar .rotation-note {
    display: none;
  }
  
  .card-details {
    padding: 12px;
  }
  
  .detail-group {
    margin-bottom: 10px;
  }
  
  .detail-value {
    padding: 10px 14px;
    font-size: 1em;
  }
  
  .detail-actions {
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    padding: 12px;
    background: white;
    position: sticky;
    bottom: 0;
    border-top: 1px solid #dee2e6;
    margin: 12px -12px -12px -12px;
  }
  
  .action-button {
    width: 100%;
    padding: 12px 20px;
    font-size: 1em;
  }
  
  /* プレビューを閉じるボタンを追加 */
  .preview-header::after {
    content: "×";
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    cursor: pointer;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }
  
  .data-grid {
    min-height: 400px;
  }
  
  .grid-controls {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  
  .search-box {
    min-width: auto;
    width: 100%;
  }
  
  .data-table {
    font-size: 0.85em;
  }
  
  .data-table th,
  .data-table td {
    padding: 12px 8px;
  }
  
  .data-cell {
    max-width: 180px;
    font-size: 0.9em;
  }
  
  .data-table tbody tr {
    border-bottom: 2px solid #f8f9fa;
  }
  
  .data-table tbody tr:hover {
    background-color: #e3f2fd;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
  
  .summary-dashboard {
    margin: 16px;
    padding: 24px;
    border-radius: 20px;
  }
  
  .dashboard-content {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .metric-card {
    padding: 20px;
    gap: 16px;
  }
  
  .metric-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5em;
  }
  
  .metric-number {
    font-size: 2.4em;
  }
  
  .metric-card.secondary .metric-number {
    font-size: 2em;
  }
  
  .dashboard-title {
    font-size: 1.5em;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .results-container {
    max-width: 100%;
    margin: 20px 16px;
  }
  
  .preview-panel {
    flex: 0 0 450px; /* 350px → 450pxに拡大 */
  }
  
  .search-box {
    min-width: 150px;
  }
  
  .data-cell {
    max-width: 180px;
  }
  
  .summary-dashboard {
    margin: 20px 10px;
    padding: 28px;
  }
  
  .dashboard-content {
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
  }
  
  .metric-card {
    padding: 24px;
  }
  
  .metric-number {
    font-size: 2.8em;
  }
  
  .metric-card.secondary .metric-number {
    font-size: 2.2em;
  }
}

@media (max-width: 480px) {
  .summary-dashboard {
    margin: 12px 16px;
    padding: 20px;
    border-radius: 16px;
  }
  
  .dashboard-header {
    margin-bottom: 24px;
  }
  
  .dashboard-title {
    font-size: 1.3em;
    flex-direction: column;
    gap: 8px;
  }
  
  .dashboard-content {
    gap: 12px;
  }
  
  .metric-card {
    flex-direction: column;
    text-align: center;
    padding: 16px;
    gap: 12px;
  }
  
  .metric-icon {
    width: 44px;
    height: 44px;
    font-size: 1.3em;
  }
  
  .metric-number {
    font-size: 2em;
  }
  
  .metric-card.secondary .metric-number {
    font-size: 1.8em;
  }
  
  .metric-label {
    font-size: 1em;
  }
  
  /* モバイル用回転コントロール */
  .rotation-control {
    margin: 12px 0;
    padding: 12px;
  }
  
  .rotation-row {
    gap: 4px;
  }
  
  .rotation-btn {
    min-width: 45px;
    max-width: 60px;
    padding: 6px 4px;
    font-size: 0.7em;
  }
  
  .rotation-btn.large-btn {
    min-width: 60px;
    max-width: 80px;
    font-size: 0.75em;
  }
  
  .rotation-btn i {
    font-size: 1em;
  }
  
  .rotation-fine-control {
    margin-top: 8px;
  }
}
  
  .grid-header {
    padding: 12px 16px;
  }
  
  .grid-title {
    font-size: 1.1em;
  }
  
  .data-table {
    font-size: 0.75em;
  }
  
  .data-cell {
    max-width: 120px;
  }
  
  .preview-header {
    padding: 12px 16px;
  }
  
  .preview-title {
    font-size: 1.1em;
  }
}

/* シンプル統一ボタンスタイル */
.modern-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  user-select: none;
}

.modern-btn:hover {
  transform: translateY(-2px);
}

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

.modern-btn i {
  font-size: 14px;
}

/* プライマリボタン（全選択） */
.modern-btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.modern-btn-primary:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* セカンダリボタン（全解除） */
.modern-btn-secondary {
  background: #f8f9fa;
  color: #495057;
  border: 1px solid #dee2e6;
}

.modern-btn-secondary:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.2);
}

/* 危険ボタン（全削除） */
.modern-btn-danger {
  background: #dc3545;
  color: white;
}

.modern-btn-danger:hover {
  background: #c82333;
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

/* 閉じるボタン */
.modern-btn-close {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  justify-content: center;
}

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

.modern-btn-close i {
  font-size: 14px;
}

/* 選択カウンター */
.selection-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
}

.selection-count i {
  font-size: 12px;
  opacity: 0.8;
}

/* アクションコンテナのレイアウト */
.selection-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.main-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-modal-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  width: 100%;
}

/* プレビューモーダル */
.preview-modal {
  display: none;
  position: fixed;
  z-index: 99999;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.7);
  backdrop-filter: blur(5px);
  overflow: hidden;
}

.preview-modal-content {
  background-color: #fefefe;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 1200px;
  min-height: 300px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}

.preview-modal-header {
  padding: 20px 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  flex-shrink: 0;
}

.preview-modal-title {
  font-size: 1.5rem;
  margin: 0;
}

.preview-modal-controls {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.close-preview {
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 5px;
  transition: all 0.3s ease;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-preview:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.preview-modal-body {
  padding: 30px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* プレビューモーダル内のカードスタイル */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.card-item {
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  background: white;
  aspect-ratio: 16/10;
  position: relative;
  height: 156px; /* 16:10比率で250pxの高さ */
}

.card-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.card-item.selected {
  border-color: #667eea;
  border-width: 3px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.card-item .selection-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 20px;
  height: 20px;
  accent-color: #667eea;
  z-index: 10;
  cursor: pointer;
}

/* プレビューモーダル内のカード画像専用スタイル */
.preview-card-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8f9fa;
  border-radius: 0;
  max-width: 100%;
  max-height: 100%;
}

.no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  color: #6c757d;
  font-size: 14px;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
}

.empty-state h3 {
  margin-bottom: 10px;
  color: #495057;
}

/* 一括回転コントロール */
.bulk-rotation-control {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #dee2e6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.bulk-rotation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dee2e6;
}

.bulk-rotation-header h3 {
  margin: 0;
  color: #495057;
  font-size: 1.2rem;
}

.rotation-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.rotation-fine-control {
  display: flex;
  align-items: center;
  gap: 15px;
}

.rotation-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e9ecef;
  outline: none;
  -webkit-appearance: none;
}

.rotation-btn {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.75em;
  min-width: 60px;
}

.rotation-btn:hover {
  border-color: #667eea;
  background: #f0f8ff;
  transform: translateY(-1px);
}

.rotation-btn.large-btn {
  padding: 10px 16px;
  font-size: 0.8em;
  min-width: 80px;
}

.rotation-btn.reset-btn {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border-color: transparent;
}

.rotation-btn.reset-btn:hover {
  background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.rotation-value {
  background: #667eea;
  color: white;
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 0.9rem;
  font-weight: 600;
}

.fine-control-label {
  font-size: 0.9em;
  color: #6c757d;
  font-weight: 500;
  white-space: nowrap;
}

/* 画像詳細モーダル */
.detail-modal {
  display: none;
  position: fixed;
  z-index: 100000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.8);
  backdrop-filter: blur(3px);
}

.detail-modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 0;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
}

.detail-modal-header {
  padding: 15px 20px;
  background-color: #667eea;
  color: white;
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-modal-body {
  padding: 30px;
}

/* レスポンシブ対応 - シンプルボタン */
@media (max-width: 768px) {
  .preview-modal-controls {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  
  .selection-actions {
    justify-content: center;
    gap: 8px;
  }
  
  .main-actions {
    justify-content: center;
    gap: 8px;
  }
  
  .modern-btn {
    font-size: 13px;
    padding: 6px 12px;
  }
  
  .modern-btn-close {
    width: 28px;
    height: 28px;
    padding: 6px;
  }
  
  .selection-count {
    font-size: 13px;
    padding: 6px 10px;
  }
}

@media (max-width: 480px) {
  .preview-modal-header {
    padding: 12px 16px;
    position: relative;
  }
  
  .selection-actions {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }
  
  .modern-btn {
    font-size: 12px;
    padding: 6px 10px;
    gap: 4px;
  }
  
  .selection-count {
    font-size: 12px;
    padding: 6px 8px;
    order: 3;
    width: 100%;
    justify-content: center;
  }
  
  .modern-btn-close {
    width: 24px;
    height: 24px;
    padding: 4px;
    position: absolute;
    top: 8px;
    right: 8px;
  }
  
  .modern-btn-close i {
    font-size: 12px;
  }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .preview-modal-content {
    width: 95%;
    min-height: 200px;
    max-height: 95vh;
  }
  
  .preview-modal-header {
    flex-direction: column;
    text-align: center;
    padding: 15px 20px;
    position: relative;
  }
  
  .preview-modal-body {
    padding: 20px;
  }
  
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }
  
  .card-item {
    height: 125px; /* 200pxに対する16:10比率 */
  }
  
  .detail-modal-content {
    width: 95%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    position: absolute;
  }
}

/* メール送信ボタンのスタイル */
.email-btn {
  background-color: #4A90E2;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
}

.email-btn:hover {
  background-color: #357ABD;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.email-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.email-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: none;
}

.email-btn i {
  font-size: 16px;
}

/* アクションセルのスタイル */
.action-cell {
  text-align: center;
  min-width: 60px;
}

/* データテーブルの列幅調整 */
.data-table th:last-child,
.data-table td:last-child {
  width: 80px;
  text-align: center;
}

/* 初期結果画面のマージン調整 */
#initial-summary {
  margin: 30px auto 0;
  max-width: 1200px;
}

#initial-results {
  margin: 20px auto;
  max-width: 1200px;
}

/* 初期画面の表示制御 */
#initial-summary[style*="display: none"],
#initial-results[style*="display: none"] {
  display: none !important;
}

/* メールクライアント選択のスタイル */
.email-client-selector {
  display: flex;
  gap: 20px; /* 15px → 20pxに拡大 */
  margin-top: 10px;
}

.email-client-option {
  flex: 1;
  cursor: pointer;
}

.email-client-option input[type="radio"] {
  display: none;
}

.email-client-card {
  display: flex;
  align-items: center;
  padding: 18px 20px; /* 15px → 18px 20pxに拡大 */
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background-color: #f8f9fa;
  transition: all 0.3s ease;
}

.email-client-card:hover {
  border-color: #b0b0b0;
  background-color: #f0f0f0;
}

.email-client-option input[type="radio"]:checked + .email-client-card {
  border-color: #667eea;
  background-color: #f0f4ff;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.email-client-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.email-client-icon svg,
.email-client-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.email-client-info {
  flex: 1;
}

.email-client-name {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin-bottom: 2px;
}

.email-client-desc {
  font-size: 12px;
  color: #666;
}

/* メールクライアント選択のモバイル対応 */
@media (max-width: 600px) {
  .email-client-selector {
    flex-direction: column;
  }
  
  .email-client-card {
    padding: 12px;
  }
  
  .email-client-icon {
    width: 32px;
    height: 32px;
  }
  
  .email-client-icon svg,
  .email-client-icon img {
    width: 24px;
    height: 24px;
  }
}

/* 設定ボタンのスタイル */
.settings-button {
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* プレビューアクションのボタン配置調整 */
.preview-actions button {
  margin: 0 10px;
}

.settings-button:hover {
  background-color: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 設定モーダルのスタイル */
.settings-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.settings-modal-content {
  background-color: #fff;
  margin: 30px auto;
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 900px; /* 600px → 900pxに拡大 */
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.settings-modal-header {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
  color: white;
  padding: 20px 25px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.settings-modal-title {
  margin: 0;
  font-size: 1.5em;
  font-weight: 600;
}

.settings-modal-body {
  padding: 40px; /* 30px → 40pxに拡大 */
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 18px; /* 10px 15px → 12px 18pxに拡大 */
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 15px; /* 14px → 15pxに拡大 */
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #6c757d;
  box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-group small {
  font-size: 12px;
  line-height: 1.4;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background-color: #4A90E2;
  color: white;
}

.btn-primary:hover {
  background-color: #357ABD;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
  background-color: #f8f9fa;
  color: #6c757d;
  border: 1px solid #dee2e6;
}

.btn-secondary:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
}

/* 設定モーダルのレスポンシブ対応 */
@media (max-width: 768px) {
  .settings-modal-content {
    width: 95%;
    max-width: none;
    margin: 15px auto;
  }
  
  .settings-modal-body {
    padding: 25px; /* モバイルでは少し狭く */
  }
  
  .form-group input,
  .form-group textarea {
    padding: 10px 15px; /* モバイルでは元のサイズに */
    font-size: 14px;
  }
}

/* ポップアップブロック警告のレスポンシブ対応 */
@media (max-width: 600px) {
  .swal2-popup svg {
    max-width: 100%;
    height: auto;
  }
}