/* ==================== Professional File Editor Styles ==================== */
/* === Fullscreen Editor Width Fix === */
.file-editor,
.file-editor.fullscreen,
.CodeMirror,
.CodeMirror-scroll {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Remove white background from parent containers if present */
.editor-container,
.editor-content-wrapper {
  background: transparent !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* File Editor Hidden State */
.file-editor.hidden {
  display: none !important;
}

/* File Editor Professional Header */
.file-editor-header-pro {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  padding: 20px;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.file-icon-editor {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  backdrop-filter: blur(10px);
}

.file-details {
  flex: 1;
}

.file-name-editor {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 5px;
}

.file-path-editor {
  font-size: 13px;
  opacity: 0.9;
  font-family: 'Courier New', monospace;
}

/* Editor Toolbar */
.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.editor-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  background: rgba(30, 41, 59, 0.7) !important;
  color: white !important;
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.stat-item i {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9) !important;
}

.stat-item span {
  font-weight: 600;
  color: white !important;
}

.editor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-editor-tool {
  background: rgba(30, 41, 59, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  color: white !important;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

.btn-editor-tool:hover {
  background: rgba(30, 41, 59, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

.btn-editor-tool.active {
  background: rgba(16, 185, 129, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.5) !important;
  color: white !important;
}

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

/* Separator between tool buttons and action buttons */
.editor-actions::after {
  content: '';
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 5px;
  order: 10;
}

#save-file-btn {
  order: 11;
}

#close-editor-btn {
  order: 12;
}

/* Editor Action Buttons (Save & Close) */
.editor-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  height: 40px;
  min-width: 100px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.editor-actions .btn i {
  font-size: 14px;
}

.file-editor .editor-actions .btn-primary,
.file-editor-header-pro .editor-actions .btn-primary,
#save-file-btn.btn-primary {
  background: #10b981 !important;
  background-color: #10b981 !important;
  color: white !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3) !important;
}

.file-editor .editor-actions .btn-primary:hover,
.file-editor-header-pro .editor-actions .btn-primary:hover,
#save-file-btn.btn-primary:hover {
  background: #059669 !important;
  background-color: #059669 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

.file-editor .editor-actions .btn-secondary,
.file-editor-header-pro .editor-actions .btn-secondary,
#close-editor-btn.btn-secondary {
  background: rgba(0, 0, 0, 0.15) !important;
  background-color: rgba(0, 0, 0, 0.15) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
}

.file-editor .editor-actions .btn-secondary:hover,
.file-editor-header-pro .editor-actions .btn-secondary:hover,
#close-editor-btn.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.25) !important;
  background-color: rgba(0, 0, 0, 0.25) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
  transform: translateY(-2px);
}

/* Legacy support */
.editor-actions .btn-primary {
  background: #10b981 !important;
  background-color: #10b981 !important;
  color: white !important;
}

.editor-actions .btn-secondary {
  background: rgba(0, 0, 0, 0.15) !important;
  background-color: rgba(0, 0, 0, 0.15) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
}

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


/* Line Numbers */
.line-numbers {
  background: #252526;
  color: #858585;
  padding: 15px 10px;
  text-align: right;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  user-select: none;
  border-right: 1px solid #3e3e42;
  overflow-y: hidden;
  min-width: 50px;
  display: none;
  white-space: pre;
}

.line-numbers.visible {
  display: block;
}

.line-numbers span {
  display: block;
  height: 22.4px;
}

/* Hide line numbers scrollbar */
.line-numbers::-webkit-scrollbar {
  width: 0;
  display: none;
}

/* File Content Textarea */
.file-content {
  flex: 1;
  background: #1e1e1e !important;
  color: #d4d4d4 !important;
  border: none;
  padding: 15px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
  overflow-y: auto;
  overflow-x: auto;
  white-space: pre;
  word-wrap: normal;
}

/* CodeMirror integration */
.CodeMirror {
  height: 100% !important;
  background: #1e1e1e !important;
  color: #d4d4d4 !important;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}
.file-editor .CodeMirror,
.file-editor .CodeMirror-scroll {
  direction: ltr !important; /* keep vertical scrollbar on the right even in RTL */
}
.file-editor.fullscreen .CodeMirror,
.file-editor.fullscreen .CodeMirror-scroll,
.file-editor.fullscreen .CodeMirror-sizer {
  height: 100% !important;
  max-height: 100% !important;
}
.file-editor.fullscreen .CodeMirror-scroll {
  overflow: auto !important;
}

/* Ensure scroll containers take full height in fullscreen */
.file-editor.fullscreen .CodeMirror-vscrollbar {
  top: 0 !important;
  bottom: 0 !important;
  height: 100% !important;
}

.file-editor.fullscreen .CodeMirror-hscrollbar {
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
}
.CodeMirror-gutters {
  background: #252526 !important;
  border-right: 1px solid #3e3e42 !important;
}
.CodeMirror-linenumber { color: #858585 !important; }
.CodeMirror-cursor { border-left: 2px solid #ffffff !important; }

.file-content:focus {
  background: #1e1e1e !important;
  color: #d4d4d4 !important;
  outline: none !important;
  border: none !important;
}

.file-content::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.file-content::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.file-content::-webkit-scrollbar-thumb {
  background: #424242;
  border-radius: 6px;
}

.file-content::-webkit-scrollbar-thumb:hover {
  background: #4e4e4e;
}

/* Word Wrap Mode */
.file-content.word-wrap {
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  overflow-x: hidden !important;
}

.file-content:not(.word-wrap) {
  white-space: pre !important;
  word-wrap: normal !important;
  overflow-wrap: normal !important;
  overflow-x: auto !important;
}

/* With Line Numbers */
.editor-content-wrapper.with-line-numbers .file-content {
  padding-left: 15px;
}

/* Fullscreen Mode */
.file-editor.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: #1e1e1e;
  border-radius: 0;
  animation: fadeIn 0.3s ease;
  display: flex;
  flex-direction: column;
}

.file-editor.fullscreen .editor-content-wrapper {
  border-radius: 0;
  height: auto;
  flex: 1;
  min-height: 0; /* allow inner scroll areas to fill height */
}

.file-editor.fullscreen .file-editor-header-pro {
  border-radius: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Responsive Design for Editor */
@media (max-width: 768px) {
  .file-editor-header-pro {
    padding: 15px;
  }
  
  .file-name-editor {
    font-size: 16px;
  }
  
  .editor-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .editor-stats {
    width: 100%;
  }
  
  .editor-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .editor-actions .btn {
    padding: 8px 16px;
    font-size: 13px;
  }
  
  .btn-editor-tool {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  

  
  .file-content {
    font-size: 13px;
  }
  
  .line-numbers {
    font-size: 13px;
    min-width: 40px;
  }
}

