* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background-color: #f9fafb;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

/* Error Boundary Styles */
.error-boundary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 2rem;
  text-align: center;
  background-color: #fef2f2;
  color: #991b1b;
}

.error-boundary h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #dc2626;
}

.error-boundary p {
  margin-bottom: 1.5rem;
  color: #7f1d1d;
}

.error-retry-btn {
  background-color: #dc2626;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.2s;
}

.error-retry-btn:hover {
  background-color: #b91c1c;
}

/* Tree Status Bar Styles */
.tree-status {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  border-top: none;
  backdrop-filter: blur(8px);
  animation: statusSlideUp 0.3s ease-out;
  z-index: 10;
}

@keyframes statusSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.tree-status-info,
.tree-status-success,
.tree-status-error,
.tree-status-warning {
  background-color: transparent;
  color: #ffffff;
}

/* Loading States */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Button Loading States */
.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.action-btn.loading {
  position: relative;
}

.action-btn.loading::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid transparent;
  border-top: 1px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.app {
  display: flex;
  height: 100vh;
}

.sidebar {
  background-color: #1f2937;
  color: white;
  transition: width 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.sidebar-closed {
  width: 60px;
}

.sidebar-open {
  width: 320px;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid #374151;
  display: flex;
  align-items: center;
  gap: 1rem;
}


.hamburger-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hamburger-btn:hover {
  background-color: #374151;
}

.hamburger-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.sidebar-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.control-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #f9fafb;
  margin: 0;
  flex: 1;
}

.connection-status {
  margin: 0.5rem 0;
}

.status-indicator {
  font-size: 0.875rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
  border: none;
  background: transparent;
  transition: opacity 0.2s;
}

.status-indicator.connected:hover {
  opacity: 0.8;
}

.status-indicator.connected {
  background-color: #065f46;
  color: #d1fae5;
}

.status-indicator.disconnected {
  background-color: #7f1d1d;
  color: #fecaca;
}

.header-actions {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.control-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:hover {
  background-color: #374151;
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.control-btn.active {
  background-color: #3b82f6;
}

.control-btn.paused {
  background-color: #f59e0b;
  opacity: 0.8;
}

.control-btn.blocked {
  background-color: #dc2626;
  opacity: 0.7;
}

.control-btn.refreshing {
  background-color: #374151;
}

.spinning {
  animation: spin 1s linear infinite;
}

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

.control-icon {
  width: 1rem;
  height: 1rem;
}

.main-content {
  flex: 1;
  background-color: #f9fafb;
  overflow: auto;
}

.content-placeholder {
  padding: 2rem;
  text-align: center;
  color: #6b7280;
}

.tree-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  position: relative;
  background-color: #1f2937;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  text-align: center;
  height: 100%;
  min-height: 300px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #f9fafb;
  margin: 0 0 0.5rem 0;
}

.empty-description {
  color: #9ca3af;
  margin: 0 0 1.5rem 0;
  line-height: 1.5;
  max-width: 280px;
}

.empty-connect-btn {
  background-color: #3b82f6;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.empty-connect-btn:hover {
  background-color: #2563eb;
}

.tree-node {
  user-select: none;
}

.node-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
  position: relative;
  min-height: 2rem; /* Reserve consistent height */
}

.node-content:hover {
  background-color: #374151;
}

.chevron-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.icon {
  width: 1rem;
  height: 1rem;
}

.icon-gray {
  color: #9ca3af;
}

.icon-blue {
  color: #60a5fa;
}

.icon-folder {
  color: #60a5fa;
}

.icon-file {
  color: #9ca3af;
}

.node-name {
  font-size: 0.875rem;
  color: #f3f4f6;
  flex: 1;
  cursor: pointer;
}

.node-name-input {
  font-size: 0.875rem;
  color: #1f2937;
  flex: 1;
  border: 1px solid #60a5fa;
  border-radius: 0.25rem;
  padding: 0.125rem 0.25rem;
  background-color: white;
  outline: none;
}

.actions {
  display: flex;
  gap: 0.25rem;
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background-color: inherit;
  padding: 0.125rem;
  border-radius: 0.25rem;
}

.action-btn {
  padding: 0.25rem;
  border: none;
  background: transparent;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.action-btn:hover.folder-action {
  background-color: #dbeafe;
}

.action-btn:hover.file-action {
  background-color: #d1fae5;
}

.action-btn:hover.delete-action {
  background-color: #fee2e2;
}

.icon-small {
  width: 0.875rem;
  height: 0.875rem;
}

.icon-blue-dark {
  color: #2563eb;
}

.icon-green {
  color: #059669;
}

.icon-red {
  color: #dc2626;
}

.hidden {
  display: none;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}

.root-row {
  user-select: none;
  border-bottom: 1px solid #374151;
  margin-bottom: 0.5rem;
}

.root-row-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
  position: relative;
  min-height: 2rem;
}

.root-row-content:hover {
  background-color: #374151;
}

.root-row-label {
  font-weight: 500;
  color: #9ca3af;
  font-style: italic;
}

.action-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.action-btn.disabled:hover {
  background-color: transparent;
}
