/**
 * Prompt Hub — Editor Styles
 * Double-layer highlight technique: textarea (transparent text) + overlay div (highlighted).
 */

.prompt-hub-editor-container {
    position: relative;
    width: 100%;
    min-height: 200px;
}

.prompt-hub-editor-highlight,
.prompt-hub-editor {
    width: 100%;
    min-height: 200px;
    padding: 0.75rem 1rem;
    margin: 0;
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius-sm);
    font-family: "Courier New", Courier, monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

.prompt-hub-editor-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background-color: var(--ph-bg);
    color: var(--ph-text);
    overflow: hidden;
    z-index: 1;
}

.prompt-hub-editor-highlight .prompt-variable {
    background-color: var(--ph-variable-bg);
    color: var(--ph-variable-text);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--ph-variable-border);
}

.prompt-hub-editor {
    position: relative;
    z-index: 2;
    background-color: transparent;
    color: transparent;
    caret-color: var(--ph-text);
    resize: vertical;
    border-color: var(--ph-border);
}

.prompt-hub-editor:focus {
    outline: none;
    border-color: var(--ph-primary);
    box-shadow: 0 0 0 3px rgba(0, 148, 108, 0.1);
}

/* Live preview header + badge */
.prompt-hub-live-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.prompt-hub-live-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ph-text);
}

.prompt-hub-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.5rem;
    background-color: var(--ph-primary);
    color: #ffffff;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.prompt-hub-var-id {
    font-family: "Courier New", Courier, monospace;
    font-size: 0.8em;
    font-weight: 400;
    background-color: #e5e7eb;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    color: var(--ph-text-light);
    margin-left: 0.5rem;
}

/* Select inside highlight overlay should not be visible */
.prompt-hub-editor-highlight::selection {
    background-color: transparent;
}

.prompt-hub-editor::selection {
    background-color: rgba(0, 148, 108, 0.2);
    color: transparent;
}

/* Live preview fields section */
#prompt_hub_live_fields {
    padding: 1rem 1.25rem;
    border: 1px dashed var(--ph-border);
    border-radius: var(--ph-radius-sm);
    background-color: var(--ph-bg-alt);
}

#prompt_hub_live_fields .prompt-hub-label {
    margin-bottom: 0.25rem;
}

.prompt-hub-live-field {
    margin-bottom: 1rem;
}

.prompt-hub-live-field:last-child {
    margin-bottom: 0;
}

.prompt-hub-live-field .prompt-hub-input {
    min-height: 50px;
    resize: vertical;
}
