/* Custom CodeMirror styling for template editor */

.CodeMirror {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  height: auto;
  min-height: 400px;
  background: #ffffff;
}

.CodeMirror:focus-within {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
  outline: none;
}

.CodeMirror-gutters {
  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
}

.CodeMirror-linenumber {
  color: #9ca3af;
  padding: 0 8px;
}

.CodeMirror-cursor {
  border-left: 2px solid #8b5cf6;
}

.CodeMirror-selected {
  background: rgba(139, 92, 246, 0.1);
}

.CodeMirror-focused .CodeMirror-selected {
  background: rgba(139, 92, 246, 0.2);
}

/* ERB syntax highlighting */
.CodeMirror .cm-erb {
  color: #dc2626;
  font-weight: bold;
}

.CodeMirror .cm-erb-tag {
  color: #059669;
  font-weight: bold;
}

.CodeMirror .cm-erb-variable {
  color: #7c3aed;
  font-weight: bold;
}

/* HTML syntax highlighting */
.CodeMirror .cm-tag {
  color: #dc2626;
}

.CodeMirror .cm-attribute {
  color: #059669;
}

.CodeMirror .cm-string {
  color: #0369a1;
}

.CodeMirror .cm-comment {
  color: #6b7280;
  font-style: italic;
}

/* Full screen mode */
.CodeMirror-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100vh;
  z-index: 9999;
  background: white;
}

.CodeMirror-fullscreen .CodeMirror {
  height: 100vh;
  border: none;
  border-radius: 0;
}

/* Keyboard shortcut styling */
kbd {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  color: #374151;
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1;
  padding: 0.125rem 0.25rem;
  white-space: nowrap;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .CodeMirror {
    font-size: 12px;
    min-height: 300px;
  }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
  .CodeMirror {
    background: #1f2937;
    color: #f9fafb;
    border-color: #374151;
  }
  
  .CodeMirror-gutters {
    background: #111827;
    border-right-color: #374151;
  }
  
  .CodeMirror-linenumber {
    color: #6b7280;
  }
}
