/* Resonance Tutorial Builder — Styles (v1.0.0)
 * Deliberately mirrors ktc-styles.css: same palette, spacing, radii,
 * type scale, and class-naming convention, so this reads as the same
 * product as the Continuum Builder rather than a bolted-on tool.
 */

.rtb-wrap {
    max-width: 1100px;
    margin: 40px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    color: #1a1a2e;
    box-sizing: border-box;
}
.rtb-wrap *, .rtb-wrap *::before, .rtb-wrap *::after {
    box-sizing: border-box;
    font-family: inherit !important;
}

/* ── Login notice ── */
.rtb-login-notice {
    text-align: center;
    padding: 40px 20px;
    background: #f6f6fa;
    border-radius: 10px;
}
.rtb-login-notice p { font-size: 16px; margin-bottom: 16px; }

/* ── Form shell ── */
.rtb-form {
    background: #f6f6fa;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
}
.rtb-form h2 { margin: 0 0 8px; font-size: 22px; }
.rtb-subtitle { margin: 0 0 16px; color: #555; font-size: 14px; }

.rtb-save-status {
    min-height: 24px;
    font-size: 14px;
    font-weight: 700;
    color: #6a6a80;
    margin-bottom: 12px;
}
.rtb-save-status.is-saved {
    color: #2f7a4f;
}
.rtb-save-status.is-error {
    color: #b3435a;
}

.rtb-url-panel:empty { display: none; }
.rtb-url-panel {
    font-size: 13px;
    margin-bottom: 12px;
}
.rtb-url-panel a {
    color: #1a1a2e;
    font-weight: 600;
    word-break: break-all;
}

.rtb-section-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6a6a80;
    margin: 22px 0 10px;
}

/* ── Field rows ── */
.rtb-field-row {
    display: grid;
    gap: 12px;
    margin-bottom: 10px;
}
.rtb-field-row.one-col { grid-template-columns: 1fr; }
.rtb-field-row.two-col { grid-template-columns: 1fr 1fr; }

.rtb-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #33334d;
}
.rtb-field input[type="text"],
.rtb-field select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d5d5e0;
    border-radius: 8px;
    background: #fff;
    min-height: 44px;
}

/* ── Editor: full width. Codes panel sits below it as a compact,
   wrapping strip of chips — sized to its own content, never a fixed
   column permanently narrowing the writing area. ── */
#rtb-editor {
    width: 100%;
    min-height: 420px;
}

/* TinyMCE wraps the textarea in its own chrome; keep it consistent with
   the rest of the form rather than default WP admin styling. */
.mce-tinymce {
    border: 1px solid #d5d5e0 !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.rtb-codes-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e2e2ec;
    border-radius: 10px;
    padding: 14px;
    max-height: 220px;
    overflow-y: auto;
}
.rtb-codes-empty {
    font-size: 13px;
    color: #6a6a80;
    margin: 0;
}

.rtb-code-level-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.rtb-code-level-name {
    font-weight: 700;
    font-size: 13px;
    color: #1a1a2e;
    white-space: nowrap;
}
.rtb-code-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rtb-code-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #f9f9fc;
    border: 1px solid #e8e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
    color: #1a1a2e;
    text-align: left;
    width: 100%;
}
.rtb-code-chip:hover {
    background: #e8e8f7;
}
.rtb-code-chip-name {
    font-weight: 600;
}
.rtb-code-chip-badge {
    background: #ffffff;
    border: 2px solid #1a1a2e;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Buttons ── */
.rtb-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.rtb-btn-save,
.rtb-btn-generate {
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    padding: 0 18px;
    background: #1a1a2e;
    color: #fff;
}

/* ── Field Schema builder ── */
.rtb-field-schema-row {
    display: grid;
    grid-template-columns: 1fr 140px 140px 32px;
    gap: 8px;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e2ec;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
}
.rtb-field-schema-row input,
.rtb-field-schema-row select {
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #d5d5e0;
    border-radius: 6px;
    background: #fff;
}
.rtb-btn-remove-row {
    border: none;
    background: #f9f9fc;
    color: #b3435a;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}
.rtb-btn-add-row {
    color: #1a1a2e;
    border: 1px solid #d5d5e0;
    background: #ffffff;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* ── Boolean builder ── */
.rtb-boolean-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 48px;
    background: #ffffff;
    border: 1px solid #e2e2ec;
    border-radius: 10px;
    padding: 10px 12px;
}
.rtb-boolean-empty {
    font-size: 13px;
    color: #6a6a80;
}
.rtb-boolean-token {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f9f9fc;
    border: 1px solid #e8e8f0;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: grab;
}
.rtb-boolean-token[data-kind="operand"],
.rtb-boolean-token[data-kind="continuum"] {
    background: #1a1a2e;
    color: #fff;
    border-color: #1a1a2e;
}
.rtb-boolean-token[data-kind="operator"] {
    background: #e8e8f7;
}
.rtb-boolean-token[data-kind="bracket"] {
    background: #fff;
    border: 2px solid #1a1a2e;
    font-weight: 900;
}
.rtb-boolean-token-remove {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
    padding: 0;
}
.rtb-boolean-token-remove:hover { opacity: 1; }

.rtb-boolean-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}
.rtb-btn-token {
    color: #1a1a2e;
    border: 1px solid #d5d5e0;
    background: #ffffff;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.rtb-btn-token:hover { background: #e8e8f7; }

#rtb-boolean-code-picker {
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #d5d5e0;
    border-radius: 8px;
    background: #fff;
    min-height: 38px;
}

.rtb-boolean-preview {
    margin-top: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    color: #33334d;
    min-height: 18px;
}

/* ── Tabs ── */
.rtb-tab-nav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e2e2ec;
    margin-bottom: 20px;
}
.rtb-tab-btn {
    border: none;
    background: transparent;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    color: #6a6a80;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.rtb-tab-btn.is-active {
    color: #1a1a2e;
    border-bottom-color: #1a1a2e;
}
.rtb-tab-panel { display: none; }
.rtb-tab-panel.is-active { display: block; }

/* ── Content tab ── */
.rtb-content-level-block {
    background: #ffffff;
    border: 1px solid #e2e2ec;
    border-radius: 10px;
    padding: 18px;
}
.rtb-content-level-fields {
    margin-bottom: 8px;
}
.rtb-content-code-block {
    border-top: 1px solid #f0f0f4;
    padding: 16px 0;
}
.rtb-content-code-block:first-of-type { border-top: none; padding-top: 0; }
.rtb-content-code-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.rtb-content-code-badge {
    background: #1a1a2e;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.rtb-content-code-name {
    font-weight: 700;
    font-size: 14px;
}
.rtb-content-field {
    margin-bottom: 12px;
}
.rtb-content-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #33334d;
}
.rtb-content-field-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #d5d5e0;
    border-radius: 6px;
}
.rtb-content-list-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    align-items: center;
}
.rtb-content-list-row .rtb-content-list-input {
    flex-grow: 1;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #d5d5e0;
    border-radius: 6px;
}
.rtb-content-field .rtb-btn-add-list-item {
    color: #1a1a2e;
    border: 1px solid #d5d5e0;
    background: #fff;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* ── Framework Builder — rebuilt: one field per row, one label each ── */
.rfb-form {
    background: #f6f6fa;
    border-radius: 12px;
    padding: 24px;
}
.rfb-form h2 { margin: 0 0 8px; font-size: 22px; }

.rfb-field {
    margin-bottom: 22px;
}
.rfb-field label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #33334d;
    margin-bottom: 6px;
}
.rfb-field input[type="text"],
.rfb-field textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d5d5e0;
    border-radius: 8px;
    background: #fff;
}
#rfb-continuum-select {
    width: 100%;
    padding: 6px;
    font-size: 14px;
    border: 1px solid #d5d5e0;
    border-radius: 8px;
    background: #fff;
}
#rfb-continuum-select option {
    padding: 6px 8px;
}

/* ── "Your Frameworks" / "Your Tutorial Entries" list ── */
.rtb-item-search {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #d5d5e0;
    border-radius: 8px;
    margin-bottom: 10px;
}
.rtb-item-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
}
.rtb-item-list-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}
.rtb-item-list-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    flex-grow: 1;
    text-align: left;
    background: #ffffff;
    border: 1px solid #e2e2ec;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
}
.rtb-item-list-main:hover { background: #f9f9fc; }
.rtb-item-list-row.is-active .rtb-item-list-main {
    border-color: #1a1a2e;
    background: #f0f0f7;
}
.rtb-item-list-title { font-weight: 700; font-size: 14px; color: #1a1a2e; }
.rtb-item-list-desc { font-size: 12px; color: #6a6a80; }
.rtb-item-list-author {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6a6a80;
    margin: 10px 0 2px;
}
.rtb-item-list-author:first-child { margin-top: 0; }
.rtb-item-list-delete {
    flex-shrink: 0;
    width: 36px;
    border: 1px solid #e2e2ec;
    background: #fff;
    border-radius: 8px;
    color: #b3435a;
    font-size: 16px;
    cursor: pointer;
}
.rtb-item-list-delete:hover { background: #fdf0f2; border-color: #b3435a; }

/* ── References ── */
.rtb-reference-list { display: flex; flex-direction: column; gap: 10px; }
.rtb-reference-row {
    background: #ffffff;
    border: 1px solid #e2e2ec;
    border-radius: 8px;
    padding: 12px 14px;
}
.rtb-reference-row-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.rtb-reference-row-header > span {
    font-weight: 900;
    font-size: 15px;
    color: #1a1a2e;
}
.rtb-reference-name {
    flex-grow: 1;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid #d5d5e0;
    border-radius: 6px;
}
.rtb-reference-body {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #d5d5e0;
    border-radius: 6px;
}
.rtb-reference-error {
    color: #b3435a;
    font-size: 12px;
    margin-top: 6px;
    min-height: 14px;
}
.rtb-reference-readonly {
    background: #f6f6fa;
}
.rtb-reference-readonly .rtb-reference-name,
.rtb-reference-readonly .rtb-reference-body {
    background: #f0f0f4;
    color: #6a6a80;
    cursor: not-allowed;
}

/* ── Learning Objectives ── */
.rtb-objective-set {
    background: #ffffff;
    border: 1px solid #e2e2ec;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.rtb-objective-set-title {
    font-weight: 900;
    font-size: 15px;
    color: #1a1a2e;
    margin-bottom: 10px;
}
.rtb-objective-set-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.rtb-concept-name-input {
    flex-grow: 1;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid #d5d5e0;
    border-radius: 6px;
}
.rtb-objective-entries { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.rtb-objective-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9f9fc;
    border: 1px solid #e8e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
}
.rtb-objective-entry-level {
    background: #1a1a2e;
    color: #fff;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}
.rtb-objective-entry-verb { font-weight: 700; flex-shrink: 0; }
.rtb-objective-entry-sentence { flex-grow: 1; color: #33334d; }

.rtb-objective-add-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.rtb-objective-level-select,
.rtb-objective-verb-select {
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #d5d5e0;
    border-radius: 6px;
}
.rtb-objective-sentence-input {
    flex-grow: 1;
    min-width: 200px;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #d5d5e0;
    border-radius: 6px;
}
.rtb-objective-sentence-input:disabled,
.rtb-objective-verb-select:disabled {
    background: #f0f0f4;
    cursor: not-allowed;
}

/* ── Mobile ── */
@media (max-width: 700px) {
    .rtb-form { padding: 16px; }
    .rtb-codes-panel { max-height: 260px; }
}

/* ── Public single-entry view ── */
.rtb-public-view {
    padding: 0 20px;
}
.rtb-public-entry {
    background: #ffffff;
    border: 2px solid #1a1a2e;
    border-radius: 10px;
    padding: 36px 40px;
}
.rtb-public-title {
    font-size: 2rem;
    font-weight: 900;
    color: #1a1a2e;
    margin: 0 0 8px;
}
.rtb-public-description {
    color: #6a6a80;
    font-size: 15px;
    margin: 0 0 24px;
}
.rtb-public-body {
    font-size: 16px;
    line-height: 1.6;
    color: #1a1a2e;
}
.rtb-public-body p { margin: 0 0 16px; }
