/* ============================================
   MAPA MENTAL MAKER - Design System Variables
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

:root {
  /* --- Cores Base --- */
  --bg-primary: #F8F6F2;
  --bg-secondary: #FFFFFF;
  --bg-sidebar: #F2EFE8;
  --bg-canvas: #FAFAF7;
  --bg-hover: #EDEAE3;
  --bg-active: #E5E2DB;
  --bg-overlay: rgba(0, 0, 0, 0.3);

  /* --- Texto --- */
  --text-primary: #2D2D2D;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --text-inverse: #FFFFFF;

  /* --- Bordas --- */
  --border-color: #E5E7EB;
  --border-hover: #D1D5DB;
  --border-focus: #4F8CFF;

  /* --- Sombras --- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-drag: 0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow-blue: 0 0 0 3px rgba(79, 140, 255, 0.2);
  --shadow-glow-green: 0 0 0 3px rgba(92, 196, 137, 0.2);
  --shadow-glow-orange: 0 0 0 3px rgba(246, 169, 74, 0.2);
  --shadow-glow-purple: 0 0 0 3px rgba(154, 109, 255, 0.2);
  --shadow-glow-red: 0 0 0 3px rgba(255, 107, 107, 0.2);

  /* --- Acentos --- */
  --accent-blue: #4F8CFF;
  --accent-blue-light: #DBE8FF;
  --accent-green: #5CC489;
  --accent-green-light: #D1FAE5;
  --accent-orange: #F6A94A;
  --accent-orange-light: #FEF3C7;
  --accent-purple: #9A6DFF;
  --accent-purple-light: #EDE9FE;
  --accent-red: #FF6B6B;
  --accent-red-light: #FEE2E2;
  --accent-teal: #38BDF8;

  /* --- Nos (fundos suaves) --- */
  --node-default: #FFFFFF;
  --node-blue: #EEF4FF;
  --node-green: #ECFDF5;
  --node-orange: #FFF7ED;
  --node-purple: #F5F3FF;
  --node-red: #FEF2F2;
  --node-teal: #F0F9FF;

  /* --- Nos (borda superior) --- */
  --node-border-blue: #4F8CFF;
  --node-border-green: #5CC489;
  --node-border-orange: #F6A94A;
  --node-border-purple: #9A6DFF;
  --node-border-red: #FF6B6B;
  --node-border-teal: #38BDF8;

  /* --- Espacamento --- */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* --- Raios de borda --- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* --- Tipografia --- */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.75rem;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* --- Transicoes --- */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --- Z-index --- */
  --z-canvas: 1;
  --z-connections: 2;
  --z-nodes: 10;
  --z-node-dragging: 50;
  --z-minimap: 100;
  --z-zoom-controls: 100;
  --z-sidebar: 200;
  --z-header: 300;
  --z-context-menu: 400;
  --z-modal-overlay: 500;
  --z-modal: 510;
  --z-toast: 600;

  /* --- Layout --- */
  --header-height: 56px;
  --sidebar-width: 280px;
  --minimap-size: 160px;
  --zoom-control-width: 44px;

  /* --- Grid --- */
  --grid-dot-color: rgba(0, 0, 0, 0.07);

  /* --- Tags --- */
  --tag-blue: #4F8CFF;
  --tag-green: #5CC489;
  --tag-orange: #F6A94A;
  --tag-purple: #9A6DFF;
  --tag-red: #FF6B6B;
  --tag-teal: #38BDF8;
  --tag-pink: #F472B6;
  --tag-yellow: #FBBF24;
}

/* --- DARK MODE --- */
[data-theme="dark"] {
  --bg-primary: #1A1B1E;
  --bg-secondary: #25262B;
  --bg-sidebar: #1E1F23;
  --bg-canvas: #141517;
  --bg-hover: #2C2D32;
  --bg-active: #373A40;
  --bg-overlay: rgba(0, 0, 0, 0.6);

  --text-primary: #E4E5E7;
  --text-secondary: #909296;
  --text-muted: #5C5F66;
  --text-inverse: #1A1B1E;

  --border-color: #373A40;
  --border-hover: #4A4D54;
  --border-focus: #4F8CFF;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-drag: 0 12px 32px rgba(0, 0, 0, 0.45);

  --node-default: #25262B;
  --node-blue: #1C2A3F;
  --node-green: #1A2E24;
  --node-orange: #2E2518;
  --node-purple: #231E36;
  --node-red: #2E1C1C;
  --node-teal: #1A2A33;

  --grid-dot-color: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] ::selection {
  background-color: rgba(79, 140, 255, 0.3);
}

/* --- Selecao de texto --- */
::selection {
  background-color: var(--accent-blue-light);
  color: var(--text-primary);
}

/* --- Scrollbar customizada --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

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

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

/* --- Focus visible --- */
:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* --- Links --- */
a {
  color: var(--accent-blue);
  text-decoration: none;
}

/* --- Listas --- */
ul, ol {
  list-style: none;
}

/* --- Imagens --- */
img, svg {
  display: block;
  max-width: 100%;
}

/* --- Inputs --- */
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

/* --- Utilitarios --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
