/**
 * 1. Theme Layout Utilities
 * Structural scaffolding for the interactive dynamic field workspace.
 */
 /* ==========================================================================
   Category Navigation Pills (Dynamic Variables)
   ========================================================================== */
.promptlibs-workspace-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .promptlibs-workspace-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

/**
 * 2. Form Input UI Controls (Sidebar Panel)
 * Styling hooks for the auto-generated variable fields.
 */
.promptlibs-fields-panel {
    background-color: var(--wp--preset--color--background);
    border: 1px solid var(--wp--preset--color--border);
    padding: 1.5rem;
    border-radius: 8px;
}

.promptlibs-field-group {
    margin-bottom: 1.25rem;
}

.promptlibs-field-group:last-child {
    margin-bottom: 0;
}

.promptlibs-field-label {
    display: block;
    font-size: var(--wp--preset--font-size--small);
    font-weight: 600;
    color: var(--wp--preset--color--text);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.promptlibs-field-input {
	width: 100%;
	padding: 0.625rem 0.875rem;
	font-size: var(--wp--preset--font-size--normal);	
	color: var(--wp--preset--color--text);
	background-color: hsl(215.3, 19.3%, 89.5%);
	border: 1px solid var(--wp--preset--color--black);
	border-radius: 6px;
	transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.promptlibs-field-input:focus {
    border-color: var(--wp--preset--color--primary);
    box-shadow: 0 0 0 3px rgba(74, 20, 140, 0.15);
    outline: none;
}

/**
 * 3. Compilation Live Preview Panel
 * Monospaced text box mirroring output changes in real time.
 */
.promptlibs-preview-panel {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	background-color: var(--wp--preset--color--cyan-bluish-gray);
	border: 1px solid var(--wp--preset--color--black);
	padding: 1.5rem;
	border-radius: 8px;
	position: relative;
	margin: 0;
}

.promptlibs-compiled-display {
    margin: 0;    
    font-size: var(--wp--preset--font-size--normal);
    color: var(--wp--preset--color--text);
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 120px;
    line-height: 1.5;
}

/**
 * 4. Interactive Action States & Buttons
 * Handles clipboard submission UI and confirmation states.
 */
.promptlibs-action-bar {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--wp--preset--color--border);
    padding-top: 1rem;
}

#promptlibs-copy-btn {
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
    cursor: pointer;
}

#promptlibs-copy-btn:active {
    transform: scale(0.98);
}

#promptlibs-copy-btn.copied {
    background-color: var(--wp--preset--color--accent) !important;
    color: #ffffff !important;
}

.no-fields-msg {
    color: var(--wp--preset--color--text-muted);
    font-style: italic;
    margin: 0;
}

.promptlibs-preset-actions button {
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background 0.15s ease-in-out;
}

.promptlibs-preset-actions button:hover {
    background: #2f855a !important;
}

/**
 * 5. Fluid Contenteditable Inline Tokens (Core Template Text Area)
 * Handles state switching visual feedback for bi-directional typing.
 */
.promptlibs-inline-token {
    font-weight: 700;
    border-bottom: 1px solid currentColor;
    padding: 0 4px;
    margin: 0 2px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.promptlibs-inline-token:hover {
    background-color: #ebf8ff;
    color: #1a4976;
}

/* Active focus state toggle while actively modifying inline inline elements */
.promptlibs-inline-token:focus {
    background-color: #feebc8;
    color: #c05621;
    border-bottom: 2px solid #dd6b20;
    outline: none;
    cursor: text;
}

/* Structural indicator placeholder rule for empty tokens */
.promptlibs-inline-token:empty::before {
    content: attr(placeholder);
    color: #a0aec0;
    font-weight: 400;
    font-style: italic;
}

/**
 * 6. Historical Presets Dashboard Table & Inline Editor Rows
 */
.promptlibs-table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #4a5568;
    font-weight: 700;
}

.promptlibs-table tbody tr {
    border-bottom: 1px solid #edf2f7;
    transition: background-color 0.1s ease;
}

.promptlibs-table tbody tr:hover {
    background-color: #f7fafc;
}

.promptlibs-clickable-title-cell {
    cursor: pointer;
    border-bottom: 1px dashed transparent;
}

.promptlibs-clickable-title-cell:hover {
    color: #3182ce;
    border-bottom-color: #3182ce;
}

/* Inside-table title editing field adjustments */
.promptlibs-editable-title-input {
    width: 95%;
    padding: 0.35rem 0.5rem;
    font-size: 0.95rem;    
    font-weight: 500;
    border: 1px solid #4299e1;
    border-radius: 4px;
    background-color: #ffffff;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

/* Miniature Dashboard Micro-Buttons */
.promptlibs-row-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    margin-left: 0.5rem;
    transition: all 0.1s ease-in-out;
    display: inline-flex;
    align-items: center;
}

.promptlibs-btn-load {
    background-color: #ebf8ff;
    color: #2b6cb0;
    border-color: #bee3f8;
}

.promptlibs-btn-load:hover {
    background-color: #2b6cb0;
    color: #ffffff;
}

.promptlibs-btn-copy {
    background-color: #e6fffa;
    color: #234e52;
    border-color: #b2f5ea;
}

.promptlibs-btn-copy:hover {
    background-color: #319795;
    color: #ffffff;
}

.promptlibs-btn-delete {
    background-color: #fff5f5;
    color: #9b2c2c;
    border-color: #fed7d7;
}

.promptlibs-btn-delete:hover {
    background-color: #e53e3e;
    color: #ffffff;
}
/**
 * 7. Fluid Inline Dropdown Select Dropdowns
 * Forces native browser select boxes to look like inline sentence modifiers.
 */
select.promptlibs-inline-token-select {
    background-color: #ebf8ff;
    color: #2b6cb0;
    font-weight: 700;    
    font-size: inherit;
    border: none;
    border-bottom: 2px dashed #63b3ed;
    padding: 0 4px;
    margin: 0 2px;
    cursor: pointer;
    display: inline-block;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none; /* Strips the jarring native downward arrow button block */
}

select.promptlibs-inline-token-select:hover {
    background-color: #bee3f8;
    color: #1a4976;
}

select.promptlibs-inline-token-select:focus {
    background-color: #feebc8;
    color: #c05621;
    border-bottom: 2px solid #dd6b20;
}

/**
 * 8. Flexible Repeater Layout Lists
 */
/* Ensure the list is flat and consistent */
ul.promptlibs-inline-repeater {
    list-style: none;
    padding: 0;
    margin: 0;
}

.promptlibs-inline-rule-item {
    display: block;
    margin-bottom: 0.25rem; /* Tighter vertical spacing */
}

/* Optional: Ensure the prefix is added via CSS or keep your JS injection */
.promptlibs-inline-rule-item::before {
    content: "CRITICAL RULE: ";
    font-weight: 700;
}

.promptlibs-repeater-placeholder {
    color: #a0aec0;
    font-size: 0.95rem;
    font-style: italic;
    font-weight: 400;
}

/* Sidebar Layout */
.promptlibs-field-group {
    margin-bottom: 1.25rem;
}

.promptlibs-repeater-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.promptlibs-select-full {
    width: 100%;
}

/* Base Buttons */
.promptlibs-delete-row-btn {
    padding: 0 0.625rem;
    background-color: #fed7d7;
    color: #9b2c2c;
    border: 1px solid #feb2b2;
    border-radius: 4px;
    cursor: pointer;
}

.promptlibs-row-btn {
    margin-top: 0.25rem;
    /* Add any other styling for your buttons here */
    cursor: pointer;
}

/* Template Workspace */
.promptlibs-template-workspace {
    line-height: 1.8;
    white-space: normal;
}
/* Ensure paragraph spacings inside the workspace look tight and professional */
.promptlibs-template-workspace p.wp-block-paragraph {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Repeater styling */
.promptlibs-inline-rule-list {
    margin: 0.5rem 0 0.5rem 1.5rem;
    padding: 0;
}

.promptlibs-repeater-placeholder {
    color: #a0aec0;
    font-style: italic;
}
/**
 * Updated Historical Presets Dashboard Styling
 */
.promptlibs-presets-dashboard {
    margin-top: 2rem;
    background-color: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.promptlibs-presets-dashboard h3 {
    margin-top: 0;
}

.promptlibs-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.promptlibs-table thead tr {
    border-bottom: 2px solid #e2e8f0;
}

.promptlibs-table th {
    padding: 0.75rem;
}

/* Ensure the layout is responsive */
@media (max-width: 600px) {
    .promptlibs-table thead { display: none; }
    .promptlibs-table, .promptlibs-table tbody, .promptlibs-table tr, .promptlibs-table td {
        display: block;
        width: 100%;
    }
    .promptlibs-table td { text-align: right; padding: 0.5rem !important; }
}
/* Container for the preset save area */
.promptlibs-preset-container {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--wp--preset--color--border);
}

/* Specific styling for the save button */
.promptlibs-save-btn {
    width: 100%;
    padding: 0.625rem;
    background-color: #38a169; /* Theme Green */
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease-in-out;
}

.promptlibs-save-btn:hover {
    background-color: #2f855a;
}

.promptlibs-escaped-sample {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    color: #d63384; /* Classic code-highlight pink/red */
}

.single-post .wp-block-group.promptlibs-presets-dashboard.is-layout-flow.wp-block-group-is-layout-flow,
.single-post .wp-block-group.promptlibs-fields-panel.is-layout-flow.wp-block-group-is-layout-flow {
  display: none;
}
body.single-tag-generated-example .is-layout-grid,
.single-post .wp-block-group.promptlibs-workspace-grid.is-layout-flow.wp-block-group-is-layout-flow {
  display: block;
}

/* wp-content/themes/prompts/style.css */

/* Format the live preview table layout block to look human-readable */
.promptlibs-live-compiler-preview {    
    line-height: 1.6;
}

/* Subtle styling to soften markdown structural characters */
.promptlibs-live-compiler-preview:contains('|') {
    color: #333;
}

.single-post main {
	max-width: 960px;
	margin: 0 auto;
}
