/* Tekst & Billede 4 — frontend + editor styles */

/* ========== FRONTEND ========== */
.sm-text-image-4-wrapper {
    padding: 0;
    border-radius: 4px;
}
.sm-text-image-4-wrapper[style*="background-color"] {
    padding: 20px;
}
.sm-text-image-4-wrapper img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}
.sm-text-image-4-wrapper .sm-ti4-lightbox-trigger {
    display: inline-block;
    cursor: zoom-in;
}
.sm-text-image-4-wrapper .sm-ti4-lightbox-trigger img {
    cursor: zoom-in;
}

/* Heading-color: lad inline style (med !important fra render.php) vinde over tema-CSS */
.sm-text-image-4-wrapper h1.sm-ti4-heading,
.sm-text-image-4-wrapper h2.sm-ti4-heading,
.sm-text-image-4-wrapper h3.sm-ti4-heading,
.sm-text-image-4-wrapper h4.sm-ti4-heading,
.sm-text-image-4-wrapper h5.sm-ti4-heading,
.sm-text-image-4-wrapper h6.sm-ti4-heading {
    color: inherit;
}

/* Inline font-size + color spans skal kunne vinde over paragraph-CSS i tema og editor.
   Inline style med !important fra wrapSelection sikrer det, men line-height skal følge med
   så stor tekst ikke klippes af paragraph-line-height. */
.sm-text-image-4-content span[style*="font-size"],
.sm-ti4-content-field span[style*="font-size"] {
    line-height: 1.2;
}

/* Admin har en bred regel `.wp-die-message, p { font-size: 13px }` der rammer
   alle <p> i editor-modaler. Sørg for at en span med inline font-size altid vinder
   ved at give p en "neutral" baseline der respekterer span'ens egen størrelse. */
.sm-ti4-content-field p span[style*="font-size"] {
    font-size: revert;
}

/* Fremhævning (inline background-color span) — luft + pæn ombrydning over flere linjer */
.sm-text-image-4-content span[style*="background-color"],
.sm-ti4-content-field span[style*="background-color"] {
    padding: 0 2px;
    border-radius: 2px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}


/* Synlig highlight når link-popover er åben (markering forsvinder visuelt når fokus
   flyttes til URL-input) */
.sm-ti4-content-field span.sm-ti4-link-pending {
    background: rgba(0, 102, 204, 0.25);
    border-radius: 2px;
}


/* Box-shadow: sørg for at wrapper har en synlig "kasse" når shadow er sat */
.sm-text-image-4-wrapper[style*="box-shadow"] {
    padding: 20px;
    border-radius: 6px;
}

/* Clearfix på frontend-content (floated inline-img må ikke kollapsere container) */
.sm-text-image-4-content::after {
    content: "";
    display: table;
    clear: both;
}

/* Above / below */
.sm-text-image-4-wrapper.image-above .sm-text-image-4-image,
.sm-text-image-4-wrapper.image-above .sm-text-image-4-image-link {
    margin-bottom: 15px;
    display: block;
}
.sm-text-image-4-wrapper.image-below .sm-text-image-4-content {
    margin-bottom: 15px;
}

/* Left / Right (desktop + tablet) — flydende billede, max 60% */
.sm-text-image-4-wrapper.image-left .sm-text-image-4-flex,
.sm-text-image-4-wrapper.image-right .sm-text-image-4-flex {
    display: block;
}
.sm-text-image-4-wrapper.image-left .sm-text-image-4-flex::after,
.sm-text-image-4-wrapper.image-right .sm-text-image-4-flex::after {
    content: ""; display: table; clear: both;
}
.sm-text-image-4-wrapper.image-left .sm-text-image-4-image-col {
    float: left;
    max-width: 60%;
    margin: 0 20px 15px 0;
}
.sm-text-image-4-wrapper.image-right .sm-text-image-4-image-col {
    float: right;
    max-width: 60%;
    margin: 0 0 15px 20px;
}
.sm-text-image-4-wrapper .sm-text-image-4-content {
    max-width: 100%;
    overflow-wrap: break-word;
}
.sm-text-image-4-wrapper .sm-text-image-4-content p:last-child {
    margin-bottom: 0;
}

/* Normaliser første/sidste barns margin så afstanden til nabo-elementer (fx HR)
   er ens uanset om indholdet starter/slutter med overskrift, afsnit, billede eller knap */
.sm-text-image-4-content > *:first-child:not(.sm-ti4-cta-wrap),
.sm-text-image-4-wrapper.image-above .sm-text-image-4-content > *:first-child:not(.sm-ti4-cta-wrap),
.sm-text-image-4-wrapper.image-below .sm-text-image-4-image > *:first-child,
.sm-text-image-4-wrapper.image-left .sm-text-image-4-content > *:first-child:not(.sm-ti4-cta-wrap),
.sm-text-image-4-wrapper.image-right .sm-text-image-4-content > *:first-child:not(.sm-ti4-cta-wrap) {
    margin-top: 0;
}

.sm-text-image-4-content > *:last-child:not(.sm-ti4-cta-wrap),
.sm-text-image-4-wrapper.image-above .sm-text-image-4-image > *:last-child,
.sm-text-image-4-wrapper.image-below .sm-text-image-4-content > *:last-child:not(.sm-ti4-cta-wrap),
.sm-text-image-4-wrapper.image-left .sm-text-image-4-content > *:last-child:not(.sm-ti4-cta-wrap),
.sm-text-image-4-wrapper.image-right .sm-text-image-4-content > *:last-child:not(.sm-ti4-cta-wrap) {
    margin-bottom: 0;
}

/* CTA-knappen inde i blokken: intern afstand der følger afstands-presettet
   (revision 1: fast 16px som i dag). Specificitet over nulstillingerne, ingen !important. */
.sm-text-image-4-wrapper .sm-text-image-4-flex .sm-text-image-4-content > .sm-ti4-cta-wrap,
.sm-text-image-4-wrapper .sm-text-image-4-content > .sm-ti4-cta-wrap {
    display: block;
    margin-top: var(--sm-space-cta, 16px);
    margin-bottom: 0;
}

/* Mobil: left → over, right → under */
@media (max-width: 768px) {
    .sm-text-image-4-wrapper.image-left .sm-text-image-4-flex {
        display: flex;
        flex-direction: column;
    }
    .sm-text-image-4-wrapper.image-right .sm-text-image-4-flex {
        display: flex;
        flex-direction: column-reverse;
    }
    .sm-text-image-4-wrapper.image-left .sm-text-image-4-image-col,
    .sm-text-image-4-wrapper.image-right .sm-text-image-4-image-col {
        float: none;
        max-width: 100%;
        width: 100%;
        margin: 0 0 15px 0;
    }
}

/* Inline tabel i tekstfeltet */
.sm-text-image-4-content table.sm-ti4-table,
.sm-ti4-content-field table.sm-ti4-table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 1em;
}
.sm-text-image-4-content table.sm-ti4-table th,
.sm-text-image-4-content table.sm-ti4-table td,
.sm-ti4-content-field table.sm-ti4-table th,
.sm-ti4-content-field table.sm-ti4-table td {
    border: 1px solid #d0d0d0;
    padding: 8px 10px;
    vertical-align: top;
    text-align: left;
}
.sm-text-image-4-content table.sm-ti4-table th,
.sm-ti4-content-field table.sm-ti4-table th {
    background: #f5f5f5;
    font-weight: 600;
}

/* ========== EDITOR ========== */
.sm-ti4-edit-preview {
    border-radius: 4px;
    min-height: 60px;
}

/* Fjern Gutenberg's blå selection-outline på text-image-4 i editor — kun den røde
   section-ramme skal være synlig. Scoped til denne bloktype, så andre blokke ikke
   påvirkes. */
.editor-styles-wrapper [data-type="sider-maker/text-image-4"],
.editor-styles-wrapper [data-type="sider-maker/text-image-4"].is-selected,
.editor-styles-wrapper [data-type="sider-maker/text-image-4"].is-hovered,
.editor-styles-wrapper [data-type="sider-maker/text-image-4"].has-child-selected {
    outline: none !important;
    box-shadow: none !important;
}
.editor-styles-wrapper [data-type="sider-maker/text-image-4"]::before,
.editor-styles-wrapper [data-type="sider-maker/text-image-4"]::after,
.editor-styles-wrapper [data-type="sider-maker/text-image-4"].is-selected::before,
.editor-styles-wrapper [data-type="sider-maker/text-image-4"].is-hovered::before {
    box-shadow: none !important;
    outline: none !important;
    border: none !important;
}
.editor-styles-wrapper .sm-ti4-edit-preview,
.editor-styles-wrapper .sm-ti4-edit-preview:hover {
    border: none !important;
    outline: none !important;
}
/* Kun blokke UDEN egen skygge må nulstilles — ellers slår vi kundens
   valgte box-shadow ihjel i editoren (den virker fint på frontend). */
.editor-styles-wrapper .sm-ti4-edit-preview:not([style*="box-shadow"]),
.editor-styles-wrapper .sm-ti4-edit-preview:not([style*="box-shadow"]):hover {
    box-shadow: none !important;
}

/* Modal: Segoe UI overalt */
.sm-ti4-modal,
.sm-ti4-modal-body,
.sm-ti4-editor,
.sm-ti4-toolbar,
.sm-ti4-menu-item,
.sm-ti4-modal-label,
.sm-ti4-hex-input {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.sm-ti4-modal-body {
    padding: 8px 4px;
}
.sm-ti4-row {
    margin-bottom: 12px;
}
.sm-ti4-modal-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    text-align: left;
    color: #1e1e1e;
}
.sm-ti4-hex-input {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    background: #fff;
    box-sizing: border-box;
    min-width: 110px;
}
.sm-ti4-hex-input:focus {
    border-color: #2271b1;
    outline: 2px solid rgba(34,113,177,0.2);
}

/* Editor: editor-wrapper med fast toolbar + RichText-felt */
.sm-ti4-editor {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    margin-bottom: 6px;
    overflow: visible;
}
.sm-ti4-editor:focus-within {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Toolbar */
.sm-ti4-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: #f6f7f7;
    border-bottom: 1px solid #ddd;
    border-radius: 4px 4px 0 0;
    position: sticky;
    top: 0;
    z-index: 5;
}
.sm-ti4-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    color: #1e1e1e;
    font-size: 13px;
    line-height: 1;
    font-family: inherit;
}
.sm-ti4-tb-btn:hover {
    background: #e9eaeb;
    border-color: #ddd;
}
.sm-ti4-tb-btn:active,
.sm-ti4-tb-btn.is-active {
    background: #1e1e1e;
    color: #fff;
    border-color: #1e1e1e;
}
.sm-ti4-tb-blocktype {
    min-width: 110px;
    padding: 0 8px;
    justify-content: space-between;
}
.sm-ti4-tb-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 1;
}
.sm-ti4-tb-sep {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 4px;
}
.sm-ti4-tb-pop {
    position: relative;
    display: inline-flex;
}
.sm-ti4-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 13px;
    border-radius: 3px;
    font-family: inherit;
}
.sm-ti4-menu-item:hover {
    background: #f0f0f1;
}
.sm-ti4-menu-item.is-active {
    background: #1e1e1e;
    color: #fff;
}
.sm-ti4-menu-item.is-clear {
    border-top: 1px solid #eee;
    margin-top: 4px;
    color: #757575;
    font-style: italic;
}

/* Felt */
.sm-ti4-content-field {
    min-height: 200px;
    padding: 12px 14px;
    background: #fff;
    line-height: 1.5;
    outline: none;
    border: 0;
    border-radius: 0 0 4px 4px;
    font-family: 'Segoe UI', system-ui, sans-serif;
}
.sm-ti4-content-field:focus { outline: none; }
.sm-ti4-content-field ul,
.sm-ti4-content-field ol {
    padding-left: 1.5em;
    margin: 0 0 0.8em;
    list-style-position: outside;
}
.sm-ti4-content-field ul { list-style-type: disc; }
.sm-ti4-content-field ol { list-style-type: decimal; }
.sm-ti4-content-field ul ul { list-style-type: circle; }
.sm-ti4-content-field ul ul ul { list-style-type: square; }
.sm-ti4-content-field li { display: list-item; }
.sm-ti4-content-field code {
    background: #f0f0f1;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.92em;
}
.sm-ti4-content-field p { margin: 0 0 0.8em; }
.sm-ti4-content-field p:last-child { margin-bottom: 0; }
.sm-ti4-content-field img {
    max-width: 100%;
    height: auto;
}
.sm-ti4-content-field img:hover {
    outline: 2px solid #2271b1;
    cursor: pointer;
}

/* Placeholder */
.sm-ti4-content-field:empty::before {
    content: attr(data-placeholder);
    color: #9ca3af;
    font-style: italic;
    pointer-events: none;
    display: block;
}
.sm-ti4-content-field:focus::before { content: none; }

/* Clearfix på editor-felt så floated inline-billede ikke kollapsere rammen */
.sm-ti4-content-field::after {
    content: "";
    display: table;
    clear: both;
}

/* Modal helpers tilføjet i pkt 5/7/8 */
.sm-ti4-heading-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.sm-ti4-heading-row .sm-ti4-heading-input {
    flex: 0 0 calc(85% - 4px);
    font-size: 22px;
    padding: 10px 12px;
    font-weight: 600;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, sans-serif;
}
.sm-ti4-heading-row .sm-ti4-heading-tag {
    flex: 0 0 calc(15% - 4px);
    padding: 10px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    font-size: 14px;
    box-sizing: border-box;
}

/* Color field: 33% aktuelt-farvefelt | 66% swatches */
.sm-ti4-color-field {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
}
.sm-ti4-color-field .sm-ti4-color-current-col {
    flex: 0 0 33%;
    min-width: 0;
}
.sm-ti4-color-field .sm-ti4-color-swatches-col {
    flex: 1 1 auto;
    min-width: 0;
}
.sm-ti4-color-field .sm-ti4-color-current-col .components-color-palette__custom-color,
.sm-ti4-color-field .sm-ti4-color-current-col .components-circular-option-picker__custom-color-button,
.sm-ti4-color-field .sm-ti4-color-current-col .components-color-palette {
    width: 100%;
}

/* Hovedbillede + position-vælger to-kolonne */
.sm-ti4-image-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.sm-ti4-image-row .sm-ti4-image-col {
    flex: 1 1 auto;
    min-width: 0;
}
.sm-ti4-image-row .sm-ti4-position-col {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sm-ti4-position-col .sm-ti4-position-grid {
    display: grid;
    grid-template-columns: repeat(2, 80px);
    gap: 6px;
}
.sm-ti4-position-btn {
    width: 80px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    color: #1e1e1e;
    padding: 6px;
    box-sizing: border-box;
}
.sm-ti4-position-btn:hover {
    background: #f0f0f1;
}
.sm-ti4-position-btn.is-active {
    background: #e7f1fa;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1 inset;
}

/* Placering-ikoner: lille sort kasse kombineret med "linjer" som repræsenterer tekst */
.sm-ti4-pos-icon {
    display: inline-block;
    width: 56px;
    height: 36px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
/* Over: kasse øverst, linjer under */
.sm-ti4-pos-above {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 36'><rect x='4' y='2' width='48' height='12' fill='%231e1e1e'/><rect x='4' y='18' width='48' height='2' fill='%231e1e1e'/><rect x='4' y='23' width='40' height='2' fill='%231e1e1e'/><rect x='4' y='28' width='44' height='2' fill='%231e1e1e'/></svg>");
}
/* Under: linjer øverst, kasse nederst */
.sm-ti4-pos-below {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 36'><rect x='4' y='2' width='48' height='2' fill='%231e1e1e'/><rect x='4' y='7' width='40' height='2' fill='%231e1e1e'/><rect x='4' y='12' width='44' height='2' fill='%231e1e1e'/><rect x='4' y='20' width='48' height='14' fill='%231e1e1e'/></svg>");
}
/* Venstre: kasse til venstre, linjer til højre */
.sm-ti4-pos-left {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 36'><rect x='4' y='6' width='20' height='24' fill='%231e1e1e'/><rect x='28' y='8' width='24' height='2' fill='%231e1e1e'/><rect x='28' y='14' width='20' height='2' fill='%231e1e1e'/><rect x='28' y='20' width='24' height='2' fill='%231e1e1e'/><rect x='28' y='26' width='18' height='2' fill='%231e1e1e'/></svg>");
}
/* Højre: linjer til venstre, kasse til højre */
.sm-ti4-pos-right {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 36'><rect x='4' y='8' width='24' height='2' fill='%231e1e1e'/><rect x='4' y='14' width='20' height='2' fill='%231e1e1e'/><rect x='4' y='20' width='24' height='2' fill='%231e1e1e'/><rect x='4' y='26' width='18' height='2' fill='%231e1e1e'/><rect x='32' y='6' width='20' height='24' fill='%231e1e1e'/></svg>");
}

/* Divider */
.sm-ti4-divider {
    border: 0;
    border-top: 1px solid #e0e0e0;
    margin: 20px 0;
}

/* Foldbart afsnit i modalen (fx farve på overskrift) */
.sm-ti4-disclosure {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 0;
    padding: 4px 0;
    margin: 4px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: #2271b1;
    cursor: pointer;
}

.sm-ti4-disclosure:hover {
    text-decoration: underline;
}


/* ========== Tabel-celle markering + højreklik-menu ========== */
.sm-ti4-content-field td.is-selected,
.sm-ti4-content-field th.is-selected {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
    box-shadow: inset 0 0 0 9999px rgba(34, 113, 177, 0.12);
}

.sm-ti4-cell-menu {
    position: fixed;
    z-index: 100001;
    background: #fff;
    border: 1px solid #d0d0d0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    border-radius: 4px;
    padding: 4px 0;
    min-width: 210px;
    font-family: 'Segoe UI', -apple-system, sans-serif;
    font-size: 13px;
}
.sm-ti4-cell-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 7px 14px;
    cursor: pointer;
    color: #1e1e1e;
    font: inherit;
}
.sm-ti4-cell-menu-item:hover:not(:disabled) {
    background: #f0f0f0;
}
.sm-ti4-cell-menu-item:disabled {
    color: #999;
    cursor: default;
}
.sm-ti4-cell-menu-sep {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

.sm-ti4-cell-color-popover {
    position: fixed;
    z-index: 100002;
    background: #fff;
    border: 1px solid #d0d0d0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    border-radius: 4px;
    padding: 10px;
    min-width: 280px;
    font-family: 'Segoe UI', -apple-system, sans-serif;
}



