/* === Global Styles === */
body {
    font-family: 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    margin: 0;
    padding: 0;
    color: #1f2937;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* === Header === */
.header {
    background: linear-gradient(135deg, #0a2540 0%, #2563eb 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.header p {
    margin: 5px 0 0 0;
    opacity: 0.9;
}

.nav-back {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-back:hover {
    background: rgba(255,255,255,0.3);
    color: white;
}
.phase-badge {
  background: #2563eb;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 4px 4px;  /* Gleiche Höhe, aber weniger horizontaler Platz */
  border-radius: 10px;
  margin-left: 6px;
  display: inline-block;
  min-width: auto;
}
/* === Layout === */
.main-content {
    display: flex;
    height: 80vh;
}

.input-section,
.output-section {
    flex: 1;
    min-width: 0; 
}

.sidebar {
    width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #d1d5db;
    padding: 20px;
    overflow-y: auto;
}

.sidebar h3 {
    margin: 0 0 15px 0;
    color: #0a2540;
    font-weight: 600;
}

.agent-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.agent-item {
    background: white;
    margin-bottom: 8px;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    cursor: pointer;
    transition: all 0.2s;
}

.agent-item:hover {
    background: #e0e7ff;
    border-color: #2563eb;
}

.agent-item.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.agent-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.agent-trigger {
    font-size: 12px;
    color: #6b7280;
    font-family: monospace;
}

.agent-item.active .agent-trigger {
    color: #c7d2fe;
}

.agent-count {
    background: #e0e7ff;
    color: #1e3a8a;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 12px;
    font-weight: 500;
}

.view-toggle {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.toggle-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.toggle-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.toggle-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.toggle-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* === Editor Area === */
.editor-area {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #d1d5db;
}

.editor-title {
    font-size: 18px;
    font-weight: 600;
    color: #0a2540;
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* === Editor mit Zeilennummern === */
.editor-wrapper {
    flex: 1;
    position: relative;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    background: #1e1e1e;
}

.line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    background: #2a2a2a;
    color: #6b7280;
    padding: 15px 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    text-align: right;
    border-right: 1px solid #404040;
    user-select: none;
    overflow: hidden;
    z-index: 1;
}

.yaml-editor {
    width: 100%;
    height: 100%;
    min-height: 400px;
    padding: 15px 15px 15px 60px;
    border: none;
    background: #1e1e1e;
    color: #e5e7eb;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    resize: none;
    outline: none;
    white-space: pre;
    overflow-wrap: normal;
}

.yaml-editor::-webkit-scrollbar {
    width: 8px;
}

.yaml-editor::-webkit-scrollbar-track {
    background: #2a2a2a;
}

.yaml-editor::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

/* === Status Bar === */
.status {
    background: #e0e7ff;
    border: 1px solid #c7d2fe;
    color: #1e3a8a;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.status-bar {
    background: #f8f9fa;
    padding: 10px 20px;
    border-top: 1px solid #d1d5db;
    font-size: 12px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-message {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-success {
    color: #059669;
}

.status-error {
    color: #dc2626;
}

.status-info {
    color: #2563eb;
}

/* === GMP Compliance Box === */
.gmp-compliance {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.gmp-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #0a2540;
}

.gmp-indicators {
    display: grid;
    gap: 8px;
}

.gmp-indicator span:first-child {
    font-weight: 500;
    margin-right: 5px;
}

/* === Forms === */
label {
    font-size: 14px;
    font-weight: 500;
    margin-top: 15px;
    margin-bottom: 5px;
    display: block;
    color: #374151;
}

select,
textarea {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-bottom: 15px;
    resize: vertical;
}

textarea {
    min-height: 120px;
}

/* === Buttons === */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: #059669;
    color: white;
}

.btn-success:hover {
    background: #047857;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.primary-button {
    background: #2563eb; 
    color: #fff;
    font-weight: 600;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    min-width: 260px; 
    text-align: center;
    margin-left: 20px;   /* <-- Einrücken von links */
}


.primary-button:hover {
    background: #1d4ed8;
}

.clear-button {
    background: #6b7280;
    color: #fff;
    font-weight: 500;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.clear-button:hover {
    background: #4b5563;
}

.action-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 6px 12px;
    margin: 0 5px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.action-btn:hover {
    background: #1d4ed8;
}

/* === Badges === */
.oee-badge {
    background: #059669;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
}

.a2a-badge {
    background: #f59e0b;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

/* === Loading Spinner === */
.loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #d1d5db;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #2563eb;  
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
}

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

/* === Claude Response Box === */
.claude-response-box {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
    max-height: 200px;      /* prevents overflow */
    overflow-y: auto;       /* scroll instead of resizing layout */
    word-wrap: break-word;
    font-size: 14px;
    color: #111827;
    white-space: pre-wrap;  /* keeps line breaks */
}

.claude-response-box.enhanced {
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0;
    max-height: none;
    overflow: visible;
    white-space: normal; /* Override the pre-wrap from original */
}

/* === Output Log === */
.output-section pre {
    background: #111827;
    color: #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.4;
    height: 350px;          /* fixed height */
    overflow-y: auto;
}

/* === Metrics Section === */
.metrics {
    margin-top: 12px;
    padding: 10px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
}

/* === Links === */
a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    text-decoration: underline;
}

/* === Enhanced Response Formatting === */

/* Response Header */
.response-header {
    background: #0a2540; 
    padding: 12px 15px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.response-header strong {
    color: #000;  /* Titel schwarz */
}

.response-meta {
    font-size: 12px;
    opacity: 0.8;
    color: #fff;  /* Meta-Infos weiß */
}

/* Response Content */
.response-content {
    background: #ffffff;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    border-left: 1px solid #d1d5db;
    border-right: 1px solid #d1d5db;
}

.formatted-response {
    line-height: 1.6;
    font-family: 'Segoe UI', Roboto, sans-serif;
    color: #1f2937;
    white-space: pre-wrap;
}

.formatted-response h3 {
    color: #0a2540;
    margin: 15px 0 10px 0;
    font-size: 16px;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 5px;
    font-weight: 600;
}

.formatted-response h4 {
    color: #374151;
    margin: 12px 0 8px 0;
    font-size: 14px;
    font-weight: 500;
}

/* Status Colors */
.formatted-response .status-created {
    color: #dc2626;
    font-weight: 600;
}

.formatted-response .status-released {
    color: #059669;
    font-weight: 600;
}

.formatted-response .status-closed {
    color: #6b7280;
    font-weight: 600;
}

/* Alert Boxes */
.formatted-response .highlight {
    background: #fef3c7;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #f59e0b;
    margin: 10px 0;
}

.formatted-response .alert {
    background: #fee2e2;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #dc2626;
    margin: 10px 0;
}

.formatted-response .success {
    background: #d1fae5;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #059669;
    margin: 10px 0;
}

/* Response Actions */
.response-actions {
    padding: 12px 15px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 8px 8px;
    text-align: right;
}

/* === Event Monitor === */
.event-monitor-container {
    margin-top: 15px;
    background: #1e1e1e;
    color: #f1f1f1;
    border-radius: 6px;
    padding: 10px;
    height: 200px;
    overflow-y: auto;
    font-size: 13px;
}

.event-monitor {
    background: #1e1e1e;
    color: #f1f1f1;
    border-radius: 6px;
    padding: 10px;
    height: 200px;
    overflow-y: auto;
    font-size: 13px;
    margin: 0;
}

.event-line {
    padding: 2px 0;
    font-family: monospace;
}

.event-received { color: #4caf50; }
.event-published { color: #2196f3; }
.event-agent-action { color: #ff9800; }
.event-error { color: #f44336; }

/* === Dashboard-specific Styles === */
.formatted-response { 
    white-space: pre-wrap; 
    font-family: monospace; 
    background: #f8f9fa; 
    border: 1px solid #ddd; 
    padding: 10px; 
    border-radius: 6px; 
    margin-top: 5px; 
    line-height: 1.4; 
}

.response-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: #eef2f6; 
    padding: 5px 10px; 
    border-bottom: 1px solid #ccc; 
}

.response-actions { 
    margin-top: 8px; 
}

.response-actions .action-btn { 
    margin-right: 5px; 
    padding: 3px 8px; 
    font-size: 12px; 
    cursor: pointer; 
}

.version-info { 
    font-size: 11px; 
    color: #666; 
    margin-top: 10px; 
    padding: 5px; 
    background: #f8f9fa; 
    border-radius: 4px; 
    border: 1px solid #ddd; 
}

/* === Health Indicator === */
.health-indicator { 
    position: absolute; 
    top: 15px; 
    right: 20px; 
    display: flex; 
    align-items: center; 
    font-size: 12px; 
    background: white; 
    color: #333; /* ← Diese Zeile hinzufügen */
    padding: 5px 10px; 
    border-radius: 15px; 
    border: 1px solid #ddd; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.health-dot { 
    width: 12px; 
    height: 12px; 
    border-radius: 50%; 
    margin-right: 5px; 
    font-size: 12px; 
    text-align: center; 
    line-height: 12px; 
}

.health-green { color: #28a745; }
.health-yellow { color: #ffc107; }
.health-red { color: #dc3545; }
.health-gray { color: #6c757d; }

/* === Navigation Styles === */
.nav-menu { 
    background: #f8f9fa; 
    padding: 10px; 
    margin-bottom: 20px; 
    border-radius: 6px; 
    border: 1px solid #ddd; 
}

.nav-menu h3 { 
    margin: 0 0 10px 0; 
    color: #333; 
    font-size: 14px; 
}

.nav-links { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
}

.nav-link { 
    background: #007bff; 
    color: white; 
    padding: 6px 12px; 
    text-decoration: none; 
    border-radius: 4px; 
    font-size: 12px; 
    transition: background-color 0.2s; 
}

.nav-link:hover { 
    background: #0056b3; 
    color: white; 
}

.nav-link.oee { 
    background: #28a745; 
}

.nav-link.oee:hover { 
    background: #1e7e34; 
}

.nav-link.editor { 
    background: #6f42c1; 
}

.nav-link.editor:hover { 
    background: #5a32a3; 
}

.CodeMirror {
  height: 600px;   /* Höhe z. B. 600px */
  font-size: 14px; /* optional: Schriftgröße etwas größer */
}
