/* CSS Variables - Design System */
:root {
  /* Primary Colors */
  --primary-blue: #007acc;
  --primary-blue-dark: #005a9e;
  --primary-blue-light: #4da6ff;
  
  /* Status Colors */
  --success-green: #28a745;
  --warning-orange: #fd7e14;
  --danger-red: #dc3545;
  --info-cyan: #17a2b8;
  
  /* Dark Theme */
  --bg-primary: #1e1e1e;
  --bg-secondary: #2d2d30;
  --bg-tertiary: #3e3e42;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #969696;
  
  /* Code Theme */
  --code-bg: #1a1a1a;
  --code-text: #e0e0e0;
  
  /* Light Theme */
  --bg-primary-light: #ffffff;
  --bg-secondary-light: #f8f9fa;
  --bg-tertiary-light: #e9ecef;
  --text-primary-light: #212529;
  --text-secondary-light: #495057;
  --text-muted-light: #6c757d;

  /* Spacing System (8px base unit) */
  --space-xs: 0.25rem;  /* 4px */
  --space-sm: 0.5rem;   /* 8px */
  --space-md: 1rem;     /* 16px */
  --space-lg: 1.5rem;   /* 24px */
  --space-xl: 2rem;     /* 32px */
  --space-2xl: 3rem;    /* 48px */

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
  transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::-webkit-scrollbar-corner {
  background: var(--bg-secondary);
}

/* Firefox scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) var(--bg-secondary);
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Typography Scale */
.text-hero { font-size: 2rem; font-weight: 700; }
.text-title { font-size: 1.5rem; font-weight: 600; }
.text-heading { font-size: 1.25rem; font-weight: 600; }
.text-body { font-size: 1rem; font-weight: 400; }
.text-small { font-size: 0.875rem; font-weight: 400; }
.text-caption { font-size: 0.75rem; font-weight: 400; }

/* Mobile App Layout */
.mobile-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100vw;
}

/* Header */
.mobile-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-tertiary);
  padding: var(--space-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 100%;
}

.app-title-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.app-title {
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.app-icon {
  font-size: 1.5rem;
}

.version {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.7;
  background: var(--accent-blue);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
}

.workspace-info {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  opacity: 0.8;
}

.workspace-label {
  font-size: 0.875rem;
}

.workspace-name {
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-indicators {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--danger-red);
  transition: background-color var(--transition-fast);
}

.connection-status[data-status="connected"] .status-dot,
#connection-indicator[data-status="connected"] .status-dot {
  background-color: var(--success-green);
}

.connection-status[data-status="reconnecting"] .status-dot,
#connection-indicator[data-status="reconnecting"] .status-dot {
  background-color: var(--warning-orange);
  animation: pulse 1s infinite;
}

.connection-status[data-status="error"] .status-dot,
#connection-indicator[data-status="error"] .status-dot {
  background-color: var(--danger-red);
}

.connection-status[data-status="connecting"] .status-dot,
#connection-indicator[data-status="connecting"] .status-dot {
  background-color: var(--warning-orange);
}

.connection-status[data-status="disconnected"] .status-dot,
#connection-indicator[data-status="disconnected"] .status-dot {
  background-color: var(--danger-red);
}

.session-status {
  font-size: 1.2rem;
}

/* Main Content */
.mobile-main {
  flex: 1;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  padding: var(--space-md);
  background-color: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  touch-action: manipulation;
}

.action-btn:hover {
  background-color: var(--bg-tertiary);
}

.action-btn:active {
  transform: scale(0.95);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.action-btn--start {
  border-color: var(--success-green);
}

.action-btn--stop {
  border-color: var(--warning-orange);
}

.action-btn--interrupt {
  border-color: var(--warning-orange);
  background: rgba(255, 193, 7, 0.1);
}

.action-btn--reset {
  border-color: var(--danger-red);
}

.btn-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-xs);
}

.btn-text {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.btn-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Sections */
.queue-section,
.output-section {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--bg-primary);
  gap: var(--space-sm);
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.queue-counter {
  background-color: var(--primary-blue);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  min-width: 20px;
  text-align: center;
}

.section-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.section-toggle:hover {
  background-color: var(--bg-primary);
}

.section-content {
  padding: var(--space-md);
}

/* Add Message Button */
.add-message-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background-color: var(--primary-blue);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-md);
}

.add-message-btn:hover {
  background-color: var(--primary-blue-dark);
}

.add-message-btn:active {
  transform: scale(0.98);
}

/* Queue Container */
.queue-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-height: 455px;
  overflow-y: auto;
  overflow-x: hidden;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-md);
  background-color: var(--bg-primary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--text-muted);
  transition: all var(--transition-fast);
  position: relative;
  transform: translateX(0);
}

.queue-item[data-status="pending"] {
  border-left-color: var(--info-cyan);
}

.queue-item[data-status="processing"] {
  border-left-color: var(--warning-orange);
  background-color: var(--bg-tertiary);
}

.queue-item[data-status="completed"] {
  border-left-color: var(--success-green);
  opacity: 0.7;
}

.queue-item[data-status="error"] {
  border-left-color: var(--danger-red);
}

.item-content {
  flex: 1;
  min-width: 0;
}

.item-text {
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: var(--space-xs);
  word-wrap: break-word;
}

.item-meta {
  display: flex;
  gap: var(--space-md);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.item-actions {
  display: flex;
  gap: var(--space-xs);
  margin-left: var(--space-sm);
}

.item-action {
  background: none;
  border: none;
  font-size: 1rem;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-action:hover {
  background-color: var(--bg-secondary);
}

/* Output Section */
.output-controls {
  display: flex;
  gap: var(--space-sm);
}

.control-btn {
  background-color: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  color: var(--text-secondary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.control-btn:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.output-container {
  background-color: var(--bg-primary);
  border-radius: var(--radius-md);
  max-height: 350px;
  overflow-y: auto;
}

.output-stream {
  padding: var(--space-md);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.4;
}

.output-line {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  padding: var(--space-xs) 0;
}

.line-prefix {
  flex-shrink: 0;
  font-size: 1rem;
}

.line-content {
  flex: 1;
  word-wrap: break-word;
}

.line-time {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.output-line[data-type="claude"] .line-content {
  color: var(--primary-blue-light);
}

.output-line[data-type="system"] .line-content {
  color: var(--text-muted);
}

.output-line[data-type="error"] .line-content {
  color: var(--danger-red);
}

/* Status Bar */
.status-bar {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--bg-tertiary);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  padding: var(--space-md);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--bg-tertiary);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border-top: 1px solid var(--bg-tertiary);
}

/* Form Elements */
textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-md);
  background-color: var(--bg-primary);
  border: 2px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
}

textarea::placeholder {
  color: var(--text-muted);
}

.btn {
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 100px;
}

.btn--primary {
  background-color: var(--primary-blue);
  color: white;
}

.btn--primary:hover {
  background-color: var(--primary-blue-dark);
}

.btn--secondary {
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--bg-tertiary);
}

.btn--secondary:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Loading Overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--bg-tertiary);
  border-top: 4px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: white;
  font-size: 1.125rem;
  font-weight: 500;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-width: 300px;
  transform: translateX(100%);
  animation: slideIn 0.3s ease forwards;
}

.toast.success {
  border-left: 4px solid var(--success-green);
}

.toast.error {
  border-left: 4px solid var(--danger-red);
}

.toast.warning {
  border-left: 4px solid var(--warning-orange);
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@keyframes slideIn {
  to { transform: translateX(0); }
}

/* Swipe Gestures */
.queue-item.swiping {
  transition: none;
}

.queue-item.swipe-left {
  transform: translateX(-100px);
}

.queue-item.swipe-right {
  transform: translateX(100px);
}

.queue-item::before,
.queue-item::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.queue-item::before {
  left: -80px;
  background: var(--danger-red);
  content: '🗑️';
}

.queue-item::after {
  right: -80px;
  background: var(--info-cyan);
  content: '📋';
}

.queue-item.swipe-left::before,
.queue-item.swipe-right::after {
  opacity: 1;
}

/* Responsive Design */

/* Mobile/Tablet Portrait (320px - 768px) */
@media (max-width: 768px) {
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
}

/* Mobile Portrait (320px - 480px) */
@media (max-width: 480px) {
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
  
  .action-btn {
    min-height: 60px;
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
  }
  
  .btn-icon {
    margin-bottom: 0;
    margin-right: var(--space-sm);
  }
  
  .btn-subtitle {
    display: none;
  }

  .header-content {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
  }

  .status-indicators {
    align-self: flex-end;
  }
}

/* Mobile Landscape (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .queue-section,
  .output-section {
    display: grid;
    grid-template-rows: auto 1fr;
  }
}

/* Tablet (769px - 1024px) */
@media (min-width: 769px) {
  .mobile-main {
    display: grid;
    grid-template-columns: 400px 1fr;
    grid-template-rows: auto 1fr;
    gap: var(--space-lg);
  }
  
  .quick-actions {
    grid-column: 1 / -1;
  }
  
  .queue-section {
    grid-column: 1;
    grid-row: 2;
  }
  
  .output-section {
    grid-column: 2;
    grid-row: 2;
  }
}

/* Desktop (1025px+) */
@media (min-width: 1025px) {
  .mobile-app {
    max-width: 1200px;
    margin: 0 auto;
  }
  
  /* Hide main section toggle buttons on desktop, but keep git subsection toggles */
  .section-toggle {
    display: none !important;
  }
  
  /* Ensure main section content is always visible on desktop */
  .section-content {
    display: block !important;
  }
  
  /* Git subsections remain collapsible on desktop */
  .subsection-title {
    cursor: pointer !important;
  }
}

/* Dark mode support (default) */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: var(--bg-primary-light);
    --bg-secondary: var(--bg-secondary-light);
    --bg-tertiary: var(--bg-tertiary-light);
    --text-primary: var(--text-primary-light);
    --text-secondary: var(--text-secondary-light);
    --text-muted: var(--text-muted-light);
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #333333;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
  }
}

/* Password Entry Modal */
.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;  
  justify-content: center;
  padding: var(--spacing-4);
}

.password-overlay.hidden {
  display: none;
}

.password-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  animation: slideIn 0.3s ease-out;
}

.password-header {
  padding: var(--spacing-6);
  text-align: center;
  border-bottom: 1px solid var(--bg-tertiary);
}

.password-header h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  margin-bottom: var(--spacing-2);
}

.password-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.password-body {
  padding: var(--spacing-6);
}

.password-field {
  width: 100%;
  padding: var(--spacing-3);
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color var(--transition-fast);
}

.password-field:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3);
}

.password-field::placeholder {
  color: var(--text-muted);
}

.password-error {
  margin-top: var(--spacing-2);
  padding: var(--spacing-2);
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid var(--danger-red);
  border-radius: var(--border-radius-sm);
  color: var(--danger-red);
  font-size: 0.85rem;
  display: none;
}

.password-error.show {
  display: block;
}

.password-footer {
  padding: var(--spacing-6);
  border-top: 1px solid var(--bg-tertiary);
}

.password-footer .btn {
  width: 100%;
}

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

/* ===== FILE EXPLORER STYLES ===== */

/* File Explorer Section */
.file-explorer-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: var(--space-lg);
  overflow: hidden;
}

.file-counter {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-left: var(--space-sm);
  font-weight: 400;
}

.explorer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  justify-content: flex-end;
  margin-left: auto;
}

/* File Tree Container */
.file-tree-container {
  position: relative;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  margin: var(--space-xs);
  border: 1px solid var(--border-color);
}

.file-tree {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.4;
}

/* File Tree Item */
.file-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast);
  position: relative;
  min-height: 44px; /* Touch-friendly minimum */
}

.file-item:hover {
  background-color: rgba(255,255,255,0.05);
}

.file-item:active {
  background-color: rgba(255,255,255,0.1);
}

.file-item:last-child {
  border-bottom: none;
}

/* File Item Components */
.file-indent {
  flex-shrink: 0;
  height: 16px;
}

.file-expand {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.file-expand.expanded {
  transform: rotate(90deg);
}

.file-expand:hover {
  color: var(--text-primary);
}

.file-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-name {
  flex: 1;
  white-space: nowrap;
  color: var(--text-primary);
  font-weight: 400;
}

.file-item.directory .file-name {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Loading indicator for file explorer */
.file-item.loading-indicator {
  background-color: rgba(255, 255, 255, 0.02);
  animation: pulse 1.5s ease-in-out infinite;
}

.file-item.loading-indicator .file-name {
  color: var(--text-muted);
  font-style: italic;
}

.file-item.loading-indicator .file-icon {
  animation: spin 1s linear infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

.file-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: var(--space-sm);
  flex-shrink: 0;
}

/* Loading and Empty States */
.file-tree-loading,
.file-tree-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--text-muted);
  text-align: center;
}

.file-tree-empty .empty-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  opacity: 0.5;
}

.file-tree-empty .empty-text {
  font-size: 0.9rem;
}

/* ===== FILE PREVIEW MODAL ===== */

/* File preview modal uses shared fullscreen classes */

.file-preview-modal .modal-header {
  flex-shrink: 0;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
}

.file-preview-modal .modal-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: var(--space-sm);
}

.file-preview-modal .modal-body {
  flex: 1;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.file-preview-modal .modal-footer {
  flex-shrink: 0;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  min-height: 32px;
  display: flex;
  align-items: center;
}

.preview-controls {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.file-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}

.file-separator {
  color: var(--text-muted);
  opacity: 0.5;
}

.preview-content-container {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: var(--code-bg);
}

.preview-content {
  height: 100%;
  overflow: auto;
  background: var(--code-bg);
}

.preview-content pre {
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.4;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  color: var(--code-text);
  background: transparent;
  white-space: pre;
  overflow-x: auto;
  word-wrap: normal;
  min-height: 100%;
}

.preview-content code {
  background: transparent;
  padding: var(--space-sm);
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  display: block;
  min-height: 100%;
}

/* Loading States */
.preview-loading,
.search-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
}

.preview-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--status-error);
  text-align: center;
}

.error-icon {
  font-size: 2rem;
  opacity: 0.7;
}

/* ===== FILE SEARCH MODAL ===== */

.file-search-modal .modal-content {
  width: 90vw;
  height: 75vh;
  max-width: 600px;
}

.search-form {
  margin-bottom: var(--space-lg);
}

.search-form input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
  margin-bottom: var(--space-sm);
}

.search-form input:focus {
  border-color: var(--primary-blue);
}

.search-form input::placeholder {
  color: var(--text-muted);
}

.search-filters {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
}

.search-filters select {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23969696' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right var(--space-sm) center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: calc(var(--space-md) + 20px);
}

.search-filters select:focus {
  border-color: var(--primary-blue);
}

.search-filters .action-btn {
  min-height: auto;
  height: 40px;
  padding: var(--space-sm) var(--space-md);
  min-width: 80px;
  font-size: 0.9rem;
}

.search-results-container {
  position: relative;
  height: calc(100% - 120px);
  overflow: hidden;
}

.search-results {
  height: 100%;
  overflow-y: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
}

/* Search results use file-item styling */
.file-item.search-result {
  border-left: 3px solid var(--primary-blue);
}

.file-item.search-result .file-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: 'SF Mono', Monaco, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.file-item.search-result .file-name {
  white-space: nowrap;
  flex-shrink: 0;
}

.search-result-item:hover {
  background-color: rgba(255,255,255,0.05);
}

.search-result-file {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.search-result-match {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-left: var(--space-sm);
}

.search-result-line {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-fast);
}

.search-result-item:hover {
  background-color: rgba(255,255,255,0.05);
}

.search-result-info {
  flex: 1;
}

.search-result-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.search-result-path {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: 'SF Mono', Monaco, monospace;
}

.search-result-actions {
  display: flex;
  gap: var(--space-xs);
}

.search-result-actions .action-btn {
  min-width: 32px;
  height: 32px;
  padding: 4px;
  font-size: 0.9rem;
}

.search-highlight {
  background-color: var(--status-warning);
  color: var(--bg-primary);
  padding: 1px 2px;
  border-radius: 2px;
}

.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--text-muted);
  text-align: center;
}

.search-empty .empty-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  opacity: 0.5;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Mobile optimizations for file explorer */
@media (max-width: 640px) {
  .file-tree-container {
    max-height: 300px;
  }
  
  .file-item {
    padding: 10px 8px;
    min-height: 48px;
  }
  
  .file-preview-modal .modal-content {
    width: 100vw;
    height: 100vh;
  }
  
  .preview-content pre {
    font-size: 11px;
  }
  
  .preview-content code {
    padding: var(--space-xs);
  }
  
  .file-search-modal .modal-content {
    width: 95vw;
    height: 80vh;
  }
  
  .search-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-filters select {
    margin-bottom: var(--space-sm);
  }

  .file-explorer-section {
    margin-bottom: inherit;
  }
}

/* ===== GIT CHANGES SECTION ===== */

.git-changes-section {
  margin-bottom: var(--space-lg);
}

.git-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-left: auto;
}

.branch-info {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border-left: 3px solid var(--primary-blue);
}

.branch-details {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.branch-name {
  font-weight: 600;
  color: var(--primary-blue);
  font-size: 0.9rem;
}

.branch-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 2px 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.commit-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
}

.commit-hash {
  font-family: 'Monaco', 'Consolas', monospace;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.commit-message {
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.git-status-container {
  position: relative;
}

.git-files {
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-tertiary);
  line-height: 1.3;
}

.git-file-item {
  display: flex;
  align-items: center;
  padding: 4px var(--space-sm);
  border-bottom: 1px solid var(--bg-tertiary);
  background: var(--bg-primary);
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 24px;
}

/* Git file status colors */
.git-file-item--modified {
  border-left: 3px solid var(--warning-orange);
}

.git-file-item--added {
  border-left: 3px solid var(--success-green);
}

.git-file-item--deleted {
  border-left: 3px solid var(--danger-red);
}

.git-file-item--renamed {
  border-left: 3px solid var(--info-cyan);
}

.git-file-item--untracked {
  border-left: 3px solid var(--text-muted);
}

.git-file-item:hover, .git-file-item:focus, .git-file-item.focused {
  background-color: rgba(255,255,255,0.05);
  outline: 1px solid var(--primary-blue);
  outline-offset: -1px;
}

.git-file-item:focus {
  outline: 2px solid var(--primary-blue);
}

.git-file-item:last-child {
  border-bottom: none;
}

.git-file-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-right: var(--space-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  flex-shrink: 0;
}

.git-file-status--modified {
  color: var(--warning-orange);
}

.git-file-status--added {
  color: var(--success-green);
}

.git-file-status--deleted {
  color: var(--danger-red);
}

.git-file-status--renamed {
  color: var(--info-cyan);
}

.git-file-status--untracked {
  color: var(--text-muted);
}

.git-file-info {
  flex: 1;
  min-width: 0;
}

.git-file-path {
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-bottom: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.git-file-changes {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.git-file-additions {
  color: var(--success-green);
}

.git-file-deletions {
  color: var(--danger-red);
}

.git-file-actions {
  display: flex;
  gap: var(--space-xs);
  margin-left: var(--space-sm);
}

.git-action-btn {
  padding: 4px 8px;
  border: 1px solid var(--bg-tertiary);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.git-action-btn:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.git-action-btn--stage {
  background: var(--success-green);
  border-color: var(--success-green);
  color: white;
}

.git-action-btn--unstage {
  background: var(--warning-orange);
  border-color: var(--warning-orange);
  color: white;
}

.git-action-btn--discard {
  background: var(--danger-red);
  border-color: var(--danger-red);
  color: white;
}

/* ===== SWIPE GESTURES ===== */

.swipe-indicator {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 80px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 10;
  pointer-events: none;
}

.swipe-indicator--stage {
  background: linear-gradient(90deg, var(--success-green), transparent);
  color: white;
}

.swipe-indicator--discard {
  background: linear-gradient(270deg, var(--danger-red), transparent);
  color: white;
}

.swipe-icon {
  font-size: 1.2rem;
  margin-bottom: 2px;
}

.swipe-text {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Add swipe hint animation */
@keyframes swipeHint {
  0% { transform: translateX(0); }
  50% { transform: translateX(10px); }
  100% { transform: translateX(0); }
}

.git-file-item:first-child::after {
  content: "← Swipe to interact →";
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.7;
  animation: swipeHint 2s ease-in-out infinite;
  pointer-events: none;
}

.git-clean {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  text-align: center;
}

.clean-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.clean-text {
  font-size: 0.9rem;
}

.git-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.git-search-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border: 1px solid var(--bg-tertiary);
}

.search-input-group {
  position: relative;
  margin-bottom: var(--space-sm);
}

.git-search-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.git-search-input:focus {
  border-color: var(--primary-blue);
}

.git-search-input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  position: absolute;
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 2px 6px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.search-clear-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.filter-controls {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.filter-btn {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.filter-btn.active {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.git-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  text-align: center;
}

.no-results-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.no-results-text {
  font-size: 0.9rem;
}

/* ===== DIFF VIEWER MODAL ===== */


.modal-content--large {
  max-width: 95vw !important;
  width: 95vw !important;
  height: 90vh !important;
  max-height: 90vh !important;
}

.diff-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.diff-stats-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-right: var(--space-sm);
}

.diff-stats-header .stat-item {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.compare-select {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.8rem;
}

.diff-content-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.diff-stats {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--bg-tertiary);
  margin-bottom: var(--space-sm);
}

.stat-item {
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.stat-item.additions {
  background: rgba(40, 167, 69, 0.2);
  color: var(--success-green);
}

.stat-item.deletions {
  background: rgba(220, 53, 69, 0.2);
  color: var(--danger-red);
}

.stat-item.file-type {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.diff-content {
  flex: 1;
  overflow: auto;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-tertiary);
}

.diff-lines {
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.4;
}

.diff-line {
  display: flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 0;
  border-left: 3px solid transparent;
}

.diff-line--header {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-sm);
  font-weight: 600;
}

.diff-line--addition {
  background: rgba(40, 167, 69, 0.1);
  border-left-color: var(--success-green);
}

.diff-line--deletion {
  background: rgba(220, 53, 69, 0.1);
  border-left-color: var(--danger-red);
}

.diff-line--context {
  background: var(--code-bg);
}

.diff-line--hunk {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-sm);
  font-weight: 600;
  border-top: 1px solid var(--bg-tertiary);
  border-bottom: 1px solid var(--bg-tertiary);
}

.diff-line--expand {
  background: var(--bg-secondary);
  color: var(--primary-blue);
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-align: center;
  font-style: italic;
  border: 1px dashed var(--bg-tertiary);
  margin: 2px 0;
}

.diff-line--expand:hover {
  background: var(--primary-blue);
  color: white;
}

.expand-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.expand-btn {
  background: none;
  border: none;
  color: var(--primary-blue);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  transition: background-color 0.2s ease;
}

.expand-btn:hover {
  background: var(--primary-blue);
  color: white;
}

.diff-line-number {
  display: inline-block;
  width: 50px;
  padding: 0 var(--space-sm);
  color: var(--text-muted);
  text-align: right;
  user-select: none;
  font-size: 0.75rem;
}

.diff-line-content {
  flex: 1;
  padding: 0 var(--space-sm);
  color: var(--code-text);
  white-space: pre;
  overflow-x: auto;
}

.diff-line--addition .diff-line-content {
  color: var(--success-green);
}

.diff-line--deletion .diff-line-content {
  color: var(--danger-red);
}

.diff-actions {
  display: flex;
  gap: var(--space-sm);
}

.diff-info {
  flex: 1;
}

.file-path {
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.diff-loading, .diff-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  text-align: center;
}

.diff-error .error-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  color: var(--danger-red);
}

/* ===== GIT CONFIRMATION MODAL ===== */

.git-confirm-modal .modal-content {
  max-width: 400px;
  width: 90vw;
}

.confirm-content {
  text-align: center;
  padding: var(--space-lg) 0;
}

.confirm-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.confirm-message {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.confirm-details {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn--danger {
  background: var(--danger-red);
  border-color: var(--danger-red);
  color: white;
}

.btn--danger:hover {
  background: #c82333;
  border-color: #c82333;
}

/* Large screen optimizations */
@media (min-width: 1024px) {
  .file-tree-container {
    max-height: 500px;
  }
  
  .file-preview-modal .modal-content {
    width: 100vw;
    height: 100vh;
    max-width: none;
  }
  
  .preview-content pre {
    font-size: 14px;
  }
}

/* High DPI screen optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .file-icon {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Dark theme specific adjustments */
@media (prefers-color-scheme: dark) {
  .file-item:hover {
    background-color: rgba(255,255,255,0.08);
  }
  
  .file-item:active {
    background-color: rgba(255,255,255,0.12);
  }
  
  .preview-content {
    --code-bg: #1a1a1a;
    --code-text: #e0e0e0;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus indicators for accessibility */
.control-btn:focus,
.git-action-btn:focus,
.filter-btn:focus,
.section-toggle:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.git-file-item:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
  background: rgba(70, 130, 180, 0.1);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .git-file-item {
    border: 1px solid var(--text-color);
  }
  
  .git-action-btn {
    border: 1px solid currentColor;
  }
  
  .filter-btn.active {
    outline: 2px solid var(--text-color);
  }
}

/* Performance Dashboard */
.performance-dashboard {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  display: none;
}

.performance-dashboard.visible {
  display: block;
}

.performance-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.performance-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.performance-metric {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.metric-name {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-color);
}

.metric-unit {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: 2px;
}

/* Performance indicator in header */
.performance-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.performance-indicator:hover {
  background: rgba(255, 255, 255, 0.1);
}

.performance-indicator.slow {
  color: #ff6b6b;
}

.performance-indicator.fast {
  color: #51cf66;
}

/* Content match highlighting */
.has-content-match {
  background: rgba(70, 130, 180, 0.1);
  border-left: 3px solid var(--primary-color);
  animation: contentMatchHighlight 0.6s ease-out;
}

@keyframes contentMatchHighlight {
  0% { 
    background: rgba(70, 130, 180, 0.3);
    transform: scale(1.02);
  }
  100% { 
    background: rgba(70, 130, 180, 0.1);
    transform: scale(1);
  }
}

.content-match-info {
  font-size: 0.75rem;
  color: var(--primary-color);
  margin-top: 2px;
  animation: slideInFromRight 0.3s ease-out;
}

@keyframes slideInFromRight {
  0% {
    opacity: 0;
    transform: translateX(20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Git file item animations */
.git-file-item {
  transition: all 0.3s ease;
}

.git-file-item:hover {
  transform: translateX(4px);
}

.git-file-item.staging {
  animation: stagingPulse 0.8s ease-in-out;
}

.git-file-item.unstaging {
  animation: unstagingPulse 0.8s ease-in-out;
}

.git-file-item.discarding {
  animation: discardingShake 0.6s ease-in-out;
}

@keyframes stagingPulse {
  0%, 100% { background: transparent; }
  50% { background: rgba(34, 197, 94, 0.2); }
}

@keyframes unstagingPulse {
  0%, 100% { background: transparent; }
  50% { background: rgba(251, 191, 36, 0.2); }
}

@keyframes discardingShake {
  0%, 100% { 
    background: transparent;
    transform: translateX(0); 
  }
  25% { 
    background: rgba(239, 68, 68, 0.2);
    transform: translateX(-4px); 
  }
  75% { 
    background: rgba(239, 68, 68, 0.2);
    transform: translateX(4px); 
  }
}

/* Performance dashboard animations */
.performance-dashboard {
  transition: all 0.3s ease;
  overflow: hidden;
}

.performance-dashboard.visible {
  animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
  0% {
    opacity: 0;
    max-height: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    max-height: 200px;
    transform: translateY(0);
  }
}

.performance-metric {
  animation: fadeInScale 0.5s ease-out;
  animation-fill-mode: both;
}

.performance-metric:nth-child(1) { animation-delay: 0.1s; }
.performance-metric:nth-child(2) { animation-delay: 0.2s; }
.performance-metric:nth-child(3) { animation-delay: 0.3s; }
.performance-metric:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Git Interface Enhancements */
.git-changes-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.git-changes-section .section-content {
  padding: var(--space-xs);
  max-height: 400px;
  overflow-y: auto;
}

.file-explorer-section .section-content {
  padding: 0;
  max-height: 400px;
}

.git-subsection {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-tertiary);
  overflow: hidden;
}

.git-subsection:first {
  margin-bottom: var(--space-sm);
}

.subsection-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-tertiary);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.subsection-title:hover {
  background: var(--bg-tertiary);
}


.subsection-title .toggle-icon {
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.subsection-title .file-counter {
  background: var(--primary-blue);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  margin-left: auto;
}

.subsection-content {
  padding: 0;
}

/* Shared Fullscreen Modal Classes */
.modal-fullscreen {
  z-index: 9999;
  padding: 0 !important;
  margin: 0 !important;
  align-items: stretch !important;
  justify-content: stretch !important;
}

.modal-content-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  border: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Shared fullscreen modal parts */
.modal-fullscreen .modal-header {
  flex-shrink: 0;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
}

.modal-fullscreen .modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.modal-fullscreen .modal-footer {
  flex-shrink: 0;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  min-height: 32px;
  display: flex;
  align-items: center;
}

.inline-diff {
  flex: 1;
  overflow: hidden;
}

.raw-view {
  flex: 1;
  overflow: hidden;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.4;
  background: var(--code-bg);
  border-radius: var(--radius-md);
}

.raw-view .diff-editor {
  height: 100%;
  overflow: auto;
  background: var(--code-bg);
}

.raw-view .diff-editor pre {
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.4;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  color: var(--code-text);
  background: transparent;
  white-space: pre;
  overflow-x: auto;
  word-wrap: normal;
}

.raw-view .diff-editor code {
  background: transparent;
  padding: var(--space-sm);
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  display: block;
  min-height: 100%;
}

.diff-editor {
  height: 100%;
  overflow-y: auto;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.4;
  background: var(--code-bg);
  border-radius: var(--radius-md);
}

.diff-line {
  display: flex;
  align-items: stretch;
  min-height: 18px;
  border-left: 3px solid transparent;
}

.diff-line.addition {
  background-color: rgba(40, 167, 69, 0.1);
  border-left-color: var(--success-green);
}

.diff-line.deletion {
  background-color: rgba(220, 53, 69, 0.1);
  border-left-color: var(--danger-red);
}

.diff-line.context {
  background-color: transparent;
}

.diff-line.hunk-header {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--bg-tertiary);
  border-bottom: 1px solid var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 600;
  margin: var(--space-xs) 0;
}

.diff-line:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.line-numbers {
  display: flex;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--bg-tertiary);
  padding: 0 var(--space-sm);
  min-width: 80px;
  user-select: none;
}

.old-line-num,
.new-line-num {
  width: 35px;
  text-align: right;
  color: var(--text-muted);
  font-size: 11px;
  padding: 0 4px;
}

.old-line-num {
  border-right: 1px solid var(--bg-tertiary);
}

.line-change-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
  font-weight: bold;
  background: var(--bg-secondary);
  border-right: 1px solid var(--bg-tertiary);
}

.addition .line-change-indicator {
  color: var(--success-green);
}

.deletion .line-change-indicator {
  color: var(--danger-red);
}

.context .line-change-indicator {
  color: var(--text-muted);
}

.line-content {
  flex: 1;
  padding: 0 var(--space-sm);
  white-space: pre;
  color: var(--code-text);
  overflow-x: auto;
}

/* Binary and special file notices */
.binary-notice,
.new-file-notice,
.deleted-file-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin: var(--space-md);
}

/* Diff stats enhancements */
.diff-stats {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  font-family: monospace;
}

.diff-stats .stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 600;
}

.diff-stats .additions {
  color: var(--success-green);
}

.diff-stats .deletions {
  color: var(--danger-red);
}

/* Disclaimer Banner */
.disclaimer-banner {
  background: linear-gradient(135deg, var(--warning-orange), #e67e22);
  border-top: 1px solid var(--bg-tertiary);
  padding: var(--space-sm) var(--space-md);
  margin-top: auto;
}

.disclaimer-content {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  max-width: 100%;
}

.disclaimer-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.disclaimer-text {
  font-size: 0.8rem;
  line-height: 1.3;
  color: #ffffff;
  font-weight: 500;
}

.disclaimer-text strong {
  font-weight: 700;
}

/* Responsive disclaimer */
@media (max-width: 480px) {
  .disclaimer-text {
    font-size: 0.75rem;
  }
  
  .disclaimer-banner {
    padding: var(--space-xs) var(--space-sm);
  }
}