/* Importação de fontes e ícones */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css");

/* Reset e Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background-color: #f4f7f9;
  color: #334155;
  line-height: 1.6;
}

/* Topbar */
#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #1e293b;
  color: #e2e8f0;
  padding: 12px 24px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 20px;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-weight: 500;
  color: #94a3b8;
}

/* Layout */
#app {
  display: flex;
  height: calc(100vh - 60px);
}

/* Sidebar */
#sidebar {
  width: 280px;
  background-color: #1f2937;
  color: #e5e7eb;
  padding: 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #334155;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.sidebar-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-tree {
  list-style: none;
  font-size: 15px;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.file-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.file-item.active {
  background-color: #3b82f6;
  color: white;
  font-weight: 500;
}

/* Editor */
#editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
}

.editor-header {
  background-color: #f1f5f9;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
}

#fileName {
  font-weight: 500;
  color: #475569;
}

#fileContent {
  flex: 1;
  border: none;
  padding: 20px;
  font-family: "Fira Code", monospace;
  font-size: 16px;
  outline: none;
  resize: none;
  background-color: #f8fafc;
  color: #1e293b;
}

/* Botões */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background-color: #22c55e;
  color: white;
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}
.btn-primary:hover {
  background-color: #16a34a;
}

.btn-secondary {
  background-color: #ef4444;
  color: white;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}
.btn-secondary:hover {
  background-color: #dc2626;
}

.btn-save {
  background-color: #3b82f6;
  color: white;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}
.btn-save:hover {
  background-color: #2563eb;
}

.btn-icon {
  background-color: transparent;
  border: none;
  font-size: 18px;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.2s;
}
.btn-icon:hover {
  color: #cbd5e1;
}

/* Menu de contexto */
.context-menu {
  position: absolute;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 0;
  list-style: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.context-menu li {
  padding: 10px 18px;
  cursor: pointer;
  font-size: 14px;
  color: #475569;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.context-menu li:hover {
  background-color: #f1f5f9;
}

/* Classe de utilidade */
.hidden {
  display: none !important;
}

.file-tree {
  list-style: none;
  font-size: 14px;
  padding-left: 0;
  margin: 0;
}

.file-tree li {
  cursor: pointer;
  padding: 3px 0;
  position: relative;
}

.file-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 0; /* o padding agora vem do JS (depth) */
}

.file-tree li span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.6;
  user-select: none;
}

.file-tree li img.icon {
  width: 16px;
  height: 16px;
}

/* Estilização dos ícones Font Awesome na árvore */
.file-tree .fa-folder,
.file-tree .fa-folder-open {
  color: #f7d463; /* cor amarela para pastas */
}

.file-tree .fa-file {
  color: #94a3b8; /* cor cinza para arquivos genéricos */
}

/* Cores para ícones de linguagens */
.file-tree .fa-js { color: #f7df1e; }
.file-tree .fa-html5 { color: #e34f26; }
.file-tree .fa-css3-alt { color: #1572b6; }
.file-tree .fa-markdown { color: #000000; }
.file-tree .fa-file-code { color: #3b82f6; }

/* Adicione a cor do ícone no estado 'active' */
.file-item.active .fa-folder,
.file-item.active .fa-folder-open,
.file-item.active .fa-file,
.file-item.active .fa-js,
.file-item.active .fa-html5,
.file-item.active .fa-css3-alt,
.file-item.active .fa-markdown,
.file-item.active .fa-file-code {
  color: white;
}

/* Botão de ações ⋮ */
.file-actions-btn {
  margin-left: 8px;       /* afastado do nome */
  font-size: 14px;
  color: #94a3b8;
  cursor: pointer;
  visibility: hidden;
  flex-shrink: 0;
}
li:hover > .file-actions-btn {
  visibility: visible;
}

/* Menu suspenso ⋮ */
.actions-menu {
  position: absolute;
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  list-style: none;
  padding: 4px 0;
  margin: 0;
  z-index: 2000;
  min-width: 140px;
  overflow: hidden;   /* remove scroll */
}
.actions-menu li {
  padding: 8px 14px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
}
.actions-menu li:hover {
  background: #f1f5f9;
}
.actions-menu.hidden {
  display: none;
}
.actions-menu li.disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

/* -------- Drag & Drop -------- */
.drop-target {
  background: rgba(59, 130, 246, 0.15);
  border-radius: 4px;
}
