/* ==========================================================================
   DevPilot-AI - Global Styles & Design System Tokens
   ========================================================================== */

:root {
  /* Color Tokens - Light Mode (Dashboard Image 2 Aesthetic) */
  --color-primary: #4F46E5;
  --color-primary-hover: #4338CA;
  --color-primary-light: #EEF2FF;
  --color-primary-container: #6063ee;
  --color-primary-dim: #c0c1ff;
  
  --color-background: #fcf8ff;
  --color-surface: #ffffff;
  --color-surface-container: #efecf8;
  --color-surface-container-low: #f5f2fe;
  --color-surface-container-high: #e9e6f3;
  --color-surface-container-highest: #cbd5e1;
  
  --color-on-surface: #0f172a;
  --color-on-surface-variant: #64748b;
  --color-outline: #94a3b8;
  --color-outline-variant: #e2e8f0;
  --color-secondary-container: #e3e1ed;
  --color-on-secondary-container: #64636d;
  
  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-error: #ef4444;
  --color-error-bg: #fef2f2;
  --color-info: #06b6d4;
  --color-info-bg: #ecfeff;
  
  /* Spacing */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --navbar-height: 72px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-subtle: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 10px 25px -3px rgba(79, 70, 229, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-dropdown: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Local SVG Icon System */
.material-symbols-outlined,
svg.material-symbols-outlined {
  display: inline-block;
  width: 1em;
  height: 1em;
  line-height: 1;
  vertical-align: -0.125em;
  fill: currentColor;
  stroke-width: 0;
  speak: never;
  flex-shrink: 0;
  user-select: none;
}

/* Shared Subpage Divider */
.rws-divider {
  height: 1px;
  background: var(--color-outline-variant);
}


/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  cursor: default;
  caret-color: transparent !important;
}

/* Clickable elements */
a,
button,
[role="button"],
.clickable,
label[for],
select,
summary,
input[type="button"],
input[type="submit"],
input[type="reset"],
input[type="checkbox"],
input[type="radio"],
.btn,
.btn-primary,
.btn-secondary,
.btn-icon,
.tab,
.filter-tab,
.badge-interactive,
.dev-card-interactive,
.sample-user-chip {
  cursor: pointer !important;
  caret-color: transparent !important;
}

/* Text editing cursors and carets strictly for editable inputs */
input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
textarea,
[contenteditable="true"] {
  cursor: text !important;
  caret-color: auto !important;
  user-select: text !important;
}

/* Prevent carets on headings, paragraphs, spans, and static containers */
h1, h2, h3, h4, h5, h6,
p, span, div, section, article, header, nav, aside, main, footer,
.badge, .card, .dev-card, .stat, .label, .tag {
  caret-color: transparent !important;
}

/* Disabled elements */
button:disabled,
input:disabled,
textarea:disabled,
select:disabled,
.disabled {
  cursor: not-allowed !important;
  caret-color: transparent !important;
}

/* Prevent accidental focus rings on non-interactive items */
:focus:not(:focus-visible) {
  outline: none !important;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--color-background);
  color: var(--color-on-surface);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  cursor: default;
  caret-color: transparent !important;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-on-surface);
  margin: 0;
}

/* Scrollbars */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: var(--color-outline-variant);
  border-radius: 20px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-outline);
}

/* Brand Gradients */
.bg-brand-gradient {
  background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
}
.bg-brand-subtle {
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
}
.text-gradient {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Ambient shadow */
.shadow-ambient {
  box-shadow: var(--shadow-card);
}

/* Tooltips */
.tooltip .tooltip-text {
  visibility: hidden;
  width: max-content;
  background-color: #1e293b;
  color: #ffffff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 10px;
  position: absolute;
  z-index: 100;
  left: 110%;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity var(--transition-fast);
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.sidebar-collapsed .tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Sidebar Specific Transitions */
#sidebar {
  transition: transform var(--transition-normal), width var(--transition-normal);
}
#main-content, #top-nav {
  transition: margin-left var(--transition-normal), width var(--transition-normal);
}

.sidebar-text {
  transition: opacity 200ms ease, width 200ms ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-text {
  opacity: 0;
  width: 0;
  display: none !important;
}

/* Universal Nav Link Hover & Active Polish */
#sidebar nav a {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

#sidebar nav a:hover {
  background-color: #f1f5f9;
  border-left-color: #cbd5e1;
}

#sidebar nav a:hover .material-symbols-outlined {
  color: #4f46e5;
}

#sidebar nav a.bg-indigo-50:hover,
#sidebar nav a.bg-secondary-container:hover {
  background-color: #eef2ff;
  border-left-color: #4f46e5;
}

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

@media (min-width: 640px) {
  .sidebar-collapsed #main-content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
    max-width: calc(100% - var(--sidebar-collapsed-width));
  }
  .sidebar-collapsed #top-nav {
    width: calc(100% - var(--sidebar-collapsed-width));
  }
}

/* Mobile Overlay */
#mobile-overlay {
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}
#mobile-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Sub-page top layout helper */
.subpage-container {
  min-height: 100vh;
  padding: 2rem;
}
@media (max-width: 640px) {
  .subpage-container {
    padding: 1rem;
  }
}

/* Reveal Gate */
html.preload {
  visibility: hidden;
  opacity: 0;
}
html.app-ready {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.25s ease-in;
}

/* Toast Container */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  color: var(--color-on-surface);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
  border: 1px solid var(--color-outline-variant);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  border-left: 4px solid var(--color-success);
}
.toast-success .toast-icon {
  color: var(--color-success);
}

.toast-error {
  border-left: 4px solid var(--color-error);
}
.toast-error .toast-icon {
  color: var(--color-error);
}

.toast-warning {
  border-left: 4px solid #f59e0b;
}
.toast-warning .toast-icon {
  color: #f59e0b;
}

.toast-info {
  border-left: 4px solid var(--color-primary);
}
.toast-info .toast-icon {
  color: var(--color-primary);
}

/* ==========================================================================
   Universal Smooth Theme Transitions
   ========================================================================== */
html, body, #sidebar, #top-nav, header, main,
.dev-card, .ip-metric-card, .ip-cat-card, .ip-quiz-card,
.quick-action-btn, .ip-option-btn, .filter-tab, .toast {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}


