:root {
  /* Color Palette */
  --primary-color: #4a90e2;
  --primary-light: rgba(74, 144, 226, 0.1);
  --primary-dark: #357abd;

  /* Neutral Colors */
  --bg-color: #f4f6f9;
  --text-color: #2c3e50;
  --text-muted: #6c757d;

  /* Background and Surface */
  --surface-color: #ffffff;
  --sidebar-bg: #f8f9fa;

  /* Sidebar */
  --sidebar-text: #666;
  --sidebar-width: 50px;

  /* Buttons */
  --button-bg: #3498db;
  --button-hover: #2980b9;
  --button-text: white;

  /* Tabs */
  --tab-bg: #e9ecef;
  --tab-active-bg: #ffffff;
  --tab-hover-bg: #f1f3f5;
  --tab-border: #ccc;
  --tab-height: 36px;

  /* Status Bar */
  --status-bar-bg: #f1f1f1;
  --status-bar-text: #666;
  --status-height: 32px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --editor-font-family: 'Fira Code', 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
  --editor-font-size: 16px;
  --line-height: 1.6;

  /* Typography Sizes */
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;

  /* Sizing and Spacing */
  --toolbar-height: 52px;
  --border-radius: 4px;
  --border-radius-sm: 4px;
  --border-radius-md: 6px;

  /* Shadows and Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.08);

  /* Borders */
  --border-color: #eaeaea;

  /* Transitions */
  --transition-speed: 0.2s;
  --transition-easing: cubic-bezier(0.4, 0, 0.2, 1);

  /* Scrollbars */
  --scrollbar-thumb: rgba(52, 152, 219, 0.6);
  --scrollbar-thumb-hover: rgba(52, 152, 219, 0.8);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body, html {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--text-color);
}

.container {
  display: flex;
  height: 100%;
  width: 100%;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
  user-select: none;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 5;
  box-shadow: var(--shadow-sm);
}

.sidebar-toolbar-space {
  height: calc(var(--toolbar-height) + var(--tab-height));
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12px;
}

.sidebar-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.line-numbers {
  padding: 15px 8px 15px 0;
  text-align: right;
  color: var(--sidebar-text);
  font-size: 14px;
  overflow-y: hidden;
  flex: 1;
  width: 100%;
  white-space: pre;
  font-family: monospace;
}

.line-number {
  height: calc(var(--line-height) * var(--editor-font-size));
  line-height: calc(var(--line-height) * var(--editor-font-size));
  display: block;
}

/* Editor container */
.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  width: 100%;
  margin-left: var(--sidebar-width);
}

/* Toolbar */
.toolbar {
  display: flex;
  padding: 0 20px;
  background-color: white;
  border-bottom: 1px solid var(--border-color);
  justify-content: space-between;
  align-items: center;
  height: var(--toolbar-height);
  width: 100%;
  position: relative;
  z-index: 10;
}

/* App title */
.app-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tab system styling */
.tab-container {
  display: flex;
  background-color: var(--sidebar-bg);
  border-bottom: 1px solid var(--tab-border);
  overflow-x: auto;
  height: var(--tab-height);
  align-items: flex-end;
  width: 100%;
   
}

.tabs {
  display: flex;
  height: 100%;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  align-items: stretch;   /* Ensure tabs and button align */
}

.tabs::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.tab {
  display: flex;
  align-items: center;
  padding: 0 12px 0 16px;
  background-color: var(--tab-bg);
  border-right: 1px solid var(--tab-border);
  height: 30px;
  min-width: 120px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  position: relative;
  user-select: none;
  margin-top: 4px;
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
  transition: all var(--transition-speed) ease;
}

.tab.active {
  background-color: var(--tab-active-bg);
  border-bottom: none;
  height: 34px;
  margin-top: 0;
  z-index: 1;
  font-weight: 500;
}

.tab:hover:not(.active) {
  background-color: var(--tab-active-bg);
  opacity: 0.85;
}

.tab.dragging {
  opacity: 0.8;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.tab-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-title-input {
  flex: 1;
  height: 20px;
  font-size: 14px;
  border: none;
  background: transparent;
  border-bottom: 1px solid var(--primary-color);
  outline: none;
  padding: 0;
  margin-right: 8px;
  width: calc(100% - 25px);
}

.tab-close {
  margin-left: 8px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  opacity: 0.7;
  transition: opacity var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

.tab-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
  opacity: 1;
}

.new-tab-btn {
  width: 32px;
  height: 30px;
  background-color: #ededed;           
  color: #555;                         
  border: none;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 0;
  margin-right: 5px;
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
  border-bottom: 2px solid transparent;
  border-right: 1px solid var(--tab-border);
  margin-top: 4px;
  transition: 
    background-color var(--transition-speed) ease,
    color var(--transition-speed) ease,
    border-bottom var(--transition-speed) ease;
}

.new-tab-btn:hover,
.new-tab-btn:focus {
  background-color: #d4d4d4;           /* Slightly darker on hover */
  color: #222;
  border-bottom: 2px solid #4a90e2;    /* Subtle highlight like Windows */
  outline: none;
}

/* Button styles */
.file-actions {
  display: flex;
  gap: 12px;
}

.btn {
  padding: 8px 16px;
  background-color: var(--button-bg);
  color: var(--button-text);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color var(--transition-speed) ease,
              transform 0.1s ease,
              box-shadow var(--transition-speed) ease;
}

.btn:hover {
  background-color: var(--button-hover);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn-outline {
  background-color: transparent;
  color: var(--button-bg);
  border: 1px solid var(--button-bg);
}

.btn-outline:hover {
  background-color: var(--primary-light);
}

/* Editor area */
.editor-wrapper {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  background-color: white;
}

#editor {
  flex: 1;
  padding: 16px 20px;
  font-size: var(--editor-font-size);
  line-height: var(--line-height);
  overflow-y: auto;
  border: none;
  resize: none;
  outline: none;
  background-color: white;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
  font-family: monospace;
}

/* Status bar */
.status-bar {
  display: flex;
  padding: 0 20px;
  background-color: var(--status-bar-bg);
  border-top: 1px solid var(--border-color);
  justify-content: flex-end;
  align-items: center;
  height: var(--status-height);
  width: 100%;
}

.stats {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--status-bar-text);
}

/* Scrollbar styling */
#editor::-webkit-scrollbar {
  width: 8px;
  background-color: transparent;
}

#editor::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 10px;
}

#editor::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

/* For Firefox */
#editor {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

#file-input {
  display: none;
}

/* Notification */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  background-color: var(--primary-color);
  color: white;
  border-radius: var(--border-radius);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  font-weight: 500;
}

.notification.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive styling */
@media (max-width: 768px) {
  :root {
    --editor-font-size: 14px;
    --sidebar-width: 40px;
    --toolbar-height: 46px;
  }

  .sidebar-icon {
    width: 24px;
    height: 24px;
  }

  .sidebar-toolbar-space {
    height: calc(var(--toolbar-height) + var(--tab-height));
    padding-top: 12px;
  }

  .toolbar {
    padding: 0 12px;
    flex-wrap: wrap;
    align-items: center;
  }

  .app-title {
    font-size: 14px;
  }

  .file-actions {
    gap: 8px;
  }

  .btn {
    padding: 6px 12px;
    font-size: 13px;
  }

  .line-numbers {
    padding: 15px 4px 15px 0;
    font-size: 12px;
  }

  .stats {
    gap: 10px;
    font-size: 12px;
  }

  #editor {
    padding: 12px;
  }

  .tab {
    min-width: 100px;
    padding: 0 8px 0 10px;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --text-color: #e6e6e6;
    --sidebar-bg: #1e1e1e;
    --sidebar-text: #b3b3b3;
    --highlight-bg: rgba(52, 152, 219, 0.15);
    --tab-bg: #2a2a2a;
    --tab-active-bg: #121212;
    --tab-border: #333;
    --status-bar-bg: #1e1e1e;
    --status-bar-text: #b3b3b3;
    --scrollbar-thumb: rgba(52, 152, 219, 0.4);
    --scrollbar-thumb-hover: rgba(52, 152, 219, 0.6);
    --border-color: #333;
  }

  #editor, .toolbar, .editor-wrapper {
    background-color: #121212;
    color: var(--text-color);
  }

  .tab-close:hover {
    background-color: rgba(255, 255, 255, 0.15);
  }

  .new-tab-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }

  .tab-title-input {
    color: var(--text-color);
  }

  .btn-outline {
    border-color: var(--primary-color);
  }
}