/* Main Container */
.promptpress-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    border: 1px solid #ccd0d4;
    padding: 16px;
    border-radius: 4px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.promptpress-loading,
.promptpress-error {
    text-align: center;
    padding: 40px;
    font-size: 1.2em;
    color: #555;
}

/* --- Orchestrator Area --- */
.orchestrator-area {
    border-bottom: 2px solid #007cba;
    padding-bottom: 16px;
}
.orchestrator-area h3, .final-step-area h3, .live-preview-container h4, .module-library-container h3, .assembly-area-container h3 {
    margin-top: 0;
    font-size: 1.4em;
    color: #1d2327;
}
.orchestrator-area p {
    margin-top: 0;
    color: #50575e;
}
#orchestrator-goal {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #8c8f94;
    margin-bottom: 12px;
}
#orchestrate-btn {
    width: 100%;
    padding: 12px;
    font-size: 1.2em;
}

/* --- Builder Layout --- */
.promptpress-builder {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

/* Module Library */
.module-library-container {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
}
.module-library-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.module-library-controls #module-search {
    width: 100%;
    flex-grow: 1;
}

.module-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 4px;
}

.module-item {
    padding: 10px;
    background: #f0f0f1;
    border: 1px solid #dcdcde;
    border-radius: 3px;
    margin-bottom: 8px;
    cursor: grab;
    transition: box-shadow 0.2s ease-in-out;
}
.module-item:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-color: #949494;
}
.module-item:active {
    cursor: grabbing;
    background: #e9e9e9;
}
.module-item strong { display: block; margin-bottom: 4px; }
.module-item p { font-size: 0.9em; color: #666; margin: 0; }

/* Dragging class */
.dragging {
    opacity: 0.5;
    background: #d6eaff;
}


/* Assembly Area */
.assembly-area-container { flex: 2; min-width: 300px; }
.assembly-header { display: flex; justify-content: space-between; align-items: center; }
.assembly-area {
    border: 2px dashed #ccc;
    border-radius: 4px;
    min-height: 200px;
    padding: 12px;
    background: #fafafa;
    transition: all 0.2s ease;
}
.assembly-area.drag-over { border-color: #2271b1; background-color: #f0f5fa; }
.assembly-placeholder { color: #999; text-align: center; padding-top: 80px; pointer-events: none; }
.assembled-module {
    background: #e0eaf4; padding: 8px 12px; border-radius: 4px;
    margin-bottom: 8px; border: 1px solid #b8cde4; display: flex;
    justify-content: space-between; align-items: center; cursor: move;
}
.assembled-module.custom-module {
    background-color: #fef7e8;
    border-color: #f0c363;
}
.assembled-module span {
    flex-grow: 1;
}
.remove-module-btn {
    background: none; border: none; color: #900;
    font-size: 1.5em; cursor: pointer; line-height: 1; padding: 0 4px;
}

/* Live Preview Area */
.live-preview-container {
    margin-top: 16px;
}
.live-preview-container h4 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    color: #444;
}
#live-preview-area {
    background: #23282d;
    color: #f0f0f1;
    border: 1px solid #444;
    padding: 12px;
    min-height: 100px;
    white-space: pre-wrap;
    word-wrap: break-word;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
    max-height: 250px;
    overflow: auto;
}


/* Final Step Area */
.final-step-area { border-top: 2px solid #007cba; padding-top: 16px; }
.input-area textarea {
    width: 100%; box-sizing: border-box; padding: 8px;
    border-radius: 3px; border: 1px solid #8c8f94;
}
.input-area label { display: block; font-weight: bold; margin-bottom: 6px; }

/* Execution Area */
.execution-area {
    margin-top: 16px;
}

.promptpress-button, .promptpress-button-secondary, .promptpress-button-tertiary {
    border: 1px solid #2271b1;
    padding: 10px 20px;
    font-size: 1.1em;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.promptpress-button { background: #2271b1; color: #fff; }
.promptpress-button-secondary { background: #f6f7f7; color: #2271b1; }
.promptpress-button-tertiary {
    background: transparent;
    color: #900;
    border: 1px solid #ccc;
    padding: 4px 8px;
    font-size: 0.9em;
}
.promptpress-button:disabled { background: #999; border-color: #999; cursor: not-allowed; }
.promptpress-button:hover:not(:disabled) { background: #1d6199; }
.promptpress-button-secondary:hover:not(:disabled) { background: #e5e5e6; border-color: #a7a7a7; }
.promptpress-button-tertiary:hover:not(:disabled) { background: #fbeaea; border-color: #900; }

.output-container { margin-top: 16px; }
#output-area {
    background: #f6f7f7; border: 1px solid #ddd; padding: 12px;
    min-height: 100px; white-space: pre-wrap; word-wrap: break-word;
    border-radius: 3px; color: #3c434a;
}

.prompt-sent-details {
    margin-top: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    background-color: #fafafa;
}
.prompt-sent-details summary {
    cursor: pointer;
    padding: 8px 12px;
    font-weight: bold;
    color: #50575e;
}
.prompt-sent-details summary:hover { background-color: #e9e9e9; }
#prompt-sent-area {
    padding: 12px; background: #fff; border-top: 1px solid #e0e0e0;
    white-space: pre-wrap; word-wrap: break-word; color: #444;
    max-height: 300px; overflow-y: auto;
}