/**
 * レスポンシブデザイン - Refined Tech Minimalism
 */

/* ========================================
   モバイル（〜768px）- コンパクト最適化
   ======================================== */
@media (max-width: 768px) {
  /* コンテナ - コンパクトに */
  .container {
    padding: var(--space-sm);
  }

  /* ヘッダー - コンパクト */
  .header {
    padding: var(--space-xl) var(--space-lg);
    margin-bottom: var(--space-md);
    border-radius: var(--radius-lg);
  }

  .header h1 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-sm);
  }

  .header .subtitle {
    font-size: var(--font-size-sm);
  }

  /* セクション - コンパクト */
  .input-section,
  .results-section {
    padding: var(--space-lg);
    border-radius: var(--radius);
  }

  .input-section h2,
  .results-section h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-md);
  }

  .input-section h3,
  .results-section h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-md);
  }

  /* 入力グループ - コンパクト */
  .input-group {
    padding: var(--space-md);
    margin-bottom: var(--space-md);
  }

  /* フォーム要素 - タッチ最適化 */
  input[type="number"],
  input[type="text"] {
    height: 42px;
    font-size: var(--font-size-sm);
    padding: 0 var(--space-md);
  }

  .unit {
    font-size: var(--font-size-xs);
    min-width: 50px;
    padding: 0 var(--space-md);
  }

  button {
    height: 42px;
    font-size: var(--font-size-sm);
    padding: 0 var(--space-lg);
  }

  /* チェックボックス - 縦並び */
  .checkbox-group {
    flex-direction: column;
  }

  .checkbox-label {
    width: 100%;
    justify-content: flex-start;
  }

  /* ボタングループ - 縦並び */
  .button-group {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  /* 結果カード - コンパクト */
  .result-card {
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
  }

  /* テーブル - 横スクロール */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-xs);
  }

  /* 結論カード - コンパクト */
  .conclusion-item {
    padding: var(--space-md);
  }

  .conclusion-item h4 {
    font-size: var(--font-size-base);
  }

  .best-plan {
    font-size: var(--font-size-sm);
  }

  /* フッター */
  .footer {
    padding: var(--space-xl) var(--space-lg);
    margin-top: var(--space-xl);
  }

  /* チャート */
  .chart-container {
    height: 300px !important;
  }
}

/* ========================================
   タブレット（769px〜1199px）
   ======================================== */
@media (min-width: 769px) and (max-width: 1199px) {
  .container {
    padding: var(--space-lg);
  }

  .header {
    padding: var(--space-2xl) var(--space-xl);
  }

  /* 1カラムレイアウト維持 */
  .main-content {
    gap: var(--space-lg);
  }
}

/* ========================================
   デスクトップ（1200px〜）- 2カラム最適化
   ======================================== */
@media (min-width: 1200px) {
  /* コンテナ */
  .container {
    max-width: 1600px;
    padding: var(--space-lg);
  }

  /* ヘッダー */
  .header {
    padding: var(--space-2xl) var(--space-xl);
    margin-bottom: var(--space-lg);
  }

  /* 2カラムレイアウト - 左右並列で1画面に収める */
  .main-content {
    grid-template-columns: minmax(400px, 450px) 1fr;
    gap: var(--space-lg);
    align-items: start;
  }

  /* 入力セクション - スティッキーで固定 */
  .input-section {
    position: sticky;
    top: var(--space-md);
    max-height: calc(100vh - var(--space-xl));
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* スクロールバーのスタイル調整 */
  .input-section::-webkit-scrollbar {
    width: 6px;
  }

  .input-section::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
  }

  /* 結果セクション */
  .results-section {
    min-height: calc(100vh - 200px);
  }

  /* ホバーエフェクト強化 */
  .result-card:hover {
    transform: translateY(-4px);
  }

  .conclusion-item:hover {
    transform: translateX(8px);
  }
}

/* ========================================
   超大画面（1600px〜）
   ======================================== */
@media (min-width: 1600px) {
  .container {
    max-width: 1800px;
  }

  .main-content {
    grid-template-columns: 480px 1fr;
    gap: var(--space-2xl);
  }
}

/* ========================================
   印刷対応
   ======================================== */
@media print {
  body {
    background: white;
  }

  body::before {
    display: none;
  }

  .header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .input-section {
    display: none;
  }

  .results-section {
    box-shadow: none;
  }

  button {
    display: none;
  }

  .result-card {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}

/* ========================================
   アクセシビリティ - モーション縮小
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body::before {
    animation: none !important;
  }
}

/* ========================================
   ホバー可能デバイス
   ======================================== */
@media (hover: hover) and (pointer: fine) {
  .checkbox-label:hover {
    transform: translateY(-2px) scale(1.02);
  }

  button:hover {
    transform: translateY(-2px);
  }

  .input-section:hover,
  .results-section:hover {
    transform: translateY(-2px);
  }
}
