/**
 * Locust Multi-File Editor Styles
 * Phase 1: Tab bar and basic UI components
 */

:root {
  --editor-bg-primary: #1e1e1e;
  --editor-bg-secondary: #252526;
  --editor-bg-tertiary: #2d2d30;
  --editor-border-color: #3e3e42;
  --editor-text-primary: #cccccc;
  --editor-text-secondary: #858585;
  --editor-accent-blue: #007acc;
  --editor-accent-green: #10b981;
  --editor-accent-orange: #ffa500;
  --editor-dirty-indicator: #ffa500;
  --editor-hover: #37373d;
}

/* Tab Bar Container */
#editor-tabs {
  display: flex;
  align-items: center;
  background: var(--editor-bg-primary);
  border-bottom: 1px solid var(--editor-border-color);
  min-height: 35px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--editor-border-color) var(--editor-bg-primary);
}

#editor-tabs::-webkit-scrollbar {
  height: 4px;
}

#editor-tabs::-webkit-scrollbar-track {
  background: var(--editor-bg-primary);
}

#editor-tabs::-webkit-scrollbar-thumb {
  background: var(--editor-border-color);
  border-radius: 2px;
}

#editor-tabs::-webkit-scrollbar-thumb:hover {
  background: var(--editor-text-secondary);
}

/* Individual Tab */
.editor-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--editor-bg-primary);
  border-right: 1px solid var(--editor-border-color);
  border-bottom: 2px solid transparent;
  color: var(--editor-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  position: relative;
  min-width: 100px;
  max-width: 200px;
}

.editor-tab:hover {
  background: var(--editor-hover);
  color: var(--editor-text-primary);
}

.editor-tab.active {
  background: var(--editor-bg-secondary);
  border-bottom-color: var(--editor-accent-green);
  color: var(--editor-text-primary);
}

/* Tab Icon */
.editor-tab .tab-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

/* Tab Name */
.editor-tab .tab-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 400;
}

/* Dirty Indicator (unsaved changes) */
.editor-tab .dirty-dot {
  color: var(--editor-dirty-indicator);
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  margin-left: -2px;
}

/* Close Button */
.editor-tab .tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--editor-text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
  padding: 0;
  margin-left: 2px;
  flex-shrink: 0;
}

.editor-tab .tab-close:hover {
  background: var(--editor-border-color);
  color: var(--editor-text-primary);
}

.editor-tab .tab-close:active {
  background: var(--editor-accent-blue);
  color: white;
}

/* No Tabs Message */
.no-tabs-message {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  width: 100%;
}

/* Context Menu */
.context-menu {
  background: #2d2d30;  /* Solid background, no transparency */
  border: 1px solid var(--editor-border-color);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
  padding: 4px 0;
  min-width: 180px;
  z-index: 10000;
  opacity: 1;  /* Ensure fully opaque */
}

.context-menu-item {
  padding: 6px 12px;
  color: var(--editor-text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.context-menu-item:hover:not(.disabled) {
  background: var(--editor-accent-blue);
  color: white;
}

.context-menu-item.disabled {
  color: var(--editor-text-secondary);
  cursor: not-allowed;
  opacity: 0.5;
}

.context-menu-divider {
  height: 1px;
  background: var(--editor-border-color);
  margin: 4px 0;
}

/* Editor Container */
#locust-editor-root {
  width: 100%;
  height: 500px;
  min-height: 400px;
  background: var(--editor-bg-primary);
  border: 1px solid var(--editor-border-color);
  border-radius: 8px;
  overflow: hidden;
}

/* Status Bar (for future use) */
.editor-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  background: var(--editor-accent-blue);
  color: white;
  font-size: 12px;
  height: 22px;
}

.editor-status-bar .status-left,
.editor-status-bar .status-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.editor-status-bar .status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* File Tree (for Phase 2, basic styles) */
.file-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

.file-tree ul {
  list-style: none;
  padding-left: 16px;
}

/* Legacy styles - specific styles below override these */
.file-node {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 3px;
  transition: background 0.15s ease;
}

.file-node:hover {
  background: var(--editor-hover);
}

.file-item,
.folder-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--editor-text-primary);
  font-size: 13px;
}

.file-icon,
.folder-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.expand-icon {
  font-size: 10px;
  color: var(--editor-text-secondary);
  flex-shrink: 0;
  width: 12px;
}

.dirty-indicator {
  color: var(--editor-dirty-indicator);
  font-size: 12px;
  margin-left: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .editor-tab {
    min-width: 80px;
    max-width: 120px;
    padding: 6px 8px;
  }

  .editor-tab .tab-name {
    font-size: 12px;
  }

  #locust-editor-root {
    height: 400px;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.context-menu {
  animation: fadeIn 0.1s ease;
}

/* Focus states for accessibility */
.editor-tab:focus,
.context-menu-item:focus {
  outline: 2px solid var(--editor-accent-blue);
  outline-offset: -2px;
}

/* Print styles */
@media print {
  .editor-tab .tab-close {
    display: none;
  }

  .context-menu {
    display: none;
  }
}

/* ====================================================================
   Phase 2: File Tree Explorer
   ==================================================================== */

/* File Tree Container */
#file-tree-container {
  width: 300px;
  min-width: 200px;
  max-width: 600px;
  background: var(--editor-bg-primary);
  border-right: 1px solid var(--editor-border-color);
  overflow-y: auto;
  overflow-x: hidden;
}

.file-tree {
  padding: 8px 0;
  user-select: none;
}

/* Project Header */
.file-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--editor-border-color);
  margin-bottom: 4px;
}

.project-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--editor-text-primary);
  font-size: 13px;
}

.project-icon {
  font-size: 14px;
}

.file-tree-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: var(--editor-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--editor-hover);
  color: var(--editor-text-primary);
}

/* File Tree List */
.file-tree-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.file-tree-node {
  list-style: none;
}

/* Folder Node */
.folder-node {
  margin: 2px 0;
  /* Note: hover is handled by .folder-header, not here */
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: 3px;
  margin: 0 4px;
}

.folder-header:hover {
  background: var(--editor-hover);
}

.expand-icon {
  font-size: 10px;
  color: var(--editor-text-secondary);
  width: 12px;
  display: inline-block;
  text-align: center;
  flex-shrink: 0;
}

.folder-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.folder-children {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* File Node */
.file-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: 3px;
  margin: 2px 4px;
  position: relative;
}

.file-node:hover {
  background: var(--editor-hover);
}

.file-node.selected {
  background: var(--editor-accent-blue);
  color: white;
}

.file-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.node-name {
  flex: 1;
  font-size: 13px;
  color: var(--editor-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-node.selected .node-name {
  color: white;
}

.dirty-indicator {
  color: var(--editor-dirty-indicator);
  font-size: 12px;
  margin-left: auto;
  flex-shrink: 0;
}
.file-status {
  font-size: 10px;
  margin-left: 6px;
  opacity: 0.9;
  flex-shrink: 0;
}

/* Context Menu */
.file-tree-context-menu {
  background: #0f172a !important;
  border: 1px solid #1f2937;
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  padding: 4px 0;
  min-width: 180px;
  z-index: 10000;
  animation: fadeIn 0.1s ease;
  opacity: 1 !important;
  backdrop-filter: none !important;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: var(--editor-text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.context-menu-item:hover {
  background: #1f2937;
  color: #e5e7eb;
}

.menu-icon {
  font-size: 14px;
  width: 16px;
  text-align: center;
}

.context-menu-divider {
  height: 1px;
  background: var(--editor-border-color);
  margin: 4px 0;
}

/* Empty State */
.file-tree-empty {
  padding: 20px;
  text-align: center;
  color: var(--editor-text-secondary);
  font-size: 13px;
}

/* Layout with File Tree */
.editor-layout {
  display: flex;
  height: 100%;
}

.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Resize Handle */
.resize-handle {
  width: 4px;
  background: transparent;
  cursor: col-resize;
  transition: background 0.15s ease;
}

.resize-handle:hover {
  background: var(--editor-accent-blue);
}

/* Scrollbar Styles for File Tree */
#file-tree-container::-webkit-scrollbar {
  width: 10px;
}

#file-tree-container::-webkit-scrollbar-track {
  background: var(--editor-bg-primary);
}

#file-tree-container::-webkit-scrollbar-thumb {
  background: var(--editor-border-color);
  border-radius: 5px;
}

#file-tree-container::-webkit-scrollbar-thumb:hover {
  background: var(--editor-text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  #file-tree-container {
    width: 250px;
    min-width: 200px;
  }
  
  .file-tree-header {
    padding: 6px 8px;
  }
  
  .node-name {
    font-size: 12px;
  }
}

/* ====================================================================
   Phase 3: Multi-Scenario Project Support
   ==================================================================== */

/* Project Type Badge */
.project-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin-left: 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
}

.project-type-badge.simple {
  background: var(--editor-bg-tertiary);
  color: var(--editor-text-secondary);
  border: 1px solid var(--editor-border-color);
}

.project-type-badge.advanced {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

/* Convert to Advanced Button */
.convert-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
  margin-right: 8px;
}

.convert-btn:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.5);
}

.convert-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

