/**
 * Terminal Contact Form Modal Styles
 * SSH-style contact form overlay
 */

/* Overlay backdrop */
.contact-form-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.contact-form-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* Terminal window container */
.contact-terminal {
  position: relative;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  background: #111113;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.2s ease;
  overflow: hidden;
}

.contact-form-overlay.is-open .contact-terminal {
  transform: scale(1);
}

/* Title bar (macOS terminal style) */
.terminal-titlebar {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: #1a1a1c;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

.titlebar-buttons {
  display: flex;
  gap: 8px;
  margin-right: 12px;
}

.titlebar-buttons span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: default;
}

.titlebar-buttons .btn-close {
  background: #ff5f56;
  cursor: pointer;
}

.titlebar-buttons .btn-close:hover {
  background: #ff3b30;
}

.titlebar-buttons .btn-minimize {
  background: #ffbd2e;
}

.titlebar-buttons .btn-maximize {
  background: #27ca40;
}

.titlebar-title {
  flex: 1;
  text-align: center;
  font-family: 'Fira Code', 'SF Mono', Monaco, monospace;
  font-size: 13px;
  color: #888;
  margin-right: 60px; /* Balance for buttons */
}

/* Terminal content area */
.terminal-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  font-family: 'Fira Code', 'SF Mono', Monaco, monospace;
  font-size: 14px;
  line-height: 1.7;
  color: #e6edf3;
  min-height: 300px;
  max-height: calc(85vh - 100px);
}

/* Scrollbar styling */
.terminal-content::-webkit-scrollbar {
  width: 8px;
}

.terminal-content::-webkit-scrollbar-track {
  background: #1a1a1c;
}

.terminal-content::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

.terminal-content::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* SSH connection status */
.ssh-status {
  color: #72cc96;
  margin-bottom: 16px;
}

/* Banner */
.terminal-banner {
  color: #888;
  margin-bottom: 20px;
  white-space: pre;
}

/* Terminal lines */
.terminal-line {
  margin-bottom: 4px;
  word-wrap: break-word;
}

.terminal-line.dim {
  color: #666;
}

.terminal-line.success {
  color: #72cc96;
}

.terminal-line.error {
  color: #ee5f5b;
}

.terminal-line.prompt-line {
  display: flex;
  align-items: flex-start;
}

/* Prompt styling */
.terminal-prompt {
  color: #72cc96;
  margin-right: 8px;
  flex-shrink: 0;
}

/* Input display area */
.terminal-input-display {
  color: #e6edf3;
  flex: 1;
  word-break: break-all;
}

/* Blinking cursor */
.terminal-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.15em;
  background: #72cc96;
  animation: cursor-blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 1px;
}

.terminal-cursor.typing {
  animation: none;
  opacity: 1;
}

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

/* Hidden actual input - positioned inside terminal for IME popup placement */
.terminal-hidden-input {
  position: absolute;
  bottom: 60px;
  left: 20px;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  resize: none;
  overflow: hidden;
  z-index: -1;
  /* Make it invisible but keep IME popup positioned correctly */
  opacity: 0.01;
}

/* Options list for inquiry type */
.terminal-options {
  margin: 8px 0 8px 24px;
}

.terminal-option {
  color: #e6edf3;
  padding: 2px 0;
}

.terminal-option-number {
  color: #72cc96;
  margin-right: 8px;
}

/* Confirmation box */
.terminal-confirm-box {
  margin: 12px 0;
  padding: 12px 0;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
}

.terminal-confirm-box .confirm-label {
  color: #888;
}

.terminal-confirm-box .confirm-value {
  color: #e6edf3;
  margin-left: 8px;
}

/* Status bar */
.terminal-statusbar {
  display: flex;
  justify-content: space-between;
  padding: 6px 14px;
  background: #1a1a1c;
  border-top: 1px solid #333;
  font-family: 'Fira Code', 'SF Mono', Monaco, monospace;
  font-size: 11px;
  color: #666;
  flex-shrink: 0;
}

.status-step {
  color: #72cc96;
}

.status-info {
  display: flex;
  gap: 12px;
}

/* Spinner animation */
.terminal-spinner {
  display: inline-block;
}

@keyframes spin-chars {
  0% { content: '|'; }
  25% { content: '/'; }
  50% { content: '-'; }
  75% { content: '\\'; }
}

/* Message multiline display */
.terminal-message-content {
  white-space: pre-wrap;
  word-break: break-word;
  color: #e6edf3;
}

/* Light mode support */
@media (prefers-color-scheme: light) {
  .contact-form-overlay {
    background: rgba(0, 0, 0, 0.6);
  }

  .contact-terminal {
    background: #f6f8fa;
    border-color: #d0d7de;
  }

  .terminal-titlebar {
    background: #e6e8eb;
    border-color: #d0d7de;
  }

  .titlebar-title {
    color: #57606a;
  }

  .terminal-content {
    color: #1f2328;
  }

  .terminal-content::-webkit-scrollbar-track {
    background: #e6e8eb;
  }

  .terminal-content::-webkit-scrollbar-thumb {
    background: #afb8c1;
  }

  .ssh-status {
    color: #1a7f37;
  }

  .terminal-banner {
    color: #57606a;
  }

  .terminal-line.success {
    color: #1a7f37;
  }

  .terminal-prompt {
    color: #1a7f37;
  }

  .terminal-input-display {
    color: #1f2328;
  }

  .terminal-cursor {
    background: #1a7f37;
  }

  .terminal-option {
    color: #1f2328;
  }

  .terminal-option-number {
    color: #1a7f37;
  }

  .terminal-confirm-box {
    border-color: #d0d7de;
  }

  .terminal-confirm-box .confirm-label {
    color: #57606a;
  }

  .terminal-confirm-box .confirm-value {
    color: #1f2328;
  }

  .terminal-statusbar {
    background: #e6e8eb;
    border-color: #d0d7de;
    color: #57606a;
  }

  .status-step {
    color: #1a7f37;
  }
}

/* Mobile responsive */
@media screen and (max-width: 640px) {
  .contact-terminal {
    width: 95%;
    max-height: 90vh;
    border-radius: 6px;
  }

  .terminal-content {
    padding: 12px 14px;
    font-size: 13px;
    max-height: calc(90vh - 90px);
  }

  .terminal-titlebar {
    padding: 8px 12px;
  }

  .titlebar-title {
    font-size: 12px;
    margin-right: 50px;
  }

  .titlebar-buttons span {
    width: 10px;
    height: 10px;
  }

  .terminal-statusbar {
    padding: 5px 12px;
    font-size: 10px;
  }
}

/* Contact trigger link styling */
.contact-trigger {
  color: #72cc96;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
  display: inline-block;
  transform: translate(2px, 1.75px);
}

.contact-trigger:hover {
  opacity: 0.8;
  text-decoration: underline;
}

@media (prefers-color-scheme: light) {
  .contact-trigger {
    color: #1a7f37;
  }
}

/* Disable grid background interaction when modal is open */
body.contact-form-active .block-left,
body.contact-form-active canvas {
  pointer-events: none;
}
