/* =========================
   Cisco IPoE Config Generator
   共通スタイル
   ========================= */

/* ========== 1. ベーススタイル ========== */
:root {
  /* ライトモードの色定義 */
  --bg-primary: #f8f8f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #fafafa;
  --text-primary: #333;
  --text-secondary: #666;
  --border-color: #aaa;
  --border-light: #ccc;
  --accent-color: #2a4d8f;
  --accent-hover: #4a6fdc;
  --code-bg: #eeeeee;
  --code-text: #000;
  --warning-bg: #fff3cd;
  --warning-border: #ffc107;
  --warning-text: #856404;
  --shadow: rgba(0,0,0,0.06);
}

body {
  font-family: monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  margin: 20px;
  line-height: 1.4;
}

/* ========== 2. フォームとカードレイアウト ========== */
form#configForm,
#resultArea {
  max-width: 900px;
  margin: 20px auto;
  padding: 20px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 2px 6px var(--shadow);
}

form#configForm h2,
#resultArea h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 1.3rem;
  color: var(--accent-color);
}

form {
  max-width: 600px;
  margin: 0 auto;
}

/* ========== 3. 入力フィールド ========== */
input[type="text"],
select {
  padding: 8px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  font-size: 1em;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
}

input[type="radio"] {
  transform: scale(1.1);
  margin-right: 6px;
  vertical-align: middle;
}

/* ========== 4. Fieldset ========== */
fieldset {
  border: 1px solid var(--border-color);
  padding: 15px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  border-radius: 6px;
}

fieldset label {
  font-size: 1em;
  line-height: 1.6;
  margin-right: 15px;
  vertical-align: middle;
}

legend {
  font-weight: bold;
  color: var(--accent-color);
  font-size: 1.15em;
  padding: 0 8px;
}

/* ========== 5. ボタン ========== */
input[type="submit"],
.action-btn {
  padding: 10px 20px;
  font-size: 1em;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: monospace;
  transition: background 0.3s;
}

input[type="submit"] {
  width: 100%;
  font-size: 1.1em;
}

input[type="submit"]:hover,
.action-btn:hover {
  background: var(--accent-hover);
}

.action-btn:disabled {
  background: #999;
  cursor: not-allowed;
  opacity: 0.6;
}

.copy-btn {
  margin-top: 10px;
  background-color: #007acc;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.95em;
  cursor: pointer;
  transition: background 0.3s;
}

.copy-btn:hover {
  background-color: #005fa3;
}

.button-group {
  margin: 20px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ========== 6. Config出力エリア ========== */
.config-box {
  margin-top: 4px;
  border-radius: 6px;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  background: var(--bg-tertiary);
}

.config-box pre,
pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 15px;
  border-radius: 6px;
  line-height: 1.4;
  font-family: monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 6px 0 10px 0;
  overflow-x: auto;
}

pre code {
  display: block;
  background-color: inherit;
  padding: 0;
  font-family: monospace;
  white-space: pre;
  line-height: 1.5;
  border: none;
}

/* ========== 7. IP補正の注意書き ========== */
#ipCorrectionNote {
  padding: 12px;
  margin: 12px 0;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 6px;
  color: var(--warning-text);
  line-height: 1.6;
  font-size: 0.9em;
}

#ipCorrectionNote code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  color: #d63384;
  font-weight: bold;
  font-size: 0.95em;
}

#ipCorrectionNote small {
  color: #6c5400;
  font-size: 0.85em;
}

/* ========== 8. その他 ========== */
.version-info {
  text-align: left;
  font-size: 0.8em;
  color: var(--text-secondary);
  margin-top: 0;
}

/* ========== 9. モバイル最適化 ========== */
@media (max-width: 600px) {
  body {
    margin: 10px;
  }

  form#configForm,
  #resultArea {
    margin: 10px 5px;
    padding: 16px 10px;
  }

  fieldset {
    padding: 10px;
  }

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

  .action-btn {
    width: 100%;
  }
}

/* ========== 10. ダークモード ========== */
@media (prefers-color-scheme: dark) {
  :root {
    /* ダークモードの色定義 */
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #1d1d1d;
    --text-primary: #e0e0e0;
    --text-secondary: #999;
    --border-color: #555;
    --border-light: #444;
    --accent-color: #4a6fdc;
    --accent-hover: #6a8ffc;
    --code-bg: #252525;
    --code-text: #f5f5f5;
    --warning-bg: #664d03;
    --warning-border: #997404;
    --warning-text: #ffecb5;
    --shadow: rgba(0,0,0,0.5);
  }

  input[type="text"],
  select {
    background: #2b2b2b;
    color: #fff;
    border-color: var(--border-light);
  }

  #ipCorrectionNote code {
    background: var(--bg-secondary);
    color: #ffc107;
  }

  #ipCorrectionNote small {
    color: #d4a500;
  }

  /* リンクの色調整 */
  a {
    color: #66aaff;
  }

  a:hover {
    color: #99ccff;
  }

  h3 {
    color: #80bfff;
  }
}