/* =========================
   基本設定
========================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  background-color: #f5f7fb;
  color: #263449;
  line-height: 1.6;
}

button {
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* =========================
   ヘッダー
========================= */

.header {
  background-color: #ffffff;
  border-bottom: 1px solid #e5eaf1;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
}

.logo-icon {
  color: #2878d0;
  font-size: 27px;
}

.header-label {
  font-size: 12px;
  color: #758399;
}

/* =========================
   メインコンテンツ
========================= */

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.intro {
  margin-bottom: 32px;
}

.intro h1 {
  font-size: 30px;
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}

.intro p {
  color: #718096;
  margin: 0;
  font-size: 14px;
}

/* =========================
   カード共通
========================= */

.card {
  background: #ffffff;
  border: 1px solid #e5eaf1;
  border-radius: 12px;
  padding: 26px;
  margin-bottom: 22px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.step {
  background: #eaf3ff;
  color: #2878d0;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
}

.section-heading h2 {
  font-size: 17px;
  margin: 0 0 4px;
}

.section-heading p {
  font-size: 12px;
  color: #8995a7;
  margin: 0;
}

/* =========================
   ファイル読み込みエリア
========================= */

.upload-area {
  border: 2px dashed #c9d9ed;
  border-radius: 10px;
  padding: 32px 20px;
  text-align: center;
  background: #f9fbfe;
}

.upload-icon {
  font-size: 36px;
  color: #2878d0;
  margin-bottom: 8px;
}

.upload-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 5px;
}

.upload-description {
  color: #8995a7;
  font-size: 12px;
  margin: 0 0 18px;
}

.primary-button {
  background: #2878d0;
  color: white;
  border: none;
  border-radius: 7px;
  padding: 11px 25px;
  font-size: 13px;
  font-weight: 600;
}

.primary-button:hover {
  background: #1c64b4;
}

/* =========================
   加工ボタン
========================= */

.tool-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.tool-button {
  background: #f8fafd;
  border: 1px solid #e2e9f2;
  border-radius: 8px;
  padding: 17px 8px;
  color: #35465c;
  font-size: 12px;
}

.tool-icon {
  display: block;
  font-size: 22px;
  color: #2878d0;
  margin-bottom: 5px;
}

.notice {
  font-size: 11px;
  color: #99a3b1;
  margin: 15px 0 0;
}

/* =========================
   プレビューエリア
========================= */

.preview-area {
  min-height: 190px;
  border: 1px solid #e8edf3;
  border-radius: 8px;
  overflow: auto;
}

.empty-state {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8995a7;
  text-align: center;
  padding: 20px;
}

.empty-icon {
  font-size: 30px;
  margin-bottom: 10px;
  color: #aab8c9;
}

.empty-state p {
  font-size: 13px;
  margin: 0 0 5px;
}

.empty-state span {
  font-size: 11px;
}

/* =========================
   ダウンロード
========================= */

.download-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: #edf5ff;
  border-radius: 12px;
  padding: 23px 26px;
}

.download-section h2 {
  font-size: 15px;
  margin: 0 0 5px;
}

.download-section p {
  font-size: 11px;
  color: #758399;
  margin: 0;
}

.download-button {
  background: #2878d0;
  color: white;
  border: none;
  border-radius: 7px;
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* =========================
   フッター
========================= */

.footer {
  text-align: center;
  padding: 20px;
  color: #9aa5b3;
  font-size: 10px;
}

/* =========================
   スマートフォン対応
========================= */

@media (max-width: 650px) {
  .container {
    padding: 28px 15px 40px;
  }

  .intro h1 {
    font-size: 23px;
  }

  .card {
    padding: 18px;
  }

  .tool-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .download-section {
    flex-direction: column;
    align-items: stretch;
  }

  #downloadButton,
  #downloadExcelButton {
    width: 100%;
  }

  .header-inner {
    padding: 15px;
  }
}

/* CSVプレビュー用テーブル */
.preview-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 14px;
}

.preview-table th,
.preview-table td {
  border: 1px solid #dce3ec;
  padding: 10px 12px;
  text-align: left;
  white-space: pre-wrap;
}

.preview-table th {
  background-color: #f1f5f9;
  font-weight: 600;
}

.preview-table tr:nth-child(even) {
  background-color: #f8fafc;
}

/* 列の操作エリア */
.column-controls {
  margin-top: 24px;
  padding: 20px;
  background-color: #f8fafc;
  border: 1px solid #dce3ec;
  border-radius: 10px;
}

.column-controls h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.column-controls p {
  color: #64748b;
  font-size: 14px;
}

#columnCheckboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 16px 0;
}

.column-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.column-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.column-buttons button,
.column-controls > button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background-color: #2563eb;
  color: white;
  cursor: pointer;
}

.column-buttons button:disabled {
  background-color: #94a3b8;
  cursor: not-allowed;
}

/* 列操作エリアの表示制御 */
.column-controls[hidden] {
  display: none;
}

.column-controls:not([hidden]) {
  display: block;
}

/* データ加工の結果表示 */
.operation-result {
  margin-top: 16px;
  padding: 12px 16px;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  color: #047857 !important;
  font-size: 14px;
  font-weight: 600;
}

/* ダウンロードボタン共通デザイン */
#downloadButton,
#downloadExcelButton {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

/* CSVダウンロード：青 */
#downloadButton {
  background-color: #2563eb;
}

#downloadButton:hover:not(:disabled) {
  background-color: #1d4ed8;
}

/* Excelダウンロード：緑 */
#downloadExcelButton {
  background-color: #16a34a;
}

#downloadExcelButton:hover:not(:disabled) {
  background-color: #15803d;
}

/* 無効状態 */
#downloadButton:disabled,
#downloadExcelButton:disabled {
  background-color: #94a3b8;
  cursor: not-allowed;
}

/* 元に戻すボタン */
.undo-area {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.undo-area .tool-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}

.undo-area .tool-icon {
  display: inline;
  margin-bottom: 0;
  font-size: 18px;
}

.file-notice {
  margin-top: 8px;
  color: #666;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
