/**
 * Compath - グローバルスタイル
 */

:root {
  /* カラーパレット - Steamlytic風のslate系ダークテーマ */
  --bg-primary: #020617;      /* slate-950 */
  --bg-secondary: #0f172a;    /* slate-900 */
  --bg-card: #1e293b;         /* slate-800 */
  --bg-card-hover: #334155;   /* slate-700 */

  --text-primary: #f1f5f9;    /* slate-100 */
  --text-secondary: #94a3b8;  /* slate-400 */
  --text-muted: #64748b;      /* slate-500 */

  /* デフォルトアクセント（紫 - ホーム画面用） */
  --accent-primary: #6c5ce7;
  --accent-secondary: #a29bfe;
  --accent-gradient: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);

  --positive: #22c55e;        /* green-500 */
  --positive-bg: rgba(34, 197, 94, 0.1);
  --negative: #ef4444;        /* red-500 */
  --negative-bg: rgba(239, 68, 68, 0.1);

  --border-color: #334155;    /* slate-700 */
  --shadow-color: rgba(0, 0, 0, 0.5);

  /* メンタルガードモード用（緑・青ベース） */
  --mental-guard-bg: #0f1a1a;
  --mental-guard-accent: #26a69a;
  --mental-guard-positive: #4db6ac;

  /* フォント */
  --font-primary: 'Noto Sans JP', sans-serif;
  --font-accent: 'Orbitron', sans-serif;

  /* サイズ */
  --header-height: 60px;
  --max-width: 1200px;
  --card-radius: 12px;
  --button-radius: 8px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-primary);
}

/* ユーティリティ */
.hidden {
  display: none !important;
}

.page {
  display: none;
  min-height: 100vh;
}

.page.active {
  display: block;
}

/* コンテナ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: var(--button-radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

/* 入力フィールド */
.input-field {
  width: 100%;
  padding: 14px 18px;
  font-family: var(--font-primary);
  font-size: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--button-radius);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.input-field::placeholder {
  color: var(--text-muted);
}

/* カード */
.card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  border: 1px solid var(--border-color);
  padding: 24px;
}

/* タグ */
.tag {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-secondary);
  border-radius: 100px;
}

/* ローディング */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 1000;
}

.loading-overlay .loading-spinner {
  width: 48px;
  height: 48px;
  border-width: 3px;
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* トースト通知 */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1001;
}

.toast {
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--button-radius);
  margin-top: 10px;
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast.error {
  border-color: var(--negative);
  background: var(--negative-bg);
}

.toast.success {
  border-color: var(--positive);
  background: var(--positive-bg);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* スクロールバー */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   ツールヘッダー共通スタイル
   ======================================== */
.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.tool-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tool-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.back-button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.tool-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* 言語切り替え（ツールヘッダー用） */
.tool-header .language-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 4px;
}

.tool-header .lang-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-header .lang-btn:hover {
  color: var(--text-primary);
}

.tool-header .lang-btn.active {
  background: #6c5ce7;
  color: white;
}

/* レスポンシブ */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .container {
    padding: 0 16px;
  }

  .tool-header {
    padding: 12px 16px;
  }

  .tool-header-left {
    gap: 12px;
  }

  .tool-title {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .back-button {
    width: 36px;
    height: 36px;
  }

  .tool-header .language-switcher {
    padding: 2px;
  }

  .tool-header .lang-btn {
    padding: 4px 8px;
    font-size: 0.7rem;
  }
}
