/* ===================================
   DBM Indicator Navigator - Styles
   Build-free Static SPA
   =================================== */

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
  line-height: 1.6;
  color: #1f2937;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 1rem;
}

#root {
  max-width: 900px;
  margin: 0 auto;
}

/* Container */
.container {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.5s ease-in-out;
}

/* Typography */
h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #1e40af;
  margin: 1.5rem 0 0.75rem;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #374151;
  margin: 1rem 0 0.5rem;
}

p {
  margin-bottom: 0.75rem;
  color: #4b5563;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  min-width: 120px;
  touch-action: manipulation;
}

.btn-primary {
  background: #1e40af;
  color: white;
}

.btn-primary:hover {
  background: #1e3a8a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

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

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* Navigation */
.nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.nav-btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  background: #e5e7eb;
  color: #374151;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: #d1d5db;
}

.nav-btn.active {
  background: #1e40af;
  color: white;
}

/* Progress Bar */
.progress-container {
  margin: 1.5rem 0;
}

.progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1e40af 0%, #3b82f6 100%);
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 0.9rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

/* Cards */
.card {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.card:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.card.selected {
  border-color: #1e40af;
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.2);
  transform: scale(1.02);
}

.card.selected::before {
  content: '✓';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #1e40af;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
}

.card-title {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.card-hint {
  font-size: 0.85rem;
  color: #6b7280;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

/* Result Display */
.result-section {
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: #f9fafb;
  border-radius: 8px;
  border-left: 4px solid #1e40af;
}

.metric-list {
  list-style: none;
  margin: 0.5rem 0;
}

.metric-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.metric-item:last-child {
  border-bottom: none;
}

.metric-name {
  font-weight: 600;
  color: #1f2937;
}

.metric-desc {
  font-size: 0.9rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* History */
.history-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.history-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-meta {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.history-summary {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.history-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Alert */
.alert {
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  animation: slideDown 0.3s ease;
}

.alert-info {
  background: #dbeafe;
  border: 1px solid #3b82f6;
  color: #1e40af;
}

.alert-success {
  background: #d1fae5;
  border: 1px solid #10b981;
  color: #065f46;
}

.alert-error {
  background: #fee2e2;
  border: 1px solid #ef4444;
  color: #991b1b;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

.spinner {
  border: 3px solid #e5e7eb;
  border-top: 3px solid #1e40af;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.fade-enter {
  animation: fadeIn 0.3s ease;
}

.slide-enter {
  animation: slideDown 0.3s ease;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-gray {
  color: #6b7280;
}

.text-sm {
  font-size: 0.9rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.whitespace-pre-wrap {
  white-space: pre-wrap;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 0.5rem;
  }

  .container {
    padding: 1.5rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

/* ===================================
   Print Styles for PDF Export
   =================================== */

/* 印刷用のみ表示 */
.print-only {
  display: none;
}

/* 画面のみ表示（印刷時は非表示） */
@media screen {
  .print-only {
    display: none !important;
  }
}

@media print {
  /* Page setup */
  @page {
    size: A4;
    margin: 20mm;
  }

  /* Reset for print */
  body {
    background: white;
    padding: 0;
    margin: 0;
  }

  .container {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    max-width: none;
  }

  /* Show print-only elements */
  .print-only {
    display: block !important;
  }

  /* Hide screen-only elements */
  .no-print,
  .nav,
  .btn-group,
  button,
  .history-actions,
  .alert-success {
    display: none !important;
  }

  /* Print header styling */
  .print-header {
    margin-bottom: 20pt;
    padding-bottom: 15pt;
    border-bottom: 2px solid #1e40af;
  }

  /* Watermark */
  body::after {
    content: '社内検討用ドラフト';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 80pt;
    color: rgba(0, 0, 0, 0.05);
    font-weight: bold;
    z-index: -1;
    pointer-events: none;
  }

  /* Typography for print */
  h1 {
    font-size: 18pt;
    color: #000;
    page-break-after: avoid;
  }

  h2 {
    font-size: 14pt;
    color: #000;
    page-break-after: avoid;
    margin-top: 12pt;
  }

  h3 {
    font-size: 12pt;
    color: #000;
    page-break-after: avoid;
  }

  p, li {
    font-size: 10pt;
    line-height: 1.4;
  }

  /* Result sections */
  .result-section {
    background: white;
    border: 1px solid #ddd;
    border-radius: 0;
    padding: 10pt;
    margin: 8pt 0;
    page-break-inside: avoid;
  }

  /* Metric lists */
  .metric-list {
    margin: 6pt 0;
  }

  .metric-item {
    padding: 4pt 0;
    border-bottom: 1px solid #eee;
    page-break-inside: avoid;
  }

  .metric-name {
    font-weight: bold;
    font-size: 10pt;
  }

  .metric-desc {
    font-size: 9pt;
    color: #555;
  }

  /* Alerts */
  .alert {
    border: 1px solid #ccc;
    border-radius: 0;
    padding: 8pt;
    margin: 8pt 0;
    background: #f5f5f5;
    page-break-inside: avoid;
  }

  .alert-info {
    border-color: #3b82f6;
    background: #eff6ff;
  }

  /* Links for print */
  a {
    color: #1e40af;
    text-decoration: underline;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 8pt;
    color: #666;
  }

  /* Page breaks */
  .result-section:nth-of-type(4) {
    page-break-before: always;
  }

  /* Footer with case ID and date */
  @page {
    margin: 20mm;
    
    @bottom-center {
      content: counter(page) ' / ' counter(pages);
      font-size: 8pt;
      color: #666;
    }
  }
}
