/**
 * Shell Hotkey Trainer - Styles
 * Minimal design with Tango + Ghostty terminal color palette
 */

:root {
  /* Custom Color Palette - Extracted from Design */
  --color-burgundy: #A63254;
  --color-coral: #E25749;
  --color-lavender: #A6A1BC;
  --color-olive-green: #B5B661;
  --color-orange: #D9934F;
  --color-pink: #D84178;
  
  /* Semantic Color Assignments */
  --bg-dark: #282c34;
  --text-light: #ffffff;
  --text-muted: #bebfc1;
  --underscore-yellow: var(--color-orange);
  --success-green: var(--color-olive-green);
  --error-red: var(--color-coral);
  --accent-blue: var(--color-lavender);
  --accent-pink: var(--color-pink);
  
  /* Spacing */
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  
  /* Typography */
  --font-mono: 'Roboto Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  --font-size-base: 18px;
  --font-size-lg: 20px;
  --line-height: 1.6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  background-color: var(--bg-dark);
  color: var(--text-light);
  overflow: hidden;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 90%;
  max-width: 1100px;
  position: relative;
}

/* Top Buttons Container */
.top-buttons {
  position: fixed;
  top: var(--spacing-md);
  left: var(--spacing-md);
  display: flex;
  gap: var(--spacing-md);
  z-index: 100;
}

/* About and GitHub Buttons */
.about-button,
.github-button {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  cursor: pointer;
  transition: color 0.2s ease;
  text-decoration: none;
}

.about-button:hover,
.github-button:hover {
  color: var(--accent-blue);
}

.about-button:active,
.github-button:active {
  color: var(--text-light);
}

/* Stats Display */
.stats {
  position: fixed;
  top: var(--spacing-md);
  right: var(--spacing-md);
  display: flex;
  gap: var(--spacing-md);
  font-size: var(--font-size-lg);
  line-height: 1;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-hits {
  color: var(--success-green);
}

.stat-misses {
  color: var(--error-red);
}

.stat-strokes {
  color: var(--underscore-yellow);
  font-weight: bold;
}

/* Stage Info */
.stage-info {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  color: var(--text-muted);
  font-size: 14px;
}

.drill-name {
  color: var(--text-muted);
  font-size: 18px;
  margin-bottom: var(--spacing-sm);
  font-weight: normal;
}

.stage-name {
  color: var(--accent-pink);
  font-weight: bold;
  font-size: 16px;
  margin-bottom: var(--spacing-sm);
}

.progress {
  color: var(--text-muted);
}

/* Prompt Display */
.prompt-container {
  margin-bottom: var(--spacing-lg);
}

.prompt-label {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.prompt {
  background-color: var(--bg-dark);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: 4px;
  font-size: var(--font-size-lg);
  min-height: 60px;
  display: flex;
  align-items: center;
  transition: background-color 0.2s ease;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Goal prompt styling */
.goal-text-secondary {
  color: var(--text-muted);
}

.goal-word {
  color: var(--text-light);
  text-shadow: 0 0 8px rgba(166, 161, 188, 0.6), 0 0 4px rgba(166, 161, 188, 0.4);
}

/* Search mode styling */
.search-mode {
  background-color: rgba(114, 159, 207, 0.1);
}

.search-prompt {
  color: var(--accent-blue);
  font-weight: bold;
}

/* Cursor character and underscore */
.cursor-wrapper {
  position: relative;
  display: inline-block;
  vertical-align: baseline;
}

.cursor-char {
  position: relative;
  z-index: 1;
}

.underscore {
  color: var(--text-light);
  animation: underscore-blink 1s infinite;
  font-weight: bold;
  position: absolute;
  left: 0;
  bottom: -0.15em;
  line-height: 1;
  z-index: 0;
  width: 100%;
  text-align: left;
}

@keyframes underscore-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.3; }
}

.goal-state .underscore {
  animation: underscore-blink 1s infinite;
}

/* Error Feedback */
.error-blink {
  animation: error-flash 0.2s ease-out;
}

@keyframes error-flash {
  0%, 100% { 
    background-color: var(--bg-dark);
    border-color: var(--text-muted);
  }
  50% { 
    background-color: rgba(239, 41, 41, 0.2);
    border-color: var(--error-red);
  }
}

/* Hint Display */
.hint-container {
  position: fixed !important;
  bottom: var(--spacing-md) !important;
  left: var(--spacing-md) !important;
  right: auto !important;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--spacing-sm);
  min-width: 200px;
  max-width: 300px;
  z-index: 1000;
}

.hint {
  display: none;
  background-color: rgba(114, 159, 207, 0.2);
  color: var(--accent-blue);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 4px;
  font-size: 14px;
  border: 1px solid var(--accent-blue);
  text-align: left;
  width: fit-content;
}

.hint kbd {
  background-color: rgba(255, 255, 255, 0.15);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--accent-blue);
  margin: 0 2px;
  display: inline-block;
}

.hint.visible {
  display: block;
  animation: hint-appear 0.3s ease-out;
}

.hint.success {
  background-color: rgba(138, 226, 52, 0.2);
  color: var(--success-green);
  border-color: var(--success-green);
}

.hint.restore-notification {
  background-color: rgba(114, 159, 207, 0.15);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

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

/* Instructions */
.instructions {
  position: fixed;
  bottom: var(--spacing-md);
  right: var(--spacing-md);
  color: var(--text-muted);
  font-size: 12px;
  text-align: right;
  font-family: var(--font-mono);
}

.instructions-title {
  margin-bottom: var(--spacing-sm);
  font-weight: bold;
  color: var(--text-muted);
}

.instructions-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  align-items: flex-end;
}

.instructions-list li {
  display: grid;
  grid-template-columns: 50px 20px 30px 1fr;
  gap: 6px;
  align-items: center;
  width: 100%;
  font-family: var(--font-mono);
}

.key-modifier {
  text-align: right;
  font-family: var(--font-mono);
}

.key-plus {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.key-letter {
  text-align: left;
  font-family: var(--font-mono);
}

.key-description {
  text-align: left;
  margin-left: var(--spacing-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.instructions kbd {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid var(--text-muted);
  margin: 0 2px;
}

.instructions kbd + kbd {
  margin-left: 4px;
}

/* Completion State */
.completed .prompt {
  border-color: var(--success-green);
  background-color: rgba(138, 226, 52, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
  :root {
    --font-size-base: 14px;
    --font-size-lg: 18px;
  }
  
  .container {
    width: 95%;
  }
  
  .stats {
    font-size: 12px;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
  }
  
  .instructions {
    display: none;
  }
}

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

/* Focus indicators */
:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background-color: var(--accent-blue);
  color: var(--bg-dark);
}

/* Modal Styles */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  animation: fadeIn 0.2s ease-out;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: var(--bg-dark);
  border: 1px solid var(--text-muted);
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--spacing-xl);
  position: relative;
  animation: slideUp 0.3s ease-out;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

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

.modal-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  font-family: var(--font-mono);
}

.modal-close:hover {
  color: var(--text-light);
}

.modal-title {
  color: var(--text-light);
  font-size: 24px;
  font-weight: bold;
  margin-bottom: var(--spacing-lg);
  font-family: var(--font-mono);
}

.modal-body {
  color: var(--text-muted);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
}

.modal-body p {
  margin-bottom: var(--spacing-md);
}

.modal-body ul {
  margin-left: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.modal-body li {
  margin-bottom: var(--spacing-sm);
}

.modal-body strong {
  color: var(--text-light);
}

.modal-body kbd {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--text-muted);
  margin: 0 2px;
}

.modal-link {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--text-muted);
}

.modal-link a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.modal-link a:hover {
  color: var(--accent-pink);
  text-decoration: underline;
}

/* Responsive modal */
@media (max-width: 768px) {
  .modal-content {
    padding: var(--spacing-lg);
    max-height: 95vh;
  }
  
  .modal-title {
    font-size: 20px;
  }
  
  .top-buttons {
    gap: var(--spacing-sm);
  }
  
  .about-button,
  .github-button {
    font-size: 12px;
  }
}

