/**
 * Terminal Mode Styling
 * Minimalist aesthetic inspired by The Fragile
 * Clean, clinical precision with subtle texture
 */

#terminal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f5f5f5;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

#terminal-container.active {
  opacity: 1;
  pointer-events: all;
}

/* Terminal header - minimal info bar */
.terminal-header {
  padding: 1rem 2rem;
  background: #ffffff;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: #666666;
  text-transform: lowercase;
}

.terminal-header .terminal-title {
  font-weight: 400;
  letter-spacing: 0.05em;
}

.terminal-header .terminal-exit {
  cursor: pointer;
  padding: 0.25rem 0.75rem;
  border: 1px solid #e8e8e8;
  transition: all 0.3s ease;
}

.terminal-header .terminal-exit:hover {
  border-color: #666666;
  background: #f5f5f5;
}

/* Main terminal area */
#terminal {
  flex: 1;
  padding: 2rem;
  overflow: hidden;
}

/* xterm.js overrides for minimalist theme */
.xterm {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
}

.xterm .xterm-viewport {
  background-color: #f5f5f5 !important;
  overflow-y: auto !important;
}

.xterm .xterm-screen {
  background-color: #f5f5f5 !important;
}

/* Scrollbar styling */
.xterm .xterm-viewport::-webkit-scrollbar {
  width: 8px;
}

.xterm .xterm-viewport::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.xterm .xterm-viewport::-webkit-scrollbar-thumb {
  background: #cccccc;
  border-radius: 0;
}

.xterm .xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: #999999;
}

/* Cursor styling */
.xterm .xterm-cursor-layer {
  opacity: 1;
}

.xterm .xterm-cursor {
  background-color: #666666 !important;
}

/* Selection styling */
.xterm .xterm-selection {
  background-color: rgba(102, 102, 102, 0.2) !important;
}

/* Link styling */
.xterm .xterm-link {
  color: #4a90e2 !important;
  text-decoration: underline;
}

.xterm .xterm-link:hover {
  color: #357abd !important;
}

/* Vim modal styling (for read-only file viewer) */
.vim-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(245, 245, 245, 0.95);
  z-index: 10000;
  display: none;
  flex-direction: column;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.vim-modal.active {
  display: flex;
  opacity: 1;
}

.vim-modal .vim-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: #666666;
  margin-bottom: 1rem;
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

.vim-modal .vim-content {
  flex: 1;
  background: #ffffff;
  border: 1px solid #e8e8e8;
  padding: 2rem;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.8;
  color: #333333;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.vim-modal .vim-footer {
  margin-top: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: #666666;
  text-transform: lowercase;
}

/* Fade animation for terminal entry/exit */
@keyframes terminalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes terminalFadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

#terminal-container.entering {
  animation: terminalFadeIn 0.8s ease forwards;
}

#terminal-container.exiting {
  animation: terminalFadeOut 0.8s ease forwards;
}

/* Subtle breathing animation for terminal (very minimal) */
@keyframes terminalBreathe {
  0%, 100% {
    opacity: 0.99;
  }
  50% {
    opacity: 1;
  }
}

#terminal {
  animation: terminalBreathe 8s ease-in-out infinite;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .terminal-header {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
  }

  #terminal {
    padding: 1rem;
  }

  .xterm {
    font-size: 12px !important;
  }
}

@media (max-width: 480px) {
  .terminal-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
  }

  #terminal {
    padding: 0.5rem;
  }

  .xterm {
    font-size: 11px !important;
  }
}
