/*
 * Mamou Free Tools - CSV文字化け解消ツール
 * 既存テーマ(SWELL)のCSSクラスに依存しない自己完結スタイル。
 * すべて .mamou-tool 配下にスコープする。
 * text-format.css は別ページ用のため、このファイルに基本スタイルも同梱する。
 */

.mamou-tool {
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
  margin: 0 0 2em;
  padding: 1.25em;
  background: #ffffff;
  border: 1px solid #d9dde3;
  border-radius: 12px;
  color: #222222;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  line-height: 1.6;
}

.mamou-tool *,
.mamou-tool *::before,
.mamou-tool *::after {
  box-sizing: inherit;
}

.mamou-tool__notice {
  margin: 0 0 1em;
  padding: 0.75em 1em;
  background: #f4f7fb;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  font-size: 0.9em;
  color: #33475b;
}

.mamou-tool__noscript {
  margin: 0;
  padding: 1em;
  background: #fff4f4;
  border: 1px solid #f0c9c9;
  border-radius: 8px;
  color: #8a2c2c;
}

.mamou-tool__explain {
  margin: 0 0 1.25em;
  padding: 0.75em 1em;
  background: #fbf8f2;
  border: 1px solid #ecdfc7;
  border-radius: 8px;
  font-size: 0.9em;
  color: #4a4133;
}

.mamou-tool__explain-title {
  margin: 0 0 0.4em;
  font-weight: 700;
}

.mamou-tool__explain p {
  margin: 0;
}

.mamou-tool__section {
  margin: 0 0 1.25em;
}

.mamou-tool__label {
  display: block;
  margin: 0 0 0.5em;
  font-weight: 700;
  font-size: 0.95em;
  color: #222222;
}

/* ドロップ領域 */
.mamou-tool__dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  margin: 0 0 1.25em;
  padding: 1.75em 1em;
  background: #fafbfc;
  border: 2px dashed #b7c1cd;
  border-radius: 10px;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.mamou-tool__dropzone.is-dragover {
  background: #eaf2ff;
  border-color: #2c6fe0;
}

.mamou-tool__drop-text {
  margin: 0;
  font-size: 0.9em;
  color: #5a6472;
}

.mamou-tool__file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.mamou-tool__settings {
  margin: 0 0 1.25em;
}

.mamou-tool__detect {
  margin: 0 0 1em;
  padding: 0.5em 0.9em;
  background: #eef6ef;
  border: 1px solid #cfe6d3;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95em;
  color: #276644;
}

.mamou-tool__field {
  margin: 0 0 1em;
}

.mamou-tool__select {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0.55em 0.7em;
  background: #ffffff;
  border: 1px solid #ccd2da;
  border-radius: 8px;
  color: #222222;
  font-size: 0.95em;
}

.mamou-tool__select:focus {
  outline: 2px solid #4c8bf5;
  outline-offset: 1px;
}

.mamou-tool__option {
  display: flex;
  align-items: flex-start;
  gap: 0.4em;
  font-size: 0.9em;
  max-width: 100%;
}

.mamou-tool__option input {
  margin-top: 0.2em;
  flex-shrink: 0;
}

.mamou-tool__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  margin: 1em 0 0;
}

.mamou-tool__button {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.6em 1.2em;
  background: #2c6fe0;
  border: 1px solid #2c6fe0;
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.95em;
  font-weight: 700;
  cursor: pointer;
  max-width: 100%;
}

.mamou-tool__button:hover {
  background: #2258b8;
  border-color: #2258b8;
}

.mamou-tool__button:focus-visible {
  outline: 2px solid #143d7a;
  outline-offset: 2px;
}

.mamou-tool__button:disabled {
  background: #c3ccd6;
  border-color: #c3ccd6;
  cursor: not-allowed;
}

.mamou-tool__button--secondary {
  background: #ffffff;
  border: 1px solid #ccd2da;
  color: #2c3440;
}

.mamou-tool__button--secondary:hover {
  background: #f2f4f6;
  border-color: #ccd2da;
}

.mamou-tool__button--secondary:disabled {
  background: #f2f4f6;
  color: #9aa4b0;
  border-color: #e0e4e9;
  cursor: not-allowed;
}

/* プレビュー */
.mamou-tool__preview-scroll {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid #d9dde3;
  border-radius: 8px;
}

.mamou-tool__preview-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85em;
  white-space: pre-wrap;
}

.mamou-tool__preview-table td {
  padding: 0.4em 0.6em;
  border: 1px solid #e3e7ec;
  vertical-align: top;
  word-break: break-word;
  max-width: 320px;
}

.mamou-tool__preview-table tr:nth-child(even) td {
  background: #fafbfc;
}

.mamou-tool__status {
  min-height: 1.2em;
  margin-top: 0.6em;
  font-size: 0.85em;
  color: #2c8a4f;
}

.mamou-tool__status[data-state="error"] {
  color: #c0392b;
}

@media (max-width: 480px) {
  .mamou-tool {
    padding: 1em;
    border-radius: 8px;
  }

  .mamou-tool__dropzone {
    padding: 1.25em 0.75em;
  }

  .mamou-tool__button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .mamou-tool__preview-table td {
    max-width: 200px;
  }
}
