/* ============================================
 * 物件広告文自動生成システム - グローバルスタイル
 * プレミアムダークテーマ + ガラスモーフィズム
 * ============================================ */

/* ===== CSS変数 ===== */
:root {
  /* カラーパレット */
  --bg-primary: #0a0a1a;
  --bg-secondary: #111127;
  --bg-tertiary: #1a1a3e;
  --bg-card: rgba(26, 26, 62, 0.6);
  --bg-card-hover: rgba(30, 30, 72, 0.8);
  --bg-glass: rgba(17, 17, 39, 0.85);
  --bg-input: rgba(26, 26, 62, 0.4);

  /* テキスト */
  --text-primary: #f0f0ff;
  --text-secondary: #a0a0c0;
  --text-tertiary: #6b6b8d;
  --text-muted: #4a4a6a;

  /* アクセントカラー */
  --accent-primary: #6366f1;
  --accent-primary-hover: #818cf8;
  --accent-secondary: #a855f7;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-info: #3b82f6;

  /* グラデーション */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --gradient-secondary: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --gradient-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  --gradient-bg: radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
                 radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.06) 0%, transparent 50%),
                 radial-gradient(ellipse at 50% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);

  /* ボーダー */
  --border-color: rgba(99, 102, 241, 0.15);
  --border-color-hover: rgba(99, 102, 241, 0.3);
  --border-radius-sm: 6px;
  --border-radius-md: 10px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;

  /* シャドウ */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  --shadow-glow-strong: 0 0 40px rgba(99, 102, 241, 0.25);

  /* サイドバー */
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 72px;

  /* トランジション */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* フォント */
  --font-sans: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  background-image: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0c0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ===== ローディング ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

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

/* ===== アプリコンテナ ===== */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ===== サイドバー ===== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: width var(--transition-normal), transform var(--transition-normal);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-footer .nav-label {
  display: none;
}

.sidebar-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon svg {
  width: 36px;
  height: 36px;
}

.logo-text h1 {
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.logo-subtitle {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}

.sidebar-nav > ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--gradient-glow);
  color: var(--accent-primary-hover);
  border: 1px solid var(--border-color-hover);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gradient-primary);
  border-radius: 0 4px 4px 0;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-label {
  font-size: 0.85rem;
  font-weight: 500;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
}

.nav-badge.highlight {
  background: var(--gradient-primary);
  color: white;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-color);
}

/* ===== メインコンテンツ ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

.page-container {
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== ページヘッダー ===== */
.page-header {
  margin-bottom: 32px;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* ===== カード ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-glow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-body {
  padding: 0;
}

/* ===== 統計カード ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--border-color-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.purple { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.stat-icon.orange { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.stat-icon.red { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-info h4 {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.stat-change {
  font-size: 0.75rem;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up { color: var(--accent-success); }
.stat-change.down { color: var(--accent-danger); }

/* ===== ボタン ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

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

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

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

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

.btn-ghost {
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
}

/* ===== テーブル ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-tertiary);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-top: 1px solid var(--border-color);
}

tr:hover td {
  background: var(--bg-card-hover);
}

/* ===== フォーム ===== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-label .required {
  color: var(--accent-danger);
  margin-left: 2px;
}

.form-input {
  width: 100%;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

/* ===== タグ / バッジ ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.tag-purple { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.tag-green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.tag-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.tag-orange { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.tag-red { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* ===== トースト ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 450px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}

.toast.success { border-left: 3px solid var(--accent-success); }
.toast.error { border-left: 3px solid var(--accent-danger); }
.toast.warning { border-left: 3px solid var(--accent-warning); }
.toast.info { border-left: 3px solid var(--accent-info); }

.toast-message {
  font-size: 0.875rem;
  flex: 1;
}

.toast-close {
  font-size: 1.2rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0 4px;
}

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

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

/* ===== モーダル ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.5rem;
  color: var(--text-tertiary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ===== タブ ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.tab {
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
}

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

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

/* ===== 空状態 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ===== プログレスバー ===== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 3px;
  transition: width var(--transition-slow);
}

/* ===== チェックボックス / トグル ===== */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
}

.toggle {
  width: 44px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle.active {
  background: var(--accent-primary);
}

.toggle::after {
  content: '';
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform var(--transition-fast);
}

.toggle.active::after {
  transform: translateX(20px);
}

/* ===== コンプライアンス表示 ===== */
.compliance-result {
  margin-top: 16px;
}

.violation-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--border-radius-md);
  margin-bottom: 8px;
}

.violation-item.warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}

.violation-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.violation-text {
  flex: 1;
}

.violation-text strong {
  font-size: 0.85rem;
}

.violation-text p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.highlight-ng {
  background: rgba(239, 68, 68, 0.3);
  padding: 1px 4px;
  border-radius: 3px;
  color: #fca5a5;
}

/* ===== スコアリング ===== */
.score-ring {
  width: 100px;
  height: 100px;
  position: relative;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring circle {
  fill: none;
  stroke-width: 6;
}

.score-ring .bg { stroke: var(--bg-tertiary); }
.score-ring .fill { stroke: var(--accent-primary); stroke-linecap: round; transition: stroke-dashoffset var(--transition-slow); }

.score-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

/* ===== グリッドレイアウト ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ===== ユーティリティ ===== */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.text-sm { font-size: 0.8rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-tertiary); }
.text-success { color: var(--accent-success); }
.text-danger { color: var(--accent-danger); }
.text-warning { color: var(--accent-warning); }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* ===== AI生成結果テキストエリア ===== */
.generated-text {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.8;
  white-space: pre-wrap;
  position: relative;
}

.generated-text .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ===== レスポンシブ ===== */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .stats-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .modal-content {
    width: 95%;
    padding: 20px;
  }
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-color-hover);
}

/* ===== セレクション ===== */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: white;
}

/* ===== パルスアニメーション ===== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== チャートプレースホルダー ===== */
.chart-placeholder {
  width: 100%;
  height: 200px;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}

.chart-bar {
  width: 32px;
  background: var(--gradient-primary);
  border-radius: 4px 4px 0 0;
  transition: height var(--transition-slow);
  opacity: 0.8;
}

.chart-bar:hover {
  opacity: 1;
}

/* ===== サイドバーグループナビ ===== */
.nav-group {
  margin-top: 8px;
  margin-bottom: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.nav-group:first-of-type {
  margin-top: 4px;
}

/* 独立項目セクション間のスペース */
.sidebar-nav ul > li > .nav-item[data-page="guide"],
.sidebar-nav ul > li > .nav-item[data-page="security"] {
  margin-top: 4px;
}

.sidebar-nav ul > li > .nav-item[data-page="guide"] {
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 8px;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--border-radius-md);
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: all var(--transition-fast);
}

.nav-group-toggle:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
}

.nav-group-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.nav-chevron {
  margin-left: auto;
  transition: transform var(--transition-fast);
  display: flex;
}

.nav-group-toggle.open .nav-chevron {
  transform: rotate(180deg);
}

.sidebar-nav .nav-group-items {
  display: none !important;
  flex-direction: column;
  gap: 1px;
  padding-left: 8px;
  margin-top: 2px;
  overflow: hidden;
}

.sidebar-nav .nav-group-items.open {
  display: flex !important;
  animation: groupSlideIn 0.25s ease;
}

@keyframes groupSlideIn {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 400px; }
}

.nav-group-items .nav-item {
  padding: 8px 10px;
  font-size: 0.82rem;
}

.nav-group-items .nav-icon svg {
  width: 15px;
  height: 15px;
}

.sidebar.collapsed .nav-group-toggle,
.sidebar.collapsed .nav-group-items,
.sidebar.collapsed .nav-chevron,
.sidebar.collapsed .nav-group-icon { display: none; }

/* ===== シミュレーション結果 ===== */
.sim-scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 24px 0;
}

.scenario-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  text-align: center;
  transition: all var(--transition-normal);
}

.scenario-card.optimistic { border-top: 3px solid var(--accent-success); }
.scenario-card.standard { border-top: 3px solid var(--accent-info); }
.scenario-card.pessimistic { border-top: 3px solid var(--accent-warning); }

.scenario-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }

.scenario-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.scenario-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.scenario-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ===== 査定書プレビュー ===== */
.appraisal-preview {
  background: #fff;
  color: #1a1a2e;
  border-radius: var(--border-radius-lg);
  padding: 48px;
  max-width: 800px;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
  font-family: 'Noto Sans JP', sans-serif;
}

.appraisal-preview h2 {
  color: #1a1a2e;
  background: none;
  -webkit-text-fill-color: initial;
  font-size: 1.4rem;
  border-bottom: 2px solid #6366f1;
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.appraisal-preview table {
  border: 1px solid #ddd;
  margin: 12px 0 24px;
}

.appraisal-preview th {
  background: #f0f0ff;
  color: #333;
  border: 1px solid #ddd;
}

.appraisal-preview td {
  border: 1px solid #ddd;
  color: #333;
}

.appraisal-price {
  font-size: 2.5rem;
  font-weight: 700;
  color: #6366f1;
  text-align: center;
  padding: 24px;
  background: #f8f8ff;
  border-radius: 12px;
  margin: 16px 0;
}

/* ===== プログレスバー ===== */
.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: width var(--transition-slow);
}

/* ===== タグ・バッジ ===== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
.tag-green { background: rgba(16,185,129,0.15); color: #10b981; }
.tag-orange { background: rgba(245,158,11,0.15); color: #f59e0b; }
.tag-purple { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.tag-blue { background: rgba(99,102,241,0.15); color: #6366f1; }
.tag-red { background: rgba(239,68,68,0.15); color: #ef4444; }

/* ユーティリティ */
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--text-secondary); }
.mt-lg { margin-top: 24px; }
.mb-lg { margin-bottom: 24px; }
.flex { display: flex; }
.gap-sm { gap: 8px; }
.justify-between { justify-content: space-between; }
.btn-sm { padding: 4px 12px; font-size: 0.75rem; }
.btn-danger { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ロゴ会社名 */
.logo-company { display: block; font-size: 0.65rem; color: var(--text-tertiary); margin-top: 2px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-md { margin-bottom: 12px; }

/* ガイドページ タブ切替 */
.guide-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
  scrollbar-width: thin;
}
.guide-tab {
  flex-shrink: 0;
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s;
  white-space: nowrap;
}
.guide-tab:hover {
  background: var(--surface-secondary);
  color: var(--text-primary);
}
.guide-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background: rgba(99,102,241,0.08);
  font-weight: 600;
}
.guide-panel {
  display: none;
  animation: guideFadeIn 0.25s ease;
}
.guide-panel.active {
  display: block;
}
@keyframes guideFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
