/* ========================================
   🐙＠2147 Top War Tools - 共通スタイル
   ======================================== */

/* テーマ変数 */
:root {
  /* Light テーマ (デフォルト) */
  --bg-primary: #F8FAFC;
  --bg-secondary: #E2E8F0;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --border-card: #E2E8F0;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --accent: #3B82F6;
  --accent-hover: #2563EB;
  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --gold: #F0C040;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="ocean"] {
  --bg-primary: #E0F2FE;
  --bg-secondary: #BAE6FD;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F0F9FF;
  --border-card: #7DD3FC;
  --text-primary: #0C4A6E;
  --text-secondary: #0369A1;
  --text-muted: #38BDF8;
  --accent: #0EA5E9;
  --accent-hover: #0284C7;
}

[data-theme="sakura"] {
  --bg-primary: #FDF2F8;
  --bg-secondary: #FCE7F3;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FDF2F8;
  --border-card: #F9A8D4;
  --text-primary: #831843;
  --text-secondary: #BE185D;
  --text-muted: #F472B6;
  --accent: #EC4899;
  --accent-hover: #DB2777;
}

[data-theme="punk"] {
  --bg-primary: #1A1A2E;
  --bg-secondary: #16213E;
  --bg-card: #0F0F1A;
  --bg-card-hover: #1A1A2E;
  --border-card: #4A0E0E;
  --text-primary: #E94560;
  --text-secondary: #FF6B6B;
  --text-muted: #7B2D26;
  --accent: #00FF88;
  --accent-hover: #00CC6A;
  --danger: #FF4757;
  --success: #00FF88;
  --warning: #FFE66D;
  --gold: #FFD93D;
  --shadow-sm: 0 1px 3px rgba(233, 69, 96, 0.2);
  --shadow-md: 0 4px 8px rgba(233, 69, 96, 0.25);
  --shadow-lg: 0 10px 20px rgba(233, 69, 96, 0.3);
}

[data-theme="retro"] {
  --bg-primary: #2B2D42;
  --bg-secondary: #3D405B;
  --bg-card: #1D1E2C;
  --bg-card-hover: #2B2D42;
  --border-card: #5C5F7A;
  --text-primary: #8BF5C5;
  --text-secondary: #5DD39E;
  --text-muted: #457B5F;
  --accent: #FFE66D;
  --accent-hover: #FFD93D;
  --danger: #FF6B6B;
  --success: #8BF5C5;
  --warning: #FFE66D;
  --gold: #FFD700;
  --shadow-sm: 0 2px 0 #1D1E2C;
  --shadow-md: 0 4px 0 #1D1E2C;
  --shadow-lg: 0 6px 0 #1D1E2C;
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;
}

/* レトロテーマ特殊効果 */
[data-theme="retro"] body {
  font-family: 'Courier New', 'MS Gothic', monospace;
  image-rendering: pixelated;
}

[data-theme="retro"] .card,
[data-theme="retro"] .btn,
[data-theme="retro"] .input-field {
  box-shadow: var(--shadow-md);
  border-width: 2px;
}

[data-theme="retro"] .btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* パンクハザードテーマ特殊効果 */
[data-theme="punk"] .card {
  border-left: 3px solid var(--accent);
}

[data-theme="punk"] .site-header {
  background: linear-gradient(135deg, var(--bg-card) 0%, #1A0A0A 100%);
  border-bottom: 2px solid var(--danger);
}

[data-theme="punk"] .btn {
  text-shadow: 0 0 8px var(--accent);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

[data-theme="punk"] .btn:hover {
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

/* RTL対応（アラビア語） */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

/* ベースリセット */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* 共通レイアウト */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* ヘッダー */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-card);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 18px;
}

.site-logo-icon {
  font-size: 24px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ドロップダウン */
.dropdown {
  position: relative;
}

.dropdown-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  z-index: 200;
  display: none;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  text-align: left;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: var(--bg-secondary);
}

.dropdown-item.active {
  color: var(--accent);
  font-weight: 600;
}

/* カード */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

/* ツールカード（トップページ用） */
.tool-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.tool-card-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.tool-card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.tool-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.tool-card-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-secondary);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* グリッド */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* 入力フィールド */
.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.input-field {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border-card);
}

/* タブ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-card);
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* 結果パネル */
.result-panel {
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
}

.result-panel.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.result-panel.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.result-panel.danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.result-value {
  font-size: 28px;
  font-weight: 700;
}

.result-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* フッター */
.site-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ユーティリティ */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.text-gold { color: var(--gold); }

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* レスポンシブ */
@media (max-width: 600px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .site-logo {
    font-size: 16px;
  }
}
