/* Import JetBrains Mono font */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&display=swap');

/* Base styles */
* {
  font-family: 'JetBrains Mono', monospace;
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  width: 100%;
}

/* CSS Custom Properties for consistent design system */
:root {
  /* Color palette */
  --color-bg-primary: #0d1117;
  --color-bg-secondary: #161b22;
  --color-bg-tertiary: #1a1f2e;
  --color-bg-input: #21262d;
  --color-border: #30363d;
  --color-border-hover: #484f58;
  
  --color-text-primary: #e6edf3;
  --color-text-secondary: #8b949e;
  --color-text-muted: #6e7681;
  
  --color-accent-blue: #58a6ff;
  --color-accent-green: #3fb950;
  --color-accent-yellow: #d29922;
  --color-accent-red: #f85149;
  --color-accent-purple: #a371f7;
  --color-accent-pink: #f778ba;
  --color-accent-orange: #f0883e;
  
  /* Spacing system */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Typography */
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
  
  /* Terminal dimensions */
  --terminal-min-height: 280px;
  --terminal-max-height: 400px;
}

/* Responsive custom properties */
@media (min-width: 480px) {
  :root {
    --terminal-min-height: 320px;
    --terminal-max-height: 450px;
  }
}

@media (min-width: 768px) {
  :root {
    --terminal-min-height: 400px;
    --terminal-max-height: 500px;
  }
}

@media (min-width: 1024px) {
  :root {
    --terminal-min-height: 450px;
    --terminal-max-height: 550px;
  }
}

/* Terminal background */
.terminal-bg {
  background: var(--color-bg-primary);
}

.terminal-header {
  background: linear-gradient(135deg, var(--color-bg-tertiary) 0%, var(--color-bg-secondary) 100%);
}

/* Git status colors */
.git-branch {
  color: var(--color-accent-pink);
}

.git-added {
  color: var(--color-accent-green);
}

.git-modified {
  color: var(--color-accent-yellow);
}

.git-deleted {
  color: var(--color-accent-red);
}

.git-untracked {
  color: var(--color-text-secondary);
}

.commit-hash {
  color: var(--color-accent-blue);
}

/* Blinking cursor animation */
.blink {
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.file-icon {
  display: inline-block;
  width: 16px;
  text-align: center;
  margin-right: var(--space-sm);
  font-weight: bold;
}

/* Custom scrollbar */
.terminal-output::-webkit-scrollbar {
  width: 6px;
}

.terminal-output::-webkit-scrollbar-track {
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
}

.terminal-output::-webkit-scrollbar-thumb {
  background: var(--color-accent-blue);
  border-radius: var(--radius-sm);
  transition: background var(--transition-normal);
}

.terminal-output::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent-purple);
}

/* Terminal output container */
.terminal-output {
  min-height: var(--terminal-min-height);
  max-height: var(--terminal-max-height);
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  word-wrap: break-word;
  word-break: break-word;
}

/* Button hover and focus states */
.btn-interactive {
  transition: all var(--transition-normal);
  cursor: pointer;
  border: 1px solid transparent;
}

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

.btn-interactive:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-interactive:focus {
  outline: 2px solid var(--color-accent-blue);
  outline-offset: 2px;
}

/* Quick command buttons */
.quick-cmd {
  transition: all var(--transition-normal);
  border: 1px solid var(--color-border);
}

.quick-cmd:hover {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-hover);
  transform: translateY(-1px);
}

.quick-cmd:active {
  transform: translateY(0);
  background: var(--color-bg-secondary);
}

/* Input focus state */
.input-focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-accent-blue);
}

/* Input container animation */
.input-container {
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  border: 1px solid var(--color-border);
}

.input-container:focus-within {
  border-color: var(--color-accent-blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

/* Window dots animation */
.window-dot {
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.window-dot:hover {
  transform: scale(1.2);
  opacity: 0.8;
}

/* Traffic light animation on hover */
.window-controls:hover .window-dot {
  animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Status badge styles */
.status-badge {
  transition: all var(--transition-normal);
}

.status-badge:hover {
  transform: scale(1.05);
}

/* Modal transitions */
.modal-overlay {
  transition: opacity var(--transition-slow);
}

.modal-content {
  transition: transform var(--transition-slow), opacity var(--transition-slow);
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-overlay.hidden .modal-content {
  transform: scale(0.95);
  opacity: 0;
}

/* Terminal line animation */
.terminal-line {
  animation: fadeIn var(--transition-fast) ease-out;
}

@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translateY(4px);
  }
  to { 
    opacity: 1; 
    transform: translateY(0);
  }
}

/* Main container responsive fixes */
.main-container {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Mobile-first responsive styles (480px) */
@media (max-width: 479px) {
  .main-container {
    padding: var(--space-sm);
  }
  
  .terminal-body {
    padding: var(--space-sm);
  }
  
  .prompt-text {
    font-size: var(--font-size-xs);
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .cmd-input {
    font-size: var(--font-size-sm);
  }
  
  .header-title {
    font-size: var(--font-size-sm);
  }
  
  .header-buttons {
    gap: var(--space-xs);
  }
  
  .header-buttons button {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.65rem;
  }
  
  .header-buttons button i {
    display: none;
  }
  
  .quick-actions {
    gap: var(--space-xs);
  }
  
  .quick-cmd {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
  }
}

/* Small tablets and large phones (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
  .main-container {
    padding: var(--space-md);
  }
  
  .terminal-body {
    padding: var(--space-md);
  }
  
  .prompt-text {
    font-size: var(--font-size-sm);
  }
  
  .header-buttons button {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
  }
}

/* Tablets (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .main-container {
    padding: var(--space-lg);
  }
  
  .terminal-body {
    padding: var(--space-lg);
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  .main-container {
    padding: var(--space-xl);
    max-width: 1200px;
    margin: 0 auto;
  }
  
  .terminal-body {
    padding: var(--space-xl);
  }
}

/* Feedback animation for command execution */
@keyframes commandFeedback {
  0% { background-color: rgba(88, 166, 255, 0.1); }
  100% { background-color: transparent; }
}

.command-feedback {
  animation: commandFeedback 0.3s ease-out;
}

/* Success feedback */
@keyframes successPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(63, 185, 80, 0); }
}

.success-feedback {
  animation: successPulse 0.6s ease-out;
}

/* Error feedback */
@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.error-feedback {
  animation: errorShake 0.3s ease-out;
}

/* Editor modal mobile styles */
#editor-modal .modal-content {
  display: flex;
  flex-direction: column;
}

#editor-textarea {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 1.5;
}

/* Editor line numbers - display vertically */
#editor-line-numbers {
  white-space: pre;
  line-height: 1.5;
}

/* Mobile editor adjustments */
@media (max-width: 479px) {
  #editor-modal .modal-content {
    max-height: 85vh;
    margin: var(--space-sm);
    border-radius: var(--radius-md);
  }
  
  #editor-textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
    min-height: 150px;
  }
  
  #editor-line-numbers {
    min-width: 2rem;
    padding: var(--space-sm) var(--space-xs);
  }
}

@media (min-width: 480px) and (max-width: 767px) {
  #editor-modal .modal-content {
    max-height: 88vh;
  }
  
  #editor-textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
}

/* Editor action buttons for mobile */
.editor-action-btn {
  transition: all var(--transition-normal);
  cursor: pointer;
}

.editor-action-btn:hover {
  transform: translateY(-1px);
}

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