/* ==========================================================================
   Virtual Coach - Codeverse Brand Theme
   Palette sampled from https://www.codeverse.co.uk
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. COLOR TOKENS - Light Theme (Default)
   -------------------------------------------------------------------------- */
:root {
  /* Background colors */
  --bg-primary: #f8f9fc;
  --bg-secondary: #f1f3f8;
  --bg-tertiary: #e8ebf2;
  
  /* Surface colors */
  --surface-card: #ffffff;
  --surface-card-hover: #fafbfd;
  --surface-soft: #f1f5f9;
  --surface-soft-hover: #e8edf4;
  --surface-elevated: #ffffff;
  
  /* Text colors */
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --text-inverse: #ffffff;
  
  /* Border colors */
  --border-default: #e5e7eb;
  --border-subtle: #f1f3f5;
  --border-strong: #d1d5db;
  --border-focus: #24723a;
  
  /* Brand colors */
  --brand-primary: #197729;
  --brand-primary-hover: #155f23;
  --brand-primary-light: #eaf5ee;
  --brand-secondary: #24723a;
  --brand-secondary-hover: #1d5c2f;
  --brand-secondary-light: #edf7f1;
  
  /* Status colors */
  --status-success: #10b981;
  --status-success-bg: #ecfdf5;
  --status-success-border: #a7f3d0;
  --status-warning: #f59e0b;
  --status-warning-bg: #fffbeb;
  --status-warning-border: #fde68a;
  --status-error: #ef4444;
  --status-error-bg: #fef2f2;
  --status-error-border: #fecaca;
  --status-info: #24723a;
  --status-info-bg: #edf7f1;
  --status-info-border: #b9dec6;

  /* Conversation/chat semantic colors */
  --chat-learner-bg: var(--brand-secondary);
  --chat-learner-bg-hover: var(--brand-secondary-hover);
  --chat-learner-text: var(--text-inverse);
  --chat-coach-bg: var(--surface-soft);
  --chat-coach-border: var(--border-subtle);
  --chat-coach-text: var(--text-primary);
  --chat-meta-text: var(--text-muted);
  --chat-system-bg: var(--surface-soft);
  --chat-system-border: var(--border-subtle);
  --chat-system-text: var(--text-secondary);
  --chat-review-badge-bg: var(--surface-soft);
  --chat-review-badge-border: var(--border-subtle);
  --chat-review-badge-text: var(--text-muted);
  
  /* Sidebar specific */
  --sidebar-bg: #191514;
  --sidebar-bg-hover: #2b2523;
  --sidebar-text: #c3bbb5;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #3a3330;
  --sidebar-icon: #a49b95;
  --sidebar-icon-active: #ffffff;
  
  /* Header specific */
  --header-bg: #ffffff;
  --header-border: #e5e7eb;
  
  /* Shadow tokens */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-card: 0 1px 3px rgb(0 0 0 / 0.06), 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow-card-hover: 0 4px 12px rgb(0 0 0 / 0.08), 0 2px 4px rgb(0 0 0 / 0.04);
  
  /* Spacing tokens */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Border radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Layout */
  --sidebar-width: 16rem;
  --sidebar-collapsed-width: 4rem;
  --header-height: 3.5rem;
  --content-max-width: 1400px;
  
  /* Typography */
  --font-sans: "Nunito Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
}

/* --------------------------------------------------------------------------
   2. COLOR TOKENS - Dark Theme
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  /* Background colors */
  --bg-primary: #0a0f1a;
  --bg-secondary: #0f1629;
  --bg-tertiary: #151d30;
  
  /* Surface colors */
  --surface-card: #111827;
  --surface-card-hover: #1a2234;
  --surface-soft: #1e293b;
  --surface-soft-hover: #273548;
  --surface-elevated: #1a2234;
  
  /* Text colors */
  --text-primary: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;
  --text-inverse: #111827;
  
  /* Border colors */
  --border-default: #374151;
  --border-subtle: #1f2937;
  --border-strong: #4b5563;
  --border-focus: #5fa837;
  
  /* Brand colors (adjusted for dark) */
  --brand-primary-light: #102416;
  --brand-secondary-light: #163322;
  
  /* Status colors (adjusted for dark) */
  --status-success-bg: #052e16;
  --status-success-border: #166534;
  --status-warning-bg: #451a03;
  --status-warning-border: #92400e;
  --status-error-bg: #450a0a;
  --status-error-border: #991b1b;
  --status-info-bg: #132b1c;
  --status-info-border: #2f7f4a;

  /* Conversation/chat semantic colors (dark) */
  --chat-learner-bg: #24723a;
  --chat-learner-bg-hover: #1d5c2f;
  --chat-learner-text: #ffffff;
  --chat-coach-bg: #182233;
  --chat-coach-border: #2a3850;
  --chat-coach-text: var(--text-primary);
  --chat-meta-text: #94a3b8;
  --chat-system-bg: #182233;
  --chat-system-border: #2a3850;
  --chat-system-text: #cbd5e1;
  --chat-review-badge-bg: #1f2937;
  --chat-review-badge-border: #334155;
  --chat-review-badge-text: #94a3b8;
  
  /* Sidebar (stays dark in both themes) */
  --sidebar-bg: #141110;
  --sidebar-bg-hover: #221d1b;
  --sidebar-border: #312b29;
  
  /* Header */
  --header-bg: #111827;
  --header-border: #1f2937;
  
  /* Shadows (darker for dark mode) */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-card: 0 1px 3px rgb(0 0 0 / 0.2), 0 1px 2px rgb(0 0 0 / 0.15);
  --shadow-card-hover: 0 4px 12px rgb(0 0 0 / 0.3), 0 2px 4px rgb(0 0 0 / 0.2);
}

/* --------------------------------------------------------------------------
   3. BASE STYLES
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  font-family: var(--font-sans);
}

/* Force Nunito Sans across Tailwind defaults/utilities */
body,
button,
input,
select,
textarea {
  font-family: var(--font-sans) !important;
}

.font-sans {
  font-family: var(--font-sans) !important;
}

/* Inline code spans: <pre class="inline"> renders like a backtick code span */
pre.inline {
  display: inline !important;
  font-family: var(--font-mono) !important;
  font-size: 0.875em !important;
  padding: 0.125rem 0.375rem !important;
  border-radius: 0.25rem !important;
  white-space: pre-wrap !important;
  background: var(--surface-soft) !important;
  color: var(--text-primary) !important;
}

[data-theme="dark"] pre.inline {
  background: #21262d !important;
  color: #e6edf3 !important;
}

/* --------------------------------------------------------------------------
   4. COMPONENT STYLES
   -------------------------------------------------------------------------- */

/* Cards */
.vc-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

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

.vc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.vc-card-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.vc-card-body {
  padding: var(--spacing-lg);
}

/* Buttons */
.vc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.vc-btn-primary {
  background: var(--brand-primary);
  color: var(--text-inverse);
  border-color: var(--brand-primary);
}

.vc-btn-primary:hover {
  background: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
}

.vc-btn-secondary {
  background: var(--brand-secondary);
  color: var(--text-inverse);
  border-color: var(--brand-secondary);
}

.vc-btn-secondary:hover {
  background: var(--brand-secondary-hover);
  border-color: var(--brand-secondary-hover);
}

.vc-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.vc-btn-ghost:hover {
  background: var(--surface-soft);
  color: var(--text-primary);
}

.vc-btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.vc-btn-outline:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
}

/* Badge */
.vc-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-full);
}

.vc-badge-success {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.vc-badge-warning {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.vc-badge-error {
  background: var(--status-error-bg);
  color: var(--status-error);
}

.vc-badge-info {
  background: var(--status-info-bg);
  color: var(--status-info);
}

.vc-badge-default {
  background: var(--surface-soft);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

/* Node-type specific badge colours */
.vc-badge-skill {
  background: var(--brand-secondary-light);
  color: var(--brand-secondary);
  border: 1px solid var(--brand-secondary);
}

.vc-badge-lesson {
  background: var(--status-info-bg);
  color: var(--status-info);
  border: 1px solid var(--status-info-border);
}

.vc-badge-content {
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid var(--status-success-border);
}

.vc-badge-activity {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid var(--status-warning-border);
}

/* Stats display */
.vc-stat {
  text-align: center;
  padding: var(--spacing-md);
}

.vc-stat-icon {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-xs);
}

.vc-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.vc-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Form inputs */
.vc-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.875rem;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.vc-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-secondary-light);
}

.vc-input::placeholder {
  color: var(--text-subtle);
}

.vc-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Links */
.vc-link {
  color: var(--brand-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.vc-link:hover {
  color: var(--brand-secondary-hover);
}

/* Sidebar nav item */
.vc-nav-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.vc-nav-item:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-active);
}

.vc-nav-item.active {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text-active);
}

.vc-nav-item svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* Divider */
.vc-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--spacing-md) 0;
}

/* Avatar */
.vc-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: var(--brand-secondary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}

/* Period selector (like Today/Week/Month) */
.vc-period-selector {
  display: inline-flex;
  gap: var(--spacing-xs);
  background: var(--surface-soft);
  padding: var(--spacing-xs);
  border-radius: var(--radius-lg);
}

.vc-period-btn {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.vc-period-btn.active {
  background: var(--brand-primary);
  color: var(--text-inverse);
}

/* Empty state */
.vc-empty {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--text-muted);
}

.vc-empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

/* Loading state */
.vc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   5. UTILITY CLASSES
   -------------------------------------------------------------------------- */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-brand { color: var(--brand-primary); }
.text-success { color: var(--status-success); }
.text-warning { color: var(--status-warning); }
.text-error { color: var(--status-error); }

.bg-primary { background-color: var(--bg-primary); }
.bg-card { background-color: var(--surface-card); }
.bg-soft { background-color: var(--surface-soft); }

.border-default { border-color: var(--border-default); }
.border-subtle { border-color: var(--border-subtle); }

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

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

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.animate-fade-in {
  animation: fadeIn var(--transition-normal);
}

.animate-slide-in {
  animation: slideIn var(--transition-normal);
}
