/* ========================================
   RESET E VARIÁVEIS CSS
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #0a0e27;
  --bg-sidebar: #1a1a2e;
  --bg-header: #16213e;
  --text-light: #eee;
  --text-muted: #aaa;
  --accent: #4ECDC4;
  --accent-hover: #45b7d1;
  --border-color: #2e3440;
  --input-bg: #2e3440;
  --button-bg: #4ECDC4;
  --button-hover: #45b7d1;
  --danger: #ff6b6b;
  --success: #51cf66;
}

/* ========================================
   TIPOGRAFIA E BODY
   ======================================== */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  overflow: hidden;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* ========================================
   HEADER
   ======================================== */
header {
  background: linear-gradient(135deg, var(--bg-header) 0%, #1a1a2e 100%);
  padding: 1.5rem 2rem;
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

header h1 {
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
  background: linear-gradient(135deg, var(--accent) 0%, #45b7d1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* ========================================
   LAYOUT CONTAINER
   ======================================== */
.container {
  display: flex;
  height: calc(100vh - 100px);
  overflow: hidden;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
  width: 300px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem;
  box-shadow: 4px 0 8px rgba(0, 0, 0, 0.2);
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

.sidebar-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

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

.sidebar-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========================================
   INPUTS E CONTROLES
   ======================================== */
input[type="text"],
input[type="search"] {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--input-bg);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  margin: 0.5rem 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-hover);
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent);
  cursor: pointer;
  border-radius: 50%;
  border: none;
  transition: all 0.3s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  background: var(--accent-hover);
  transform: scale(1.2);
}

/* ========================================
   CHECKBOXES (FILTROS)
   ======================================== */
#component-filters {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

#component-filters::-webkit-scrollbar {
  width: 6px;
}

#component-filters::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.filter-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.filter-item:hover {
  background-color: rgba(78, 205, 196, 0.05);
}

.filter-item input[type="checkbox"] {
  margin-right: 0.75rem;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.filter-item label {
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  flex: 1;
}

.color-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 0.5rem;
  display: inline-block;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

/* ========================================
   BOTÕES
   ======================================== */
button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  padding: 0.75rem 1.25rem;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #45b7d1 100%);
  color: var(--bg-dark);
  width: 100%;
  margin-bottom: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--input-bg);
  color: var(--text-light);
  border: 1px solid var(--border-color);
  width: 100%;
  margin-bottom: 0.5rem;
}

.btn-secondary:hover {
  background-color: #3a4152;
  border-color: var(--accent);
}

.btn-secondary.active {
  background: linear-gradient(135deg, var(--accent) 0%, #45b7d1 100%);
  color: var(--bg-dark);
  border-color: var(--accent);
}

.control-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.control-group {
  margin-bottom: 1rem;
}

.control-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.control-group label span {
  color: var(--accent);
  font-weight: 600;
}

/* ========================================
   ESTATÍSTICAS
   ======================================== */
#stats-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  background-color: var(--input-bg);
  border-radius: 4px;
  border-left: 3px solid var(--accent);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

/* ========================================
   LEGENDA
   ======================================== */
#legend-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 0.75rem;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}

.legend-label {
  color: var(--text-muted);
}

/* ========================================
   RESULTADOS DE BUSCA
   ======================================== */
#search-results {
  margin-top: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
}

#search-results::-webkit-scrollbar {
  width: 6px;
}

#search-results::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.search-result-item {
  padding: 0.5rem;
  background-color: var(--input-bg);
  border-radius: 4px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.search-result-item:hover {
  background-color: #3a4152;
  border-left-color: var(--accent);
  transform: translateX(3px);
}

.search-result-item strong {
  color: var(--accent);
}

.search-result-type {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ========================================
   MAIN CONTENT (CANVAS 3D)
   ======================================== */
main {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, var(--bg-dark) 100%);
}

#3d-graph {
  width: 100%;
  height: 100%;
}

/* ========================================
   NODE INFO PANEL
   ======================================== */
.node-info {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(26, 26, 46, 0.95);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 350px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  z-index: 10;
  transition: all 0.3s ease;
}

.node-info.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-20px);
}

.node-info h3 {
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-size: 1.2rem;
}

.node-info p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  color: var(--text-light);
  font-size: 1.5rem;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background-color: var(--danger);
  color: white;
}

/* ========================================
   LOADING INDICATOR
   ======================================== */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */
@media (max-width: 1024px) {
  .sidebar {
    width: 250px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  header p {
    font-size: 0.8rem;
  }
}

@media (max-width: 768px) {
  header {
    padding: 1rem;
  }

  header h1 {
    font-size: 1.2rem;
  }

  header p {
    display: none;
  }

  .container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    overflow-y: auto;
  }

  main {
    height: calc(100vh - 280px);
  }

  .node-info {
    max-width: calc(100% - 40px);
    right: 20px;
    left: 20px;
  }
}

@media (max-width: 480px) {
  .sidebar {
    padding: 1rem;
  }

  .sidebar-section h3 {
    font-size: 1rem;
  }

  button {
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
  }
}

/* ========================================
   ANIMAÇÕES E TRANSIÇÕES
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sidebar-section {
  animation: fadeIn 0.3s ease forwards;
}

.sidebar-section:nth-child(1) { animation-delay: 0.05s; }
.sidebar-section:nth-child(2) { animation-delay: 0.1s; }
.sidebar-section:nth-child(3) { animation-delay: 0.15s; }
.sidebar-section:nth-child(4) { animation-delay: 0.2s; }
.sidebar-section:nth-child(5) { animation-delay: 0.25s; }

/* ========================================
   UTILITÁRIOS
   ======================================== */
.hidden {
  display: none !important;
}

.text-muted {
  color: var(--text-muted);
}

.text-accent {
  color: var(--accent);
}
