/* ------------------------------------------------------------------ */
/* Toevoeging afstand – frontend                                        */
/* ------------------------------------------------------------------ */

.mest-afstand-wrapper {
    margin: 20px 0 24px;
    color: #1e1e1e;
}

/* Sectie (1, 2) */
.mest-afstand-section {
    margin-bottom: 28px;
}

.mest-afstand-section + .mest-afstand-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 24px;
}

.mest-afstand-section-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.mest-afstand-section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1f2937;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
}

.mest-afstand-section-titles {
    padding-top: 4px;
}

.mest-afstand-section-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}

.mest-afstand-section-subtitle {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

/* Kaarten-grid */
.mest-afstand-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 1200px) {
    .mest-afstand-cards {
        grid-template-columns: 1fr;
    }
}

/* Kaart zelf is het label, klikbaar */
.mest-afstand-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 18px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    margin: 0;
}

.mest-afstand-card:hover {
    border-color: #9ca3af;
}

.mest-afstand-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Geselecteerd: groene rand */
.mest-afstand-card:has(input[type="radio"]:checked) {
    border-color: #16a34a;
    box-shadow: 0 0 0 1px #16a34a;
}

/* Kaart-header (radio + titels) */
.mest-afstand-card-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.mest-afstand-card-radio {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #fff;
    margin-top: 2px;
    transition: border-color 0.15s;
}

.mest-afstand-card:has(input[type="radio"]:checked) .mest-afstand-card-radio {
    border-color: #16a34a;
}

.mest-afstand-card:has(input[type="radio"]:checked) .mest-afstand-card-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #16a34a;
}

.mest-afstand-card-titles {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.mest-afstand-card-title {
    font-weight: 700;
    font-size: 15px;
    color: #111827;
    line-height: 1.3;
}

.mest-afstand-card-desc {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

/* Diagram-afbeelding in de kaart */
.mest-afstand-card-img {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    flex: 1;
}

.mest-afstand-card-img img {
    max-width: 100%;
    height: auto;
    max-height: 110px;
    display: block;
}

/* Info-balk onderaan kaart */
.mest-afstand-card-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #f3f4f6;
    border-radius: 8px;
    margin-top: auto;
}

.mest-afstand-card:has(input[type="radio"]:checked) .mest-afstand-card-info {
    background: #ecfdf5;
}

.mest-afstand-card-info-icon {
    flex-shrink: 0;
    display: inline-flex;
    color: #9ca3af;
    margin-top: 1px;
}

.mest-afstand-card:has(input[type="radio"]:checked) .mest-afstand-card-info-icon {
    color: #16a34a;
}

.mest-afstand-card-info-text {
    font-size: 12.5px;
    color: #374151;
    line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Sectie 2 – Lengte-invoer                                            */
/* ------------------------------------------------------------------ */

.mest-afstand-length-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.mest-afstand-length-grid.has-help {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
}

@media (max-width: 001px) {
    .mest-afstand-length-grid.has-help {
        grid-template-columns: 1fr;
    }
}

/* Spinner */
.mest-afstand-spinner-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.mest-afstand-spinner {
    display: inline-flex;
    align-items: stretch;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.mest-afstand-spinner-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    background: #fff;
    border: none;
    color: #1f2937;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.12s;
}

.mest-afstand-spinner-btn:hover {
    background: #f3f4f6;
}

.mest-afstand-spinner-input {
    width: 90px!important;
    border: none!important;
    border-radius: 0!important;
    border-left: 1.5px solid #e5e7eb!important;
    border-right: 1.5px solid #e5e7eb!important;
    text-align: center!important;
    font-size: 15px!important;
    font-weight: 600!important;
    color: #111827!important;
    padding: 10px 6px!important;
    background: #fff!important;
    -moz-appearance: textfield!important;
    appearance: textfield!important;
}

.mest-afstand-spinner-input::-webkit-outer-spin-button,
.mest-afstand-spinner-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mest-afstand-spinner-input:focus {
    outline: none;
    background: #f9fafb;
}

.mest-afstand-spinner-unit {
    font-size: 14px;
    color: #6b7280;
}

.mest-afstand-length-hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: #6b7280;
}

/* Help-paneel */
.mest-afstand-help {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px 18px;
}

.mest-afstand-help-title {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.mest-afstand-help-body {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.mest-afstand-help-img {
    flex-shrink: 0;
    width: 120px;
}

.mest-afstand-help-img img {
    width: 100%;
    height: auto;
    display: block;
}

.mest-afstand-help-text {
    margin: 0;
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
}

@media (max-width: 480px) {
    .mest-afstand-help-body {
        flex-direction: column;
    }
    .mest-afstand-help-img {
        width: 100%;
        max-width: 200px;
    }
}

/* Readonly-staat: lengte-input én plus/min knoppen */
input.mest-input-readonly {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
    border-color: #d1d5db !important;
}

button.plus.mest-input-readonly,
button.minus.mest-input-readonly {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* ------------------------------------------------------------------ */
/* Toevoeging afstand – admin                                           */
/* ------------------------------------------------------------------ */

.mest-afstand-admin {
    padding: 4px 0 16px;
}

.mest-afstand-admin h3 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #50575e;
    margin: 24px 0 10px;
    padding: 0 0 6px;
    border-bottom: 1px solid #e2e4e7;
}

.mest-afstand-admin p {
    color: #646970;
    font-size: 13px;
    margin: 0 0 12px;
}

/* Categorieboom */
.mest-afstand-cat-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    max-width: 820px;
}

.mest-afstand-cat-item {
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.mest-afstand-cat-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px 2px 4px;
    min-height: 38px;
}

.mest-afstand-cat-item.has-children > .mest-afstand-cat-row {
    background: #f6f7f7;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}

.mest-afstand-cat-item.has-children.is-open > .mest-afstand-cat-row {
    border-bottom-color: #e2e4e7;
}

/* Toggle-knop */
.mest-afstand-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    color: #646970;
    padding: 0;
    transition: background 0.12s, color 0.12s;
}

.mest-afstand-toggle:hover {
    background: #e8ecf0;
    color: #1e1e1e;
}

.mest-afstand-toggle .dashicons {
    transition: transform 0.2s;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.mest-afstand-toggle.open .dashicons {
    transform: rotate(90deg);
}

.mest-afstand-toggle-placeholder {
    display: inline-block;
    width: 28px;
    flex-shrink: 0;
}

/* Categorie-label (checkbox pill) */
.mest-afstand-cat-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mest-afstand-cat-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 5px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 20px;
    background: #fff;
    color: #1e1e1e;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    user-select: none;
    line-height: 1.4;
}

.mest-afstand-cat-label::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #c3c4c7;
    border-radius: 3px;
    background: #fff;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}

.mest-afstand-cat-label:hover {
    border-color: #2271b1;
    color: #2271b1;
}

.mest-afstand-cat-label:hover::before {
    border-color: #2271b1;
}

.mest-afstand-cat-label.is-checked,
.mest-afstand-cat-label:has(input[type="checkbox"]:checked) {
    border-color: #2271b1;
    background: #2271b1;
    color: #fff;
}

.mest-afstand-cat-label.is-checked::before,
.mest-afstand-cat-label:has(input[type="checkbox"]:checked)::before {
    border-color: rgba(255,255,255,0.6);
    background-color: rgba(255,255,255,0.25);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath stroke='%23fff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round' d='M1 5l3 3 7-7'/%3E%3C/svg%3E");
}

/* Teller subcategorieën */
.mest-afstand-child-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0,0,0,0.12);
    color: inherit;
    line-height: 1;
}

.mest-afstand-cat-label.is-checked .mest-afstand-child-count,
.mest-afstand-cat-label:has(input:checked) .mest-afstand-child-count {
    background: rgba(255,255,255,0.25);
}

/* Subcategorieën container */
.mest-afstand-children {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px 10px 40px;
    background: #fff;
}

/* Admin – optie-kaartjes */
.mest-afstand-row-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e8ecf0;
    color: #50575e;
    font-size: 12px;
    font-weight: 700;
}

.mest-afstand-option-card {
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    margin-bottom: 12px;
    background: #fff;
    overflow: hidden;
}

.mest-afstand-option-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f6f7f7;
    border-bottom: 1px solid #e2e4e7;
}

.mest-afstand-option-card-label {
    font-weight: 600;
    font-size: 13px;
    color: #1e1e1e;
}

.mest-afstand-option-card-body {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
}

.mest-afstand-option-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-right: 1px solid #e2e4e7;
    flex: 1;
    min-width: 260px;
}

.mest-afstand-option-fields label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #50575e;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mest-afstand-option-fields input[type="text"],
.mest-afstand-option-fields input[type="number"] {
    border-color: #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
}

.mest-afstand-option-tooltip {
    flex: 1;
    min-width: 260px;
    padding: 14px;
}

.mest-afstand-option-tooltip-title {
    font-size: 12px;
    font-weight: 600;
    color: #50575e;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0 0 10px;
}

/* Admin – tooltip configuratie */
.mest-afstand-tooltip-config {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 4px;
}

.mest-afstand-img-upload {
    flex-shrink: 0;
}

.mest-afstand-img-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #50575e;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}

.mest-afstand-img-preview {
    width: 200px;
    min-height: 120px;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    overflow: hidden;
    margin-bottom: 10px;
}

.mest-afstand-img-preview img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.mest-afstand-img-placeholder {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    padding: 12px;
}

.mest-afstand-img-buttons {
    display: flex;
    gap: 8px;
}

.mest-afstand-tooltip-text {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mest-afstand-tooltip-text label {
    font-size: 13px;
}

.mest-afstand-tooltip-text textarea {
    border-color: #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    resize: vertical;
}

.mest-afstand-mm-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mest-afstand-mm-wrap span {
    font-size: 12px;
    color: #646970;
}
