/* styles.css */
:root {
    --brand-green: #007A33;    /* Bauernfeind-like green */
    --brand-orange: #EF600D;   /* Bauernfeind-like orange */
    --brand-dark: #1F2937;
    --brand-light: #F9FAFB;
    --border-color: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    background-color: var(--brand-light);
    color: var(--text-primary);
    line-height: 1.5;
    padding: 20px;
}

/* Main Layout Grid */
.configurator-wrapper {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    overflow: hidden;
    min-height: 800px;
}

@media (max-width: 900px) {
    .configurator-wrapper {
        grid-template-columns: 1fr;
    }
}

/* Config Panel (Left) */
.config-panel {
    background: #fdfdfd;
    padding: 25px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.brand-header h2 {
    color: var(--brand-green);
    font-size: 1.5rem;
    margin-bottom: 5px;
}
.brand-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.section-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.section-card h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--brand-dark);
    border-bottom: 2px solid var(--brand-green);
    display: inline-block;
    padding-bottom: 4px;
}

.form-group {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.form-group select,
.form-group input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(0, 122, 51, 0.1);
}

/* Add Connection Form */
.add-connection-form {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
}
.add-connection-form h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--brand-dark);
}

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

.form-row .form-group:first-child {
    grid-column: span 2;
}

.btn-primary {
    width: 100%;
    padding: 10px;
    background-color: var(--brand-orange);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.btn-primary:hover {
    background-color: #d6550b;
}

/* Connection List items */
.connection-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.connection-item {
    background: #f3f4f6;
    border-left: 4px solid var(--brand-orange);
    padding: 10px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
.connection-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.connection-item:hover {
    background-color: #e5e7eb;
}
.connection-item.dragging {
    background-color: #fed7aa;
    border-color: #ea580c;
}

.edit-panel {
    border-top: 1px dashed #d1d5db;
    margin-top: 10px;
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.edit-panel select, .edit-panel input {
    width: 100%;
    padding: 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
}
.btn-save-inline {
    background-color: var(--brand-green);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    align-self: flex-start;
}
.btn-save-inline:hover {
    background-color: #005c26;
}
.connection-item .info span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
}
.connection-item .info strong {
    color: var(--brand-dark);
}
.btn-edit {
    background: none;
    border: none;
    color: var(--brand-orange);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    margin-right: 5px;
}
.btn-edit:hover {
    background: #ffedd5;
}
.btn-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
}
.btn-delete:hover {
    background: #fecaca;
}

/* Preview Panel (Right) */
.preview-panel {
    background: #ffffff;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-controls {
    width: 100%;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
    font-size: 1.1rem;
    color: var(--brand-dark);
}

.preview-container {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    gap: 30px;
    flex-wrap: wrap;
}

.svg-wrapper {
    flex: 1;
    min-width: 400px;
    background: var(--brand-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* Arrow view spans full width */
.svg-wrapper-full {
    flex-basis: 100%;
    min-width: 100%;
    background: linear-gradient(135deg, #f0fdf4 0%, #f9fafb 50%, #eff6ff 100%);
    border: 2px solid var(--brand-green);
    box-shadow: 0 4px 12px rgba(0, 122, 51, 0.08), inset 0 2px 4px rgba(0,0,0,0.02);
}

.svg-wrapper-full svg {
    max-width: 500px;
}

.svg-wrapper h4 {
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

svg {
    width: 100%;
    max-width: 600px;
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.draggable-conn {
    cursor: grab;
    transition: filter 0.2s, stroke-width 0.2s;
}
.draggable-conn:hover {
    filter: brightness(1.2);
    stroke-width: 3;
}
.draggable-conn:active {
    cursor: grabbing;
}

/* Base pipe SVG styling */
.pipe-base {
    fill: var(--brand-green);
    stroke: #005c26;
    stroke-width: 2;
}

/* Connection SVG styling */
.pipe-conn {
    fill: var(--brand-orange);
    stroke: #cc5008;
    stroke-width: 2;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}
.action-buttons .btn-primary {
    width: 200px;
}
.btn-secondary {
    padding: 10px 15px;
    background-color: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

/* Interactive Hint */
.interactive-hint {
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--brand-orange);
    text-align: center;
    background: #fff3ed;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 500;
}

/* Modal */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}
.modal.hidden { display: none !important; }
.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-content h2 { margin-bottom: 20px; color: var(--brand-green); }
.close-modal {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
}
.close-modal:hover { color: #4b5563; }
.radio-group { flex-direction: row; gap: 20px; margin-bottom: 20px; }
.radio-group label { display: flex; align-items: center; gap: 5px; cursor: pointer; font-weight: normal; }
.hidden { display: none !important; }
