/* ==========================================================================
   PrivacyPhoto - スタイルシート (css/style.css)
   プロジェクト統計ツール準拠のデザインシステム（ミニマル・ダークUI）
   プロトコル第18条準拠: #09090b 背景, #121215 カード, #27272a ボーダー
   ========================================================================== */

:root {
  /* カラーパレット */
  --bg-base: #09090b;
  --bg-surface: #121215;
  --bg-surface-elevated: #18181b;
  --bg-surface-hover: #202024;
  --border-subtle: #27272a;
  --border-strong: #3f3f46;
  --border-focus: #52525b;

  --text-primary: #f4f4f5;
  --text-secondary: #d4d4d8;
  --text-muted: #a1a1aa;
  --text-inverse: #09090b;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.15);

  --status-danger: #ef4444;
  --status-danger-bg: rgba(239, 68, 68, 0.1);
  --status-danger-border: rgba(239, 68, 68, 0.25);

  --status-warning: #f59e0b;
  --status-warning-bg: rgba(245, 158, 11, 0.1);
  --status-warning-border: rgba(245, 158, 11, 0.25);

  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.1);
  --status-success-border: rgba(16, 185, 129, 0.25);

  /* タイポグラフィ（端末標準フォント） */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* シャドウ・アピアランス */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.6);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

/* リセット＆基本設定 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* レイアウト */
.app-container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px 60px;
  flex: 1;
}

/* ヘッダー */
.app-header {
  margin-bottom: 32px;
  text-align: center;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.brand-badge .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-success);
  box-shadow: 0 0 8px var(--status-success);
}

.app-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.app-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* アラート・通知 */
.alert-container {
  margin-bottom: 24px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.alert-danger {
  background-color: var(--status-danger-bg);
  border: 1px solid var(--status-danger-border);
  color: #fca5a5;
}

.alert-warning {
  background-color: var(--status-warning-bg);
  border: 1px solid var(--status-warning-border);
  color: #fde68a;
}

.alert-info {
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

.alert-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* カードコンポーネント */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ドロップゾーン（Step 1） */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: rgba(18, 18, 21, 0.6);
}

.drop-zone:hover, .drop-zone.drag-active {
  border-color: var(--accent-primary);
  background-color: var(--bg-surface-elevated);
  box-shadow: 0 0 24px var(--accent-glow);
}

.drop-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.85;
}

.drop-primary-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.drop-secondary-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.drop-hint {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-large {
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  width: 100%;
}

/* バッジ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-danger {
  background-color: var(--status-danger-bg);
  border: 1px solid var(--status-danger-border);
  color: #f87171;
}

.badge-warning {
  background-color: var(--status-warning-bg);
  border: 1px solid var(--status-warning-border);
  color: #fbbf24;
}

.badge-safe {
  background-color: var(--status-success-bg);
  border: 1px solid var(--status-success-border);
  color: #34d399;
}

/* 解析結果レイアウト（Step 2） */
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 720px) {
  .analysis-grid {
    grid-template-columns: 1fr;
  }
}

.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  overflow: hidden;
}

.preview-img {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  box-shadow: var(--shadow-sm);
}

.preview-caption {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
}

.meta-table tr {
  border-bottom: 1px solid var(--border-subtle);
}

.meta-table tr:last-child {
  border-bottom: none;
}

.meta-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  width: 32%;
}

.meta-table td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* GPSカード */
.gps-card {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.08) 0%, rgba(18, 18, 21, 0.9) 100%);
  border: 1px solid var(--status-danger-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.gps-title {
  font-size: 13px;
  font-weight: 600;
  color: #fca5a5;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gps-coords-display {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.gps-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
}

.gps-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gps-map-link {
  color: var(--accent-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gps-map-link:hover {
  text-decoration: underline;
}

/* ローディング（Step 3） */
.processing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.processing-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

/* 比較結果（Step 4） */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.stat-reduced {
  background-color: var(--status-success-bg);
  color: #34d399;
}

.stat-increased {
  background-color: var(--status-warning-bg);
  color: #fbbf24;
}

.action-bar {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

@media (max-width: 500px) {
  .action-bar {
    flex-direction: column;
  }
}

/* フッター */
.app-footer {
  text-align: center;
  padding: 24px 20px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
}

.app-footer a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app-footer a:hover {
  color: var(--text-primary);
}

/* UIコンポーネント・レイアウト補助（CSP対応・インラインスタイル集約） */
.app-title-sub {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-top: 4px;
}

#file-input,
#analysis-section,
#processing-section,
#result-section,
#gps-info-card {
  display: none;
}

#risk-message {
  margin-bottom: 20px;
  color: var(--text-secondary);
}

#gps-altitude {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.map-link-note {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
}

#reselect-button {
  min-width: 140px;
}

#reset-button {
  min-width: 160px;
}

#safety-details {
  margin-bottom: 24px;
  color: var(--text-secondary);
  font-size: 13px;
}

#res-after-label {
  font-size: 15px;
}

#res-before-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.result-preview-container {
  margin-bottom: 24px;
}

.disclaimer-banner {
  margin-top: 32px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}

.footer-license {
  margin-top: 6px;
}
