/* BPU Pro - Modern, minimal styling */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #059669;
  --error-color: #dc2626;
  --warning-color: #d97706;
  --info-color: #0ea5e9;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;
  --info-text: #0c4a6e;
  
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', monospace;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  font-size: 14px;
}

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-sm);
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 400;
}

/* Main layout */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 0;
  min-height: calc(100vh - 140px);
}

/* Editor panel */
.editor-panel {
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.editor-header {
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.editor-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.sample-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.sample-select:hover {
  border-color: var(--border-hover);
}

.sample-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.editor {
  flex: 1;
  min-height: 500px;
}

/* CodeMirror 6 editor styling */
.cm-editor {
  height: 100%;
  font-family: var(--font-mono);
}

.cm-scroller {
  overflow: auto;
}

.cm-content {
  min-height: 100%;
}

.cm-focused {
  outline: none;
}

/* YAML error styling */
.yaml-error {
  border-color: var(--error-color) !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

/* Control panel */
.control-panel {
  background: var(--bg-primary);
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.actions h3,
.info h3,
.structure h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  justify-content: center;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  width: 100%;
  font-size: 1rem;
  padding: 1rem 1.5rem;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.btn-icon {
  font-size: 1.125rem;
}

/* Download section */
.download-container {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.download-container.hidden {
  display: none;
}

.download-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.download-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--success-color);
  text-decoration: none;
  font-weight: 500;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.download-link:hover {
  background: rgba(5, 150, 105, 0.1);
  border-color: var(--success-color);
}

.download-icon {
  font-size: 1.125rem;
}

.download-note {
  padding: 0.75rem;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-sm);
  color: var(--info-text);
}

.download-note small {
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Info sections */
.info-content p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.structure-content {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow-x: auto;
}

.structure-content pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.structure-content code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* Error handling */
.error-container {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 1rem;
}

.error-container.hidden {
  display: none;
}

.error-container h3 {
  color: var(--error-color);
  margin-bottom: 0.75rem;
}

.error-message {
  color: var(--error-color);
  font-size: 0.875rem;
  line-height: 1.5;
  font-family: var(--font-mono);
  background: white;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
  white-space: pre-wrap;
}

/* Footer */
.footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 1rem 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer a {
  color: var(--primary-color);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Responsive design */
@media (max-width: 1024px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  
  .control-panel {
    max-height: 50vh;
    overflow-y: auto;
  }
  
  .editor {
    min-height: 400px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 1rem;
  }
  
  .header h1 {
    font-size: 1.5rem;
  }
  
  .subtitle {
    font-size: 0.875rem;
  }
  
  .main {
    min-height: calc(100vh - 120px);
  }
  
  .editor-header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .editor-controls {
    justify-content: space-between;
  }
  
  .control-panel {
    padding: 1rem;
    gap: 1.5rem;
  }
  
  .footer {
    padding: 0.75rem 1rem;
  }
}

/* Monaco Editor customizations */
.monaco-editor {
  border-radius: 0 !important;
}

.monaco-editor .margin {
  background-color: var(--bg-tertiary) !important;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* YAML download button styling */
#download-yaml-btn {
  margin-top: 0.75rem;
  width: 100%;
}

/* Loading state */
.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
