/**
 * CHEFE PRO - BLOCO DE NOTAS DO WINDOWS 11 (NOTEPAD REPLICA)
 * Renderização pixel-perfect inspirada na captura do cliente.
 * Etapa 9 (07/10/2026): as cores vivem em variáveis --np-*: escuras em :root, claras em body.theme-light
 * (antes o Bloco de Notas era 100% escuro fixo e ficava preto no tema claro).
 */

:root {
  --np-bg: #202020;
  --np-bar: #181818;
  --np-tab: #181818;
  --np-tab-hover: #232323;
  --np-tab-ativa: #1e1e1e;
  --np-editor: #1e1e1e;
  --np-text: #f1f1f1;
  --np-text-sec: #aaaaaa;
  --np-text-menu: #cccccc;
  --np-text-item: #dddddd;
  --np-text-forte: #ffffff;
  --np-atalho: #888888;
  --np-menu: #2b2b2b;
  --np-menu-sombra: 0 12px 35px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --np-status: #1a1a1a;
  --np-status-text: #aaaaaa;
  --np-linha: rgba(255, 255, 255, 0.06);
  --np-linha-forte: rgba(255, 255, 255, 0.12);
  --np-hover: rgba(255, 255, 255, 0.08);
  --np-hover-forte: rgba(255, 255, 255, 0.12);
  --np-btn-bg: rgba(255, 255, 255, 0.06);
  --np-btn-border: rgba(255, 255, 255, 0.1);
  --np-scroll: #3a3a3a;
  --np-scroll-hover: #555555;
  --np-sombra: 0 20px 50px rgba(0, 0, 0, 0.7);
  --np-selecao: rgba(16, 185, 129, 0.35);
  --np-destaque: #10b981;
  --np-destaque-hover: #34d399;
  --np-destaque-texto: #022c22;
  --np-fechar: #e81123;
  --np-drop-text: #888888;
  --np-drop-bg: rgba(0, 0, 0, 0.2);
  --np-drop-ativo: rgba(16, 185, 129, 0.1);
}

body.theme-light {
  --np-bg: #f3f3f3;
  --np-bar: #e9e9e9;
  --np-tab: #e9e9e9;
  --np-tab-hover: #f6f6f6;
  --np-tab-ativa: #ffffff;
  --np-editor: #ffffff;
  --np-text: #1e293b;
  --np-text-sec: #555555;
  --np-text-menu: #333333;
  --np-text-item: #222222;
  --np-text-forte: #0f172a;
  --np-atalho: #777777;
  --np-menu: #ffffff;
  --np-menu-sombra: 0 12px 35px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.08);
  --np-status: #e2e8f0;
  --np-status-text: #475569;
  --np-linha: rgba(0, 0, 0, 0.08);
  --np-linha-forte: rgba(0, 0, 0, 0.14);
  --np-hover: rgba(0, 0, 0, 0.06);
  --np-hover-forte: rgba(0, 0, 0, 0.1);
  --np-btn-bg: rgba(0, 0, 0, 0.05);
  --np-btn-border: rgba(0, 0, 0, 0.12);
  --np-scroll: #c1c1c1;
  --np-scroll-hover: #a3a3a3;
  --np-sombra: 0 20px 50px rgba(15, 23, 42, 0.18);
  --np-selecao: rgba(16, 185, 129, 0.3);
  --np-destaque: #059669;
  --np-destaque-hover: #047857;
  --np-destaque-texto: #ffffff;
  --np-fechar: #e81123;
  --np-drop-text: #64748b;
  --np-drop-bg: rgba(0, 0, 0, 0.03);
  --np-drop-ativo: rgba(16, 185, 129, 0.12);
}

.notepad-window-container {
  background: var(--np-bg);
  border: 1px solid var(--np-linha-forte);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--np-sombra);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
  min-height: 650px;
}

/* 1. BARRA DE TÍTULO E ABAS (WINDOWS 11 STYLE) */
.notepad-titlebar {
  background: var(--np-bar);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.5rem 0 0.75rem;
  height: 42px;
  border-bottom: 1px solid var(--np-linha);
  user-select: none;
}

.notepad-tabs-track {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
  padding-top: 6px;
  overflow-x: auto;
  max-width: calc(100% - 160px);
  scrollbar-width: thin;
}

.notepad-tabs-track::-webkit-scrollbar {
  height: 3px;
}

.notepad-tabs-track::-webkit-scrollbar-thumb {
  background: var(--np-scroll);
  border-radius: 3px;
}

.notepad-tab {
  background: var(--np-tab);
  color: var(--np-text-sec);
  font-family: 'Segoe UI', -apple-system, sans-serif;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  border-top: 1px solid var(--np-linha);
  border-left: 1px solid var(--np-linha);
  border-right: 1px solid var(--np-linha);
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s ease;
  user-select: none;
}

.notepad-tab:hover {
  background: var(--np-tab-hover);
  color: var(--np-text-forte);
}

.notepad-tab.active {
  background: var(--np-tab-ativa);
  color: var(--np-text-forte);
  font-weight: 600;
  border-top: 1px solid rgba(16, 185, 129, 0.4);
  border-bottom: 2px solid var(--np-destaque);
  box-shadow: 0 -2px 10px rgba(16, 185, 129, 0.15);
}

.tab-icon {
  font-size: 14px;
  opacity: 0.85;
}

.tab-title {
  font-weight: 500;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-close-btn {
  background: none;
  border: none;
  color: var(--np-text-sec);
  font-size: 12px;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tab-close-btn:hover {
  background: var(--np-hover);
  color: var(--np-text-forte);
}

.notepad-tab-add {
  background: none;
  border: none;
  color: var(--np-text-sec);
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 2px;
}

.notepad-tab-add:hover {
  background: var(--np-hover);
  color: var(--np-text-forte);
}

.notepad-window-controls {
  display: flex;
  align-items: center;
}

.win-control-btn {
  background: none;
  border: none;
  color: var(--np-text-sec);
  width: 44px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.win-control-btn:hover {
  background: var(--np-hover);
  color: var(--np-text-forte);
}

.win-control-btn.close:hover {
  background: var(--np-fechar);
  color: #ffffff;
}

/* 2. MENU BAR (ARQUIVO, EDITAR, EXIBIR) */
.notepad-menubar {
  background: var(--np-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  border-bottom: 1px solid var(--np-linha);
  font-family: 'Segoe UI', -apple-system, sans-serif;
  font-size: 12px;
}

.menu-items-left {
  display: flex;
  align-items: center;
  gap: 2px;
}

.menu-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.menu-item-btn {
  background: none;
  border: none;
  color: var(--np-text-menu);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.menu-item-btn:hover,
.menu-dropdown-wrapper:hover .menu-item-btn {
  background: var(--np-hover);
  color: var(--np-text-forte);
}

.menu-dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--np-menu);
  min-width: 230px;
  box-shadow: var(--np-menu-sombra);
  border-radius: 6px;
  padding: 5px 0;
  z-index: 100;
  animation: fadeInMenu 0.12s ease-out;
}

@keyframes fadeInMenu {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-dropdown-wrapper:hover .menu-dropdown-content {
  display: block;
}

.menu-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: none;
  color: var(--np-text-item);
  font-size: 12px;
  font-family: 'Segoe UI', -apple-system, sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.menu-dropdown-item:hover {
  background: var(--np-hover-forte);
  color: var(--np-text-forte);
}

.menu-dropdown-item .item-shortcut {
  font-size: 10px;
  color: var(--np-atalho);
  font-family: var(--font-mono);
}

.menu-divider {
  height: 1px;
  background: var(--np-linha);
  margin: 4px 0;
}

/* Janela do Bloco de Notas Maximizada */
.notepad-window-container.maximized {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: 100vh !important;
  width: 100vw !important;
  max-width: 100vw !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  border: none !important;
}

.notepad-window-container.minimized {
  height: 42px !important;
  min-height: 42px !important;
  overflow: hidden !important;
}

.menu-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-notepad-action {
  background: var(--np-btn-bg);
  border: 1px solid var(--np-btn-border);
  color: var(--np-text-forte);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-notepad-action:hover {
  background: var(--np-hover-forte);
}

.btn-notepad-action.destaque-analisar {
  background: var(--np-destaque);
  color: var(--np-destaque-texto);
  font-weight: 700;
  border: none;
}

.btn-notepad-action.destaque-analisar:hover {
  background: var(--np-destaque-hover);
}

/* 3. ÁREA DE TEXTO PRINCIPAL (EDITOR) */
.notepad-editor-body {
  flex: 1;
  position: relative;
  display: flex;
  background: var(--np-editor);
  overflow: hidden;
}

.notepad-textarea {
  width: 100%;
  height: 100%;
  background: var(--np-editor);
  color: var(--np-text);
  font-family: 'Consolas', 'Segoe UI Mono', 'JetBrains Mono', monospace;
  font-size: 13.5px;
  line-height: 1.6;
  border: none;
  resize: none;
  padding: 14px 18px;
  outline: none;
  white-space: pre;
  tab-size: 4;
  overflow-y: scroll;
  overflow-x: auto;
}

.notepad-textarea::selection {
  background: var(--np-selecao);
  color: var(--np-text-forte);
}

/* Scrollbar estilo Windows 11 */
.notepad-textarea::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.notepad-textarea::-webkit-scrollbar-track {
  background: var(--np-editor);
}

.notepad-textarea::-webkit-scrollbar-thumb {
  background: var(--np-scroll);
  border-radius: 6px;
  border: 3px solid var(--np-editor);
}

.notepad-textarea::-webkit-scrollbar-thumb:hover {
  background: var(--np-scroll-hover);
}

/* 4. BARRA DE STATUS (WINDOWS 11 STATUS BAR) */
.notepad-statusbar {
  background: var(--np-status);
  border-top: 1px solid var(--np-linha);
  padding: 3px 12px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
  font-family: 'Segoe UI', -apple-system, sans-serif;
  font-size: 11.5px;
  color: var(--np-status-text);
  user-select: none;
}

.status-cell {
  padding: 2px 4px;
}

.status-cell:hover {
  background: var(--np-hover);
  color: var(--np-text-forte);
  border-radius: 2px;
}

/* ZONA DE ARRASTO TXT RÁPIDO */
.dropzone-txt-overlay {
  border: 2px dashed var(--np-linha-forte);
  border-radius: 6px;
  margin: 8px 12px;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--np-drop-text);
  background: var(--np-drop-bg);
  transition: all 0.2s;
}

.dropzone-txt-overlay.drag-active {
  border-color: var(--np-destaque);
  background: var(--np-drop-ativo);
  color: var(--np-destaque);
}
