body { 
  margin: 0;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

#main-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#terminal-view:not(.hidden) {
  display: flex !important;
  flex-direction: column;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 9999 !important;
  background: #1a1b26;
  margin: 0 !important;
  padding: 0 !important;
}

.terminal-container {
  flex: 1;
  background: #1a1b26;
  padding: 10px;
  overflow: hidden; /* Let xterm handle its own scrolling */
  width: 100%;
  height: 100%;
}

#terminal {
  height: 100%;
  width: 100%;
}

/* Custom scrollbar for terminals */
.terminal-container::-webkit-scrollbar,
.cubicle-terminal::-webkit-scrollbar,
.xterm-viewport::-webkit-scrollbar {
  width: 10px;
}

.terminal-container::-webkit-scrollbar-track,
.cubicle-terminal::-webkit-scrollbar-track,
.xterm-viewport::-webkit-scrollbar-track {
  background: #1a1b26;
}

.terminal-container::-webkit-scrollbar-thumb,
.cubicle-terminal::-webkit-scrollbar-thumb,
.xterm-viewport::-webkit-scrollbar-thumb {
  background: #4a5568;
  border-radius: 5px;
}

.terminal-container::-webkit-scrollbar-thumb:hover,
.cubicle-terminal::-webkit-scrollbar-thumb:hover,
.xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: #718096;
}

/* Xterm styles moved to terminal containers section */

.file-item {
  padding: 8px 12px;
  border-bottom: 1px solid #374151;
}

/* Remove duplicate cubicle-terminal styles - defined later */

/* Loading animation */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

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

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

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #4a5568;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 10001;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateX(-50%) translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* Resize handle styles */
.resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 12px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 10;
}

.resize-grip {
  width: 40px;
  height: 3px;
  background-color: #4a5568;
  border-radius: 1.5px;
  transition: all 0.2s;
}

.resize-handle:hover .resize-grip {
  background-color: #3b82f6;
  height: 4px;
}

/* Touch-optimized for tablets/mobile */
@media (pointer: coarse) {
  .resize-handle {
    height: 24px;
  }
  
  .resize-grip {
    width: 80px;
    height: 6px;
  }
}

/* Resizing state */
.resizing {
  user-select: none;
  -webkit-user-select: none;
}

/* Terminal containers */
.terminal-container {
  position: relative;
  height: 400px;
  min-height: 400px;
  overflow: hidden; /* Let xterm handle its own scrolling */
}

.cubicle-terminal {
  position: relative;
  background: #1a1b26;
  border-radius: 0 0 8px 8px;
  display: flex;
  flex-direction: column;
}

/* Xterm terminal styles */
.terminal-container .xterm,
.cubicle-terminal .xterm {
  height: 100%;
  width: 100%;
}

/* Remove our viewport override - let xterm handle scrolling */

/* Split Pane Styles */
.split-root {
  width: 100%;
  height: 100%;
  position: relative;
}

.split-pane {
  position: relative;
  overflow: hidden;
  background: #1f2937;
  min-width: 200px;
  min-height: 200px;
  padding: 8px;
}

.split-vertical {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
}

.split-horizontal {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* Split resize handles */
.split-resize-handle {
  flex-shrink: 0;
  background: #374151;
  position: relative;
  z-index: 10;
}

.split-resize-vertical {
  width: 4px;
  cursor: col-resize;
}

.split-resize-horizontal {
  height: 4px;
  cursor: row-resize;
}

.split-resize-grip {
  position: absolute;
  background: #6b7280;
  border-radius: 2px;
  transition: background-color 0.2s;
}

.split-resize-vertical .split-resize-grip {
  width: 2px;
  height: 30px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.split-resize-horizontal .split-resize-grip {
  width: 30px;
  height: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.split-resize-handle:hover .split-resize-grip {
  background: #3b82f6;
}

/* Pane content styles */
.pane-welcome {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pane-project-selector {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Show close button on hover for empty panes */
.pane-welcome .absolute.top-2.right-2,
.pane-project-selector .absolute.top-2.right-2 {
  opacity: 0;
  transition: opacity 0.2s;
}

.pane-welcome:hover .absolute.top-2.right-2,
.pane-project-selector:hover .absolute.top-2.right-2 {
  opacity: 1;
}

.pane-ai-office {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pane-terminal {
  background: #1a1b26;
  padding: 8px;
  overflow: hidden;
  height: 100%;
}

/* Ensure resizable containers in multiproject view respect boundaries */
.resizable-terminal-container {
  overflow: hidden;
  position: relative;
}

/* Multiproject view specific */
#multiproject-view {
  position: relative;
}

#multiproject-panes {
  position: relative;
  overflow: hidden;
}

/* Terminal stacking in panes */
.pane-ai-office .grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

/* Ensure terminals container respects pane boundaries */
.pane-ai-office > div > div[id^="pane-terminals-"] {
  max-height: 100%;
  box-sizing: border-box;
}

/* Prevent text selection during resize */
.resizing * {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
}

/* Prevent terminal text selection while resizing */
.resizing .xterm {
  pointer-events: none;
}

/* Multiproject layouts panel */
.bg-gray-850 {
  background-color: #1a1f2e;
}

/* Dropdown menus */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: fixed;
  background-color: #111827;
  min-width: 220px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  border: 1px solid #374151;
  border-radius: 0.5rem;
  z-index: 10000;
  margin-top: 0.5rem;
  max-height: 80vh;
  overflow-y: auto;
  backdrop-filter: blur(10px);
  background-color: rgba(17, 24, 39, 0.95);
}

.dropdown-content.show {
  display: block;
  animation: dropdownSlide 0.2s ease-out;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  color: #e5e7eb;
  padding: 0.625rem 1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border-radius: 0.25rem;
  margin: 0.125rem 0.375rem;
}

.dropdown-item:hover {
  background-color: #374151;
  color: white;
  transform: translateX(2px);
}

.dropdown-separator {
  height: 1px;
  background: linear-gradient(to right, transparent, #374151 20%, #374151 80%, transparent);
  margin: 0.5rem 0;
}

.dropdown-header {
  color: #6b7280;
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Context bar improvements */
.context-bar {
  background-color: #1f2937;
  border-bottom: 1px solid #374151;
  padding: 0.75rem 1rem;
}

.context-button {
  background-color: #374151;
  color: #e5e7eb;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  border: 1px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.context-button:hover {
  background-color: #4b5563;
  border-color: #6b7280;
}

.context-button.active {
  background-color: #3b82f6;
  color: white;
}

/* Quick access button styles */
.context-button.bg-blue-600 {
  background-color: #2563eb;
  color: white;
  font-weight: 500;
}

.context-button.bg-blue-600:hover {
  background-color: #1d4ed8;
  border-color: #2563eb;
}

.context-button.bg-red-600 {
  background-color: #dc2626;
  color: white;
  font-weight: 500;
}

.context-button.bg-red-600:hover {
  background-color: #b91c1c;
  border-color: #dc2626;
}

/* Custom scrollbar for dropdowns */
.dropdown-content::-webkit-scrollbar {
  width: 6px;
}

.dropdown-content::-webkit-scrollbar-track {
  background: transparent;
}

.dropdown-content::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 3px;
}

.dropdown-content::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* WSL Warning Banner */
.wsl-warning-banner {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-top: 2px solid #f59e0b;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: slideDown 0.3s ease-out;
}

.wsl-warning-banner.hidden {
  display: none;
}

.wsl-warning-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1200px;
  width: 100%;
}

.wsl-warning-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.wsl-warning-text {
  flex: 1;
  color: #0a0e1a;
  font-size: 14px;
  line-height: 1.4;
}

.wsl-warning-text strong {
  font-weight: 600;
}

.btn-warning {
  background: #0a0e1a;
  color: #fbbf24;
  border: 1px solid #0a0e1a;
  transition: all 0.2s;
}

.btn-warning:hover {
  background: #1a1b26;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .wsl-warning-content {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .wsl-warning-text {
    font-size: 13px;
  }
}