/* Workbench Styles */
.workbench-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 120px);
    min-height: 600px;
    padding: 20px;
}

/* Image Selection Panel */
.image-selection-panel {
    flex: 0 0 280px;
    background-color: #f5f7fa;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.image-selection-panel h2 {
    padding: 15px;
    margin: 0;
    background-color: #e0e5ec;
    font-size: 18px;
}

.filter-controls {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
}

.filter-group {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.filter-group label {
    margin-right: 10px;
    font-weight: 500;
    min-width: 90px;
}

.filter-group select {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    flex-grow: 1;
}

.image-list-container {
    flex-grow: 1;
    overflow-y: auto;
}

#image-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#image-list li {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

#image-list li:hover {
    background-color: #e9f0f7;
}

#image-list li.selected {
    background-color: #d4e5f7;
    border-left: 4px solid #4a89dc;
    padding-left: 11px;
    font-weight: 500;
}

#image-list li.loading {
    color: #999;
    font-style: italic;
    cursor: default;
}

/* Right Panels */
.right-panels {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    overflow-y: auto;
}

.main-content-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header within the main content panel */
.image-context-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.image-context-header.hidden {
    display: none;
}

.image-title-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.image-context-header h2 {
    margin: 0;
    font-size: 1.4em;
    color: #343a40;
}

.details-toggle-btn {
    padding: 5px 10px;
    font-size: 0.85em;
    background-color: #ced4da;
    color: #495057;
    border: 1px solid #adb5bd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.details-toggle-btn:hover {
    background-color: #adb5bd;
}

.yaml-main-controls {
    display: flex;
    gap: 10px;
}

.yaml-main-controls button {
    padding: 8px 15px;
    font-size: 0.9em;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.yaml-main-controls button:hover:not(:disabled) {
    background-color: #0056b3;
}

.yaml-main-controls button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Collapsible Details Area */
.image-details-collapsible {
    padding: 15px 20px;
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
    max-height: 300px;
    overflow-y: auto;
}

.image-details-collapsible.hidden {
    display: none;
}

/* Styles for image-metadata-list remain largely the same, */
/* but ensure they fit within the new collapsible container */
.image-metadata-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 15px;
    font-size: 0.9em;
}

.image-metadata-list dt {
    font-weight: 600;
    color: #444;
    grid-column: 1;
    text-align: right;
}

.image-metadata-list dd {
    grid-column: 2;
    color: #333;
    margin-left: 0;
    word-wrap: break-word;
}

.image-metadata-list dd a {
    color: var(--primary-color);
    text-decoration: none;
}

.image-metadata-list dd a:hover {
    text-decoration: underline;
}

/* Validation Result */
.validation-result {
    padding: 8px 20px;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.9em;
    flex-shrink: 0;
}

.validation-result.hidden {
    display: none;
}

.validation-success {
    color: #38a169;
}

.validation-error {
    color: #e53e3e;
}

/* YAML Editor Container */
.yaml-editor-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    margin-bottom: 20px;
}

.yaml-editor-container .no-selection-message {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    color: #6c757d;
    font-size: 1.1em;
    padding: 20px;
}

.yaml-editor {
    flex-grow: 1;
    overflow: auto;
    background-color: #272822;
    padding: 15px;
    color: #f8f8f2;
}

.yaml-editor.hidden {
    display: none;
}

.yaml-editor pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* Style for the editable YAML content area */
code.editable-yaml {
    outline: 1px dashed #ccc; /* Add a dashed outline when editable */
    background-color: #2b2c27; /* Slightly different background */
    cursor: text; /* Change cursor to text input */
}

/* Style for the button to update from editor */
.update-editor-btn {
    position: absolute; /* Position relative to yaml-editor-container */
    top: 5px;
    right: 10px;
    z-index: 5; /* Above editor but below suggestions potentially */
    padding: 4px 8px;
    font-size: 12px;
    background-color: #28a745; /* Green */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.update-editor-btn:hover {
    opacity: 1;
}

.update-editor-btn.hidden {
    display: none;
}

/* Customization Panel (Adjustments for new location) */
.customization-panel {
    padding: 20px;
    background-color: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    overflow-y: auto;
    margin-top: 20px;
    padding-top: 20px;
}

.customization-panel.hidden {
    display: none;
}

.customization-panel h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.3em;
    color: #343a40;
}

.customization-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    margin-bottom: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.control-group:first-child {
    padding-top: 0;
    border-top: none;
}

.control-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
}

.control-group input[type="checkbox"] {
    margin-right: 5px;
}

.tooltip {
    display: inline-block;
    cursor: help;
    color: #4a89dc;
    font-size: 16px;
    margin-left: 5px;
}

.package-control {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
    position: relative;
}

.package-control input {
    flex-grow: 1;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.package-control button,
#add-env-var-btn {
    padding: 6px 12px;
    background-color: #4a89dc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.selected-packages {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.package-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background-color: #e0e7ff;
    color: #4a5568;
    border-radius: 4px;
    font-size: 14px;
}

.package-tag .remove {
    margin-left: 5px;
    cursor: pointer;
    font-weight: bold;
    color: #4a5568;
    background: none;
    border: none;
    padding: 2px 5px;
    line-height: 1;
    font-size: 16px;
}

.package-tag .remove:hover {
    color: #dc3545;
}

.env-var-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.env-var-row input {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.env-key {
    flex: 0 0 30%;
}

.env-value {
    flex-grow: 1;
}

.remove-env-btn {
    background-color: #f56565;
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    cursor: pointer;
    font-size: 16px;
}

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

.actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

#apply-changes-btn {
    background-color: #4a89dc;
    color: white;
}

#reset-changes-btn {
    background-color: #e2e8f0;
    color: #4a5568;
}

#cancel-customize-btn {
    background-color: #6c757d;
    color: white;
}

/* Hide old elements we moved */
#image-details { display: none; }
#yaml-panel { display: none; }

/* Responsive adjustments might need tweaking */
@media (max-width: 992px) {
    .right-panels {
    }
    .image-context-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .yaml-main-controls {
        width: 100%;
        justify-content: space-around;
    }
}

@media (max-width: 768px) {
    .workbench-container {
        flex-direction: column;
        height: auto;
    }
    .image-selection-panel {
        flex: 0 0 auto;
        max-height: 35vh;
    }
    .right-panels {
        min-height: 60vh;
    }
}

/* Container for autocomplete suggestions */
.suggestions-container {
    position: absolute;
    background-color: white;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    width: calc(100% - 60px);
    left: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

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

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
}

.suggestion-item:hover,
.suggestion-item.active {
    background-color: #f0f0f0;
}

/* Styling for the Local Mode indicator */
.local-mode-active-badge {
    display: inline-block; /* Or block depending on desired layout */
    background-color: #fff3cd; /* Light yellow background */
    color: #856404; /* Dark yellow text */
    padding: 5px 10px;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 15px; /* Space below the badge */
    font-weight: bold;
}

.local-mode-active-badge.hidden {
    display: none;
}