/* ============================================
   Knowledge Taxonomy Continuum — Plugin Styles
   ============================================ */

/* ── Form ── */
.ktc-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    max-width: 820px;
    margin: 0 auto;
}

.ktc-form {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 28px 32px;
    margin-bottom: 36px;
}

.ktc-form h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    color: #1a1a1a;
}

.ktc-form .ktc-subtitle {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 24px;
}

.ktc-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888;
    margin: 20px 0 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
}

.ktc-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

.ktc-field-row.two-col {
    grid-template-columns: 1fr 1fr;
}

.ktc-field-row.one-col {
    grid-template-columns: 1fr;
}

.ktc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ktc-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
}

.ktc-field input[type="text"],
.ktc-field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.875rem;
    color: #222;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.ktc-field input[type="text"]:focus,
.ktc-field textarea:focus {
    outline: none;
    border-color: #5b7fa6;
    box-shadow: 0 0 0 2px rgba(91,127,166,0.15);
}

.ktc-field textarea {
    resize: vertical;
    min-height: 72px;
}

.ktc-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.ktc-btn-generate {
    background: #1a1a2e;
    color: #fff;
    border: none;
    padding: 11px 28px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.15s;
}

.ktc-btn-generate:hover {
    background: #2e2e4e;
}

.ktc-btn-download {
    background: #fff;
    color: #1a1a2e;
    border: 2px solid #1a1a2e;
    padding: 9px 22px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: none;
    transition: all 0.15s;
}

.ktc-btn-download:hover {
    background: #1a1a2e;
    color: #fff;
}

.ktc-btn-download.visible {
    display: inline-block;
}

/* ── Visual Output ── */
#ktc-output {
    display: none;
}

#ktc-output.visible {
    display: block;
}

.ktc-diagram {
    background: #ffffff;
    border: 2px solid #1a1a2e;
    border-radius: 10px;
    padding: 36px 40px 28px;
    font-family: "Segoe UI", sans-serif;
}

/* Title */
.ktc-diagram-title {
    text-align: center;
    font-size: 2.8rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
    color: #1a1a2e;
    margin-bottom: 32px;
    line-height: 1;
    font-family: "Segoe UI Black", "Arial Black", sans-serif;
}

/* Continuum rows */
.ktc-continuum-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 6px;
    gap: 0;
}

/* Vertical axis label */
.ktc-axis-label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1a1a2e;
    min-width: 22px;
    text-align: center;
    padding: 0 2px;
    flex-shrink: 0;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 120px;
}

.ktc-axis-label.left {
    margin-right: 6px;
}

.ktc-axis-label.right {
    margin-left: 6px;
}

/* The horizontal continuum track */
.ktc-track {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ktc-boxes {
    display: flex;
    align-items: stretch;
    gap: 0;
}

/* Connector lines between boxes */
.ktc-boxes-inner {
    display: flex;
    align-items: center;
    width: 100%;
}

.ktc-connector {
    flex: 1;
    height: 2px;
    background: #1a1a2e;
    position: relative;
}

.ktc-connector::before,
.ktc-connector::after {
    content: '';
    position: absolute;
    top: -4px;
    width: 2px;
    height: 10px;
    background: #1a1a2e;
}

.ktc-connector::before { left: 0; }
.ktc-connector::after  { right: 0; }

/* Point boxes — fixed size */
.ktc-point {
    border: 2.5px solid #1a1a2e;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.1;
    width: 180px;
    height: 120px;
    min-width: 180px;
    max-width: 180px;
    min-height: 120px;
    max-height: 120px;
    flex-shrink: 0;
    flex-grow: 0;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-word;
    hyphens: none;
}

/* Active / inactive states */
.ktc-point.is-active {
}

.ktc-point.is-inactive {
    opacity: 1;
}

/* Sub-row: badge input + Active checkbox stacked under each point field */
.ktc-sub-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.ktc-check-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
}

.ktc-check-label input[type="checkbox"] {
    accent-color: #1a1a2e;
    cursor: pointer;
    margin: 0;
}

/* Color scheme — global fallbacks */
.ktc-point.pos-left  { background: #fae8cc; border-color: #e8c49a; color: #000000; }
.ktc-point.pos-mid   { background: #d4e6f5; border-color: #a0c4e8; color: #000000; }
.ktc-point.pos-right { background: #d8dde6; border-color: #aab0bc; color: #000000; }

/* Row 1: warm peach spectrum left to right */
.ktc-continuum-row.row-1 .ktc-point.pos-left  { background: #fae8cc; border-color: #e8c49a; color: #000000; }
.ktc-continuum-row.row-1 .ktc-point.pos-mid   { background: #f0c88a; border-color: #d4a050; color: #000000; }
.ktc-continuum-row.row-1 .ktc-point.pos-right { background: #e8a96a; border-color: #c07830; color: #000000; }

/* Row 2: cool blue spectrum left to right */
.ktc-continuum-row.row-2 .ktc-point.pos-left  { background: #d4e6f5; border-color: #a0c4e8; color: #000000; }
.ktc-continuum-row.row-2 .ktc-point.pos-mid   { background: #a8cfe8; border-color: #6aaad4; color: #000000; }
.ktc-continuum-row.row-2 .ktc-point.pos-right { background: #7aafd4; border-color: #4a8ab5; color: #000000; }

/* Row 3: slate blue-grey spectrum left to right */
.ktc-continuum-row.row-3 .ktc-point.pos-left  { background: #d8dde6; border-color: #aab0bc; color: #000000; }
.ktc-continuum-row.row-3 .ktc-point.pos-mid   { background: #b0bac8; border-color: #8a96a8; color: #000000; }
.ktc-continuum-row.row-3 .ktc-point.pos-right { background: #8a9db5; border-color: #6a7a94; color: #000000; }

/* Active state: black background, white text — all rows */
.ktc-continuum-row .ktc-point.is-active { background: #1a1a2e !important; border-color: #1a1a2e !important; color: #ffffff !important; }

/* Continuum name label below the track */
.ktc-track-label {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    color: #1a1a2e;
    margin-top: 8px;
}

/* Row spacer between continuums */
.ktc-row-gap {
    height: 24px;
}

/* Description block */
.ktc-description-block {
    background: #1a1a2e;
    color: #ffffff;
    border-radius: 8px;
    padding: 20px 22px;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.55;
    text-align: center;
    margin-top: 28px;
}

/* Copyright bar */
.ktc-copyright {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-top: 18px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .ktc-field-row {
        grid-template-columns: 1fr;
    }
    .ktc-field-row.two-col {
        grid-template-columns: 1fr;
    }
    .ktc-point {
        width: 100px;
        height: 80px;
        min-width: 100px;
        max-width: 100px;
        min-height: 80px;
        max-height: 80px;
        font-size: 0.9rem;
        padding: 0;
    }
    .ktc-badge {
        width: 16px;
        height: 16px;
        top: 4px;
        right: 4px;
        font-size: 0.5rem;
    }
    .ktc-diagram-title {
        font-size: 1.3rem;
    }
    .ktc-form {
        padding: 20px 16px;
    }
}

/* Badge circle — fully inside box, html2canvas-safe */
.ktc-point {
    position: relative;
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

.ktc-point-text {
    display: block;
    text-align: center;
    word-break: break-word;
    hyphens: none;
    line-height: 1.2;
    width: 100%;
}

.ktc-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
    color: #1a1a2e;
    pointer-events: none;
    z-index: 1;
}

.ktc-point.is-active .ktc-badge {
    border-color: #ffffff;
    color: #1a1a2e;
}

/* Badge form input — more specific selector to beat .ktc-field input[type="text"] */
.ktc-field input[type="text"].ktc-badge-input {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    padding: 4px 0;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    flex-shrink: 0;
}
