
* {
  box-sizing: border-box;
  border-color: var(--border);
}

html {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  letter-spacing: normal;
  display: flex;
  height: 100vh;
  overflow: hidden;
  max-width: 100vw;
  font-size: var(--font-size-base);
}

/* Sidebar */

/* Main Content */
.main-content {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  height: 100vh;
  background: var(--background);
  transition: left 0.3s ease, width 0.3s ease, border-radius 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  margin-top: 15px;
  
  /* Performance hints */
  will-change: left, width, border-radius;
  transform: translateZ(0);
}

body.sidebar-collapsed .main-content {
  border-radius: 15px 0 0 0;
}
body.feature-blob-bg {
    background: var(--background); /* Solid fallback */
    padding-top: 15px;
}

/* Otimização de Performance: Efeito de Blob em Camada de GPU Separada */
body.feature-blob-bg::before {
    content: '';
    position: fixed;
    top: -25%;
    left: -25%;
    width: 150%;
    height: 150%;
    background-image: var(--sidebar-bg-blob-gradient);
    background-size: cover;
    z-index: -1;
    pointer-events: none;
    
    /* Usando transform (Compositor Only) em vez de background-position (Paint) */
    animation: moveManyBlobsTransform 20s infinite alternate ease-in-out;
    will-change: transform;
}

/* No dark theme, removemos o efeito de blob para maior sobriedade */
html.dark > body.feature-blob-bg::before {
    background-image: none!important;
}

@keyframes moveManyBlobsTransform {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(5%, 5%) rotate(2deg); }
    100% { transform: translate(-5%, 2%) rotate(-1deg); }
}
.container {
  width: 100%;
  margin: 0;
  padding: var(--space-6) var(--space-8);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header & Typography */
header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}

.title-wrap {
  flex: 1;
  min-width: 0;
}

.header-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.header-search-input {
  width: 300px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-text-sm);
  background: var(--background);
  color: var(--foreground);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.header-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.1);
}

.header-search-input::placeholder {
  color: var(--muted-foreground);
}

.project-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}


dialog button.primary,
.container button.primary,
.drawer button.primary {
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
  border-color: var(--primary) !important;
}

.project-select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: var(--font-text);
  min-width: 200px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.project-select:hover {
  border-color: var(--primary);
}

.project-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 59, 130, 246), 0.1);
}

h1 {
  margin: 0;
  font-size: var(--font-size-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--foreground);
}

.active-sprint-badge {
  color: var(--muted-foreground);
  font-weight: 400;
  font-size: 0.85em;
}

.editable:hover {
  background: var(--secondary);
  border-radius: var(--radius-sm);
  cursor: text;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--background);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--foreground);
}

.subtitle {
  margin: 4px 0 0;
  font-size: var(--font-size-base);
  color: var(--muted-foreground);
  line-height: 1.6;
  max-width: 800px;
}

/* Cards */
.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.toolbar {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.toolbar .summary-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

@media (max-width: 980px) {
  header {
    flex-direction: column;
  }

  .header-right {
    align-items: flex-start;
    width: 100%;
  }

  .header-search-input {
    width: 100%;
  }
}

/* Controls */
.controls {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
}

@media (max-width: 720px) {
  .controls {
    grid-template-columns: 1fr;
  }
}

/* Foundational Input & Select Design - DO NOT REMOVE the :not(.codex-editor *) exclusion */
.user-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-form label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

select:not(.codex-editor *):not(.lang-select),
textarea:not(.codex-editor *),
input:not([type="checkbox"]):not(.codex-editor *):not(.translation-search input):not(.user-search input):not(.user-add-field input) {
  width: 100%;
  height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  outline: none;
  font-size: var(--font-text);
  background: transparent;
  color: var(--foreground);
  transition: border-color 0.2s;
}

textarea:not(.codex-editor *) {
  height: auto;
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
  font-family: inherit;
}

input:not(.codex-editor *):focus,
select:not(.codex-editor *):focus,
textarea:not(.codex-editor *):focus {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-color: var(--ring);
}

input:not(.codex-editor *)::placeholder {
  color: var(--muted-foreground);
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Foundational Button Design - DO NOT REMOVE the :not(.codex-editor *) exclusion */
button:not(.codex-editor *):not(.sidebar *):not(.user-profile-btn) {
  /* height: 40px; */
  height: 30px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  font-size: var(--font-button);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
  border: 1px solid var(--background-secondary);
  background: var(--background);
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  -webkit-user-select: none;
  user-select: none;
  margin-right: 5px;
}

button:not(.codex-editor *):not(.sidebar *):not(.user-profile-btn):hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

button:not(.codex-editor *):not(.sidebar *):active {
  transform: scale(0.98);
}

button:not(.codex-editor *):not(.sidebar *):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

button.primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}


button.primary:hover {
  opacity: 0.9;
}

/* Drawer Buttons */
.drawer-section button.primary {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--font-button);
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.drawer-section
  button:not(.primary):not(.step-delete):not(.step-label):not(
    .drawer-close
  ):not(.secondary):not(.user-delete):not(.checklist-remove-btn):not(
    #addChecklistItemBtn
  ) {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--font-button);
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}

.drawer-section
  button:not(.primary):not(.step-delete):not(.step-label):not(
    .drawer-close
  ):not(.secondary):not(.user-delete):not(.checklist-remove-btn):not(
    #addChecklistItemBtn
  ):hover {
  background: var(--secondary);
}

/* ========== Drawer base (layout) – removido na modularização ========== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  
  /* Performance hints - Reduzido para evitar overhead de camadas */
  transform: translateZ(0);
}

.drawer-overlay.open,
.drawer-overlay.active {
  display: block;
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 98vh;
  background: var(--background);
  border-left: 1px solid var(--border);
  box-shadow: none; /* Removido daqui para não vazar quando fechado */
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  
  border-radius: 10px;
}

.drawer.open,
.drawer.active {
  right: 0;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
  margin: 10px 10px 10px 0;
  border: 1px solid var(--border);
}

.drawer-fullscreen {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
}

.drawer-header {
  padding: 12px var(--drawer-padding-x);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
  overflow: visible;
  border-radius: 10px 10px 0 0;
  min-height: 48px;
  justify-content: center;
  position: relative; /* Para posicionamento absoluto dos botões */
}

.drawer-header:has(.drawer-back) {
  padding-left: 56px; /* Espaço para o botão de voltar */
}

.drawer-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.drawer-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
  line-height: 1.2;
}

.drawer-description {
  color: var(--muted-foreground);
  margin-top: 8px;
  margin-bottom: 0;
  min-height: 1.5em;
  outline: none;
  transition: background-color 0.15s ease, outline 0.15s ease;
  border-radius: var(--radius-sm);
  padding: 4px 0;
}

.drawer-description[contenteditable="true"]:hover {
  background: var(--accent);
  padding: 4px 8px;
  margin-left: -8px;
  margin-right: -8px;
}

.drawer-description[contenteditable="true"]:focus {
  background: var(--accent);
  padding: 4px 8px;
  margin-left: -8px;
  margin-right: -8px;
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.drawer-description[contenteditable="true"]:empty:before {
  content: attr(data-placeholder);
  color: var(--muted-foreground);
  opacity: 0.6;
}

.drawer-header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  overflow: visible;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.drawer-close {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  font-size: 20px;
}

.drawer-close:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.drawer-back {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.drawer-back:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.drawer-back svg {
  width: 20px;
  height: 20px;
}

.drawer-body {
  padding: 0;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 80px;
  background: var(--background);
  
  /* Performance: isola o conteúdo para scroll mais suave */
  contain: content;
}

.drawer-footer {
  position: sticky;
  bottom: 0;
  padding: 12px var(--drawer-padding-x);
  border-top: 1px solid var(--border);
  background: var(--background);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.02);
  border-radius: 0px 0px 10px 10px;
}

.drawer-footer button {
  min-width: 120px;
}

.drawer-section {
  padding: var(--drawer-padding-y) var(--drawer-padding-x);
  border-bottom: 1px solid var(--border);
}

.drawer-section:last-child {
  border-bottom: none;
}

.drawer-section-title {
  margin: 0 0 16px 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
  line-height: 1.2;
}

/* Button group (drawers) */
.button-group {
  display: inline-flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  overflow: visible;
  position: relative;
}

.button-group > button:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.button-group-toggle {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  padding: 0 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.button-group-toggle:hover {
  background: var(--primary-hover, var(--primary));
  opacity: 0.9;
}

.button-group-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  min-width: 180px;
  overflow: hidden;
}

.button-group-menu.show {
  display: block !important;
}

.button-group-menu-item {
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--foreground);
  display: flex;
  align-items: center;
  justify-content: flex-start !important; /* Override global button centering */
  gap: 8px;
  transition: background 0.2s;
  font-size: 14px;
}

.button-group-menu-item:hover {
  background: var(--accent);
}

.button-group-menu-item svg {
  flex-shrink: 0;
}

/* Legend & filter pills */
.legend {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted-foreground);
  font-size: 13px;
}

.filter-pill {
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  opacity: 0.6;
}

.filter-pill:hover {
  opacity: 1;
  transform: scale(1.05);
}

.filter-pill.active {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--primary);
}

/* Footer da página */
.footer {
  margin-top: auto;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted-foreground);
  font-size: 13px;
}



/* Native dialog (confirm, alert, projects) */
.native-dialog {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--card, #ffffff);
  color: var(--foreground, #000000);
  max-width: 420px;
  width: calc(100vw - 48px);
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  /* Centralização perfeita via Top Layer */
  margin: auto;
  overflow: hidden;
}

.drawer-fullscreen-item {
  background: var(--background) !important;
  box-shadow: none !important;
  opacity: 0;
  z-index: 15000;
  position: fixed;
}

.drawer-fullscreen-item.active {
  animation: drawerInFull 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.native-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.dialog-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dialog-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.dialog-message {
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.5;
  margin: 0;
}

.dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.dialog-actions button {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dialog-actions button.primary:hover {
  background: var(--primary-hover, #2563eb);
  border-color: var(--primary-hover, #2563eb);
}

button.secondary,
.dialog-actions button.secondary {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
}

button.secondary:hover,
.dialog-actions button.secondary:hover {
  background: var(--muted);
  border-color: var(--border);
}
