/* ============ Variables ============ */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #475569;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* ============ Reset & Base ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ============ Layout ============ */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.main-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    flex: 1;
    background: var(--border);
}

@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr;
    }
}

/* ============ Bereiche ============ */
.bereich {
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.bereich-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.bereich-header h2 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.bereich-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.bereich-content {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

/* ============ Buttons ============ */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-tertiary);
    color: var(--text);
}

.btn:hover {
    filter: brightness(1.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ============ Cards ============ */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 0.875rem;
    font-weight: 500;
}

.card-body {
    padding: 1rem;
}

/* ============ Action Bar ============ */
.action-bar {
    padding: 1rem;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* ============ Config Items ============ */
.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.config-item:last-child {
    margin-bottom: 0;
}

.config-item-info h4 {
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.config-item-info small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.config-item-actions {
    display: flex;
    gap: 0.5rem;
}

/* ============ Forms ============ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text);
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.code-input {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
}

/* ============ Log Output ============ */
.log-output {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    max-height: 350px;
    min-height: 100px;
    overflow-y: auto;
}

.log-entry {
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-entry.success {
    background: rgba(34, 197, 94, 0.2);
    border-left: 3px solid var(--success);
}

.log-entry.error {
    background: rgba(239, 68, 68, 0.2);
    border-left: 3px solid var(--danger);
}

.log-entry.info {
    background: rgba(59, 130, 246, 0.2);
    border-left: 3px solid var(--primary);
}

.empty-state {
    color: var(--text-secondary);
    text-align: center;
    padding: 1rem;
    font-size: 0.875rem;
}

/* ============ Modals ============ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 700px;
}

.modal-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    padding: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid var(--border);
}

/* ============ Test Result ============ */
.test-result {
    margin-top: 0.5rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    font-family: monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
}

.test-result.success {
    border-left: 3px solid var(--success);
}

.test-result.error {
    border-left: 3px solid var(--danger);
}

/* ============ Status Badges ============ */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-success { background: var(--success); }
.badge-warning { background: var(--warning); color: #000; }
.badge-danger { background: var(--danger); }
.badge-info { background: var(--primary); }

/* ============ Loading Overlay ============ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1rem;
    color: var(--text);
    font-size: 0.875rem;
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

/* ============ File Browser ============ */
.file-browser {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.file-browser-path {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-family: monospace;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-browser-list {
    list-style: none;
}

.file-browser-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.file-browser-item:hover {
    background: var(--bg-tertiary);
}

.file-browser-item.selected {
    background: var(--primary);
}

.file-browser-item:last-child {
    border-bottom: none;
}

.file-icon {
    font-size: 1rem;
}

/* ============ Checkbox Group ============ */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.checkbox-item input {
    width: auto;
    margin: 0;
}

.checkbox-item:has(input:checked) {
    background: var(--primary);
}

/* ============ Input with Button ============ */
.input-with-btn {
    display: flex;
    gap: 0.5rem;
}

.input-with-btn input {
    flex: 1;
}

/* ============ Utilities ============ */
.hidden {
    display: none !important;
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
