/* ==========================================================================
   CFMJ CBT Application - Modern Design System & Base Styles
   ========================================================================== */

:root {
  /* Color Palette - Modern Slate & Indigo */
  --bg-app: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #334155;
  --bg-surface-subtle: #090d16;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-border: rgba(59, 130, 246, 0.35);
  
  --accent: #6366f1;
  --accent-light: rgba(99, 102, 241, 0.15);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --success-border: rgba(16, 185, 129, 0.4);
  
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(239, 68, 68, 0.4);
  
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  --warning-border: rgba(245, 158, 11, 0.4);
  
  --info: #06b6d4;
  --info-light: rgba(6, 182, 212, 0.15);
  
  /* Confidence Colors (A-D) */
  --conf-a: #10b981;
  --conf-a-bg: rgba(16, 185, 129, 0.12);
  --conf-b: #3b82f6;
  --conf-b-bg: rgba(59, 130, 246, 0.12);
  --conf-c: #f59e0b;
  --conf-c-bg: rgba(245, 158, 11, 0.12);
  --conf-d: #f43f5e;
  --conf-d-bg: rgba(244, 63, 94, 0.12);

  /* Layout & Geometry */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.45);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Font Stacks */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-surface-subtle: #e2e8f0;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --primary-light: rgba(59, 130, 246, 0.1);
  --primary-border: rgba(59, 130, 246, 0.3);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-base);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Container Layout */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Navigation Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--bg-surface-elevated);
  box-shadow: var(--shadow-sm);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.nav-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-elevated);
}

.nav-btn.active {
  color: var(--primary);
  background-color: var(--primary-light);
  border-color: var(--primary-border);
}

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--bg-surface-elevated);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-elevated);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Common Card & Panel Containers */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-surface-elevated);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

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

.btn-secondary:hover:not(:disabled) {
  background-color: #475569;
}

.btn-outline {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: var(--bg-surface-elevated);
}

.btn-outline:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background-color: var(--bg-surface-elevated);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.badge-success {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-danger {
  background-color: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.badge-warning {
  background-color: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

/* Typography Utilities */
h1, h2, h3, h4, h5 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
}

p {
  color: var(--text-secondary);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-surface-elevated);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--bg-surface-elevated);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}
