:root {

    --savebar-branding: #2280A3;
}

/* ====== Z-Index Layering Utilities ====== */
:root {
    --z-base: 1;
    --z-ui: 10;
    --z-dropdown: 100;
    --z-modal: 1000;
    --z-overlay: 9999;
}

/* Core stacking contexts */
.z-base      { z-index: var(--z-base); }
.z-ui        { z-index: var(--z-ui); }
.z-dropdown  { z-index: var(--z-dropdown); }
.z-modal     { z-index: var(--z-modal); }
.z-overlay   { z-index: var(--z-overlay); }

/* Stack context isolation */
.isolate     { isolation: isolate; }


[x-cloak] { display: none; }

/* EDIT PAGE */

#savebar {

    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: black;
    padding:5px;

    background-size: 10px 10px;
    color: white;
    text-align: center;
    z-index: var(--z-overlay);
}

.profile-field {
    position: relative;
}

#profile-edit-banner {
    text-align: center;
    width: 100%;
    height:100%
}
#profile-edit-banner {
    position: absolute;
    display: flex;
    left: -100%;
    bottom: 0;
    background-color: rgba(0, 128, 0, 0.75); /* green */
    color: white;
    text-align: center;
    z-index: var(--z-overlay);
    transition: left 0.5s ease-in-out;
    align-items:center;
    justify-content:center;
}

#profile-edit-banner.error {
    background-color: rgba(255, 0, 0, 0.75); /* red */
}

#profile-edit-banner.show {
    left: 0;
}



.mm-hidden-border {
    border: 2px solid #ff9800 !important;
    position: relative;
}
.mm-empty-border {
    border: 2px solid #9c27b0 !important;
    position: relative;
}

.animated-hidden-border {
    position: relative;
    border: 2px dashed transparent;
    border-image: repeating-linear-gradient(
            135deg,
            #ff9800 0,
            #ff9800 10px,
            #ffb74d 10px,
            #ffb74d 20px
    );
    border-image-slice: 1;
    animation: dashmove-hidden 3s linear infinite;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset, 0 0 4px rgba(0, 0, 0, 0.3);
}

@keyframes dashmove-hidden {
    from {
        border-image-source: repeating-linear-gradient(
                135deg,
                #ff9800 0,
                #ff9800 10px,
                #ffb74d 10px,
                #ffb74d 20px
        );
    }
    to {
        border-image-source: repeating-linear-gradient(
                135deg,
                #ffb74d 0,
                #ffb74d 10px,
                #ff9800 10px,
                #ff9800 20px
        );
    }
}

.animated-empty-border {
    position: relative;
    border: 2px dashed transparent;
    border-image: repeating-linear-gradient(
            135deg,
            #9c27b0 0,
            #9c27b0 10px,
            #ce93d8 10px,
            #ce93d8 20px
    );
    border-image-slice: 1;
    animation: dashmove-empty 3s linear infinite;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset, 0 0 4px rgba(0, 0, 0, 0.3);
}

@keyframes dashmove-empty {
    from {
        border-image-source: repeating-linear-gradient(
                135deg,
                #9c27b0 0,
                #9c27b0 10px,
                #ce93d8 10px,
                #ce93d8 20px
        );
    }
    to {
        border-image-source: repeating-linear-gradient(
                135deg,
                #ce93d8 0,
                #ce93d8 10px,
                #9c27b0 10px,
                #9c27b0 20px
        );
    }
}



.animated-mixed-border {
    position: relative;
    border: 2px dashed transparent;
    border-image: repeating-linear-gradient(
            135deg,
            #ff9800 0,
            #ff9800 10px,
            #9c27b0 10px,
            #9c27b0 20px
    );
    border-image-slice: 1;
    animation: dashmove 3s linear infinite;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset, 0 0 4px rgba(0, 0, 0, 0.3);
}

@keyframes dashmove {
    from {
        border-image-source: repeating-linear-gradient(
                135deg,
                #ff9800 0,
                #ff9800 10px,
                #9c27b0 10px,
                #9c27b0 20px
        );
    }
    to {
        border-image-source: repeating-linear-gradient(
                135deg,
                #9c27b0 0,
                #9c27b0 10px,
                #ff9800 10px,
                #ff9800 20px
        );
    }
}

.mm-hidden-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #ff9800;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
    line-height: 1;
}
.mm-empty-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #9c27b0;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
    line-height: 1;
}

/** MODALS **/
.edit-buttons-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-overlay); /* dominates everything */
    pointer-events: none;
    isolation: isolate;
}

.edit-buttons-wrapper {
    z-index: var(--z-modal); /* high, but beneath overlay */
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.85);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid lime;
    position: absolute;
    isolation: isolate;
}
.modal-buttons {
    display: inline-flex;
    justify-content: flex-end;
    margin: 5px 0px;
    padding: 0px;
}

div[data-apf-type="richtext"] .edit-buttons-wrapper .buttons-wrap {
    display: flex;

    column-gap: 1px;
    flex-direction: column;
    flex-wrap: wrap;
}
.editable-list {
    display: inline-flex;
    flex-flow: column;
    position: relative;
    padding-left:0px;
}
.editable-list li {
    display: inline-flex;
    vertical-align: middle;
    padding: 2px;

}
.editable-field ul.no-list-content li{
    list-style: none;
}
/* Buttons Save - Cancel **/
/* Add this CSS to your stylesheet or within a <style> tag */
.button-save, .button-cancel, .button-reset, .button-edit-image, .list-add-button, .list-remove-button, .mixer-undo-button, .mixer-redo-button {

    display: inline-block;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 25px;
    border-radius: 4px;
    font-size: 20px;
    color: white;
    cursor: pointer;
    margin: 0px 0px 0px 4px;
    top: 1px;
    position: relative;
    padding-left:8px;
}
.button-save span.dashicons,
.button-cancel span.dashicons,
.button-reset span.dashicons,
.button-edit-image span.dashicons, .list-add-button span.dashicons, .list-remove-button span.dashicons{
    margin-right: 5px;
}

.list-add-button{
    background-color: black;
    color: #ff9800;
}
.button-save {
    background-color: black;
    color: lime;
}

.button-cancel {
    background-color: black;
    color: tomato;
}

.button-save::before {

}

.button-cancel::before {

}

.mixer-undo-button {
    background-color: black;
    color: #ffa000;
    padding: 4px 4px;
}
.mixer-redo-button{
    background-color: black;
    color: #00bcd4;
    padding: 4px 4px;
}

.mixer-undo-button:hover {
    color: black;
    background-color: #ffa000;
}
.mixer-redo-button:hover{
    color: black;
    background-color: #00bcd4;

}


/* Reset button specific styles */
.button-reset {
    background-color: black;
    color: #00a0d2;
}

/* Individual Field Buttons (Clear & Save) */
.individual-field-buttons {
    opacity: 0;
    transform: scaleY(0);
    transform-origin: top;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: inline-flex;
    gap: 2px;
    z-index: calc(var(--z-ui) + 1);
    position: absolute;
    top: -15px;
    right: 5px;
}
/* Show the buttons when hovering over the editable field */
.editable-field:hover .individual-field-buttons {
    opacity: 1;
    transform: scaleY(1);
    pointer-events: auto;
}

.editable-field .button-query-wrap {
    transition: transform 0.3s ease, font-size 0.3s ease;
}

/** Scale Effect **/
/** EDIT BUTTONS **/
.edit-button-wrapper {
    transition: transform 0.3s ease, font-size 0.3s ease;
}

/** RIch TExt **/

div[data-apf-type="richtext"] .edit-button-wrapper:hover {


}
div[data-apf-type="richtext"] .individual-field-buttons {

}
div[data-apf-type="richtext"] {
    padding: 6px 6px;
}

/** ICON LINKS **/
div[data-apf-type="icon_link"] .edit-button-wrapper {
    transition: transform 0.3s ease, font-size 0.3s ease;
}
div[data-apf-type="icon_link"] .edit-button-wrapper:hover {
    transform: scale(1.5);
    font-size: 15px;
}

/** When container is small < 150px **/

.button-query-wrap {
    container-type: inline-size;
    width: 100%;
    height:100%;

}

@container (max-width: 150px) {

    span.button-label {
        display: none;
    }
    .individual-field-buttons {
        transform:scaleX(0);
        top: 0px;
        right: -40px;
        flex-direction: column;
        gap: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;

    }
    .editable-field:hover .individual-field-buttons {
        opacity: 1;
        transform: scaleX(1);
        pointer-events: auto;
    }

    .individual-field-buttons button {
        border-radius:0px;
        padding:2px 0px 1px 13px
    }

    .individual-field-buttons span.dashicons {
        font-size: 24px !important;
        width: 20px !important;
        height: 20px !important;
    }
    .individual-field-buttons span.dashicons.dashicons-update {
        position: relative;
        left: -9px;
        top: -2px;
    }
    .edit-button-wrapper {
        transition: transform 0.3s ease, font-size 0.3s ease;
    }
    .edit-button-wrapper:hover {
        transform: scale(1.5);

    }
    .edit-button-label {
        font-size: 12px;
        line-height: 34px;
    }

}
.clear-field-button,
.save-field-button {
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 12px;
    min-width: 40px;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease-in-out, box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.clear-field-button span.dashicons.dashicons-update {

    width: 17px;
    height: 17px;
    font-size: 17px;
}
.save-field-button span.dashicons.dashicons-saved{
    width: 17px;
    height: 17px;
    font-size: 23px;
}
/* Clear button styles (Orange) */
.clear-field-button {
    background: rgba(255, 164, 0, 0.9);
    color: white;
}

/* Save button styles (Green) */
.save-field-button {
    background: rgba(0, 164, 0, 0.9);
    color: white;
}

/* Hover effects */
.clear-field-button:hover {
    background: rgba(255, 121, 0, 1);
    box-shadow: 0 0 6px rgba(255, 164, 0, 0.8);
}
.save-field-button:hover {
    background: rgba(0, 121, 0, 1);
    box-shadow: 0 0 6px rgba(0, 164, 0, 0.8);
}

/** hide on icon box **/

.editable-field[data-apf-type="icon_link"] span.button-label {
    display: none;
}
.editable-field[data-apf-type="icon_link"] .individual-field-buttons {
    position: absolute;
    top: 0;
    right: -40px;
    flex-direction: column;
    gap: 0;
}
.editable-field[data-apf-type="icon_link"] .individual-field-buttons button {
    border-radius:0px;
    padding:2px 0px 1px 13px
}

.editable-field[data-apf-type="icon_link"] .individual-field-buttons span.dashicons {
    font-size:24px;
}
.editable-field[data-apf-type="icon_link"] .individual-field-buttons span.dashicons.dashicons-update {
    position: relative;
    left: -9px;
    top: -2px;
}

/* Circular arrow icon for reset button */
.list-add-button::before {

}
.button-reset::before {

}
/* Hover effects for buttons */
.button-save:hover {
    background-color: #45a049;
    color: black;
}

.button-cancel:hover {
    background-color: #e53935;
    color: black;
}

.button-reset:hover {
    background-color: #007bb5;
    color:black;
}

.button-edit-image {
    background-color: black; /* Orange */
    color: #ff9800;
}
/* Picture icon for edit image button */

.button-edit-image::before {

}
.button-edit-image:hover {
    background-color: #ff9800;
    color: black;
}
.list-add-button:hover{
    background-color: #ff9800;
    color: black;
}
.list-add-button span.dashicons{
    left: -6px;
    position: relative;
    top: 1.5px;
    font-size: 26px;
}
.list-remove-button {
    color: #ff4444; /* Red tone for remove action */
    background-color: black;
}

.list-remove-button:hover {
    background-color: #ff4444;
    color: black;
}

.list-remove-button span.dashicons {
    font-size: 24px;
    /* top: 1px; */
    left: -5px;
    position: relative;
}

.buttons-wrap {
    width: auto;
    float: right;
}
span.dashicons.dashicons-format-image {
    left: -3px;
    position: relative;
    top: 1.5px;
    font-size: 20px;

}
span.dashicons.dashicons-saved {
        left: -9px;
        position: relative;
        top: -2.5px;
        font-size: 30px;
}

span.dashicons.dashicons-no-alt {
    left: -8px;
    position: relative;
    top: -3.5px;
    font-size: 30px;
}
span.dashicons.dashicons-image-rotate {
    left: -2.5px;
    position: relative;
    top: 1.5px;
    font-size: 20px;
}
.edit-buttons-wrapper .apf-field-input {
    font-size: initial;
    color:black;
}
input.apf-field-input {
    width: calc(100% - 125px);
    height: 28px;

    padding: 2px;
    margin: 0px 2px;
}
.profile-field[data-apf-type="image"] input.apf-field-input {
    width: calc(100% - 166px);
}
/* Clear float */
.clearfix::after {
    content: "";
    clear: both;
    display: table;
}
/* Common style for all edit notices */
.edit-notice {
    position: absolute;
    display: none;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 20px;
    border-radius: 3px;
    text-align: center;
    vertical-align: middle;
    z-index: var(--z-ui);
}

/* Show edit notice on hover */
.editable-field:hover .edit-notice {
    display: flex;
    justify-content: center;
    align-items: center;
}

.editable-field.editing .edit-notice {
    /*display: none;*/
}

.editable-field[data-new-content='true']:hover .individual-save {
    display: block;
}

.editable-field[data-new-content="true"]  {
    border: 2px solid red;
}
.changed-notice-true  {
    border: 2px solid red;
}
/* begin savebar */
/* Savebar */
#savebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: black;
    color: white;
    text-align: center;
    z-index: var(--z-overlay);
}

/** Video Sizes **/

.editable-field iframe, .editable-field video{
    width:450px;
    aspect-ratio:16 / 9;
}

.editable-field .video-bg-image{
    width:450px;
    aspect-ratio:16 / 9;
    object-fit: cover;
}
/* SVG Carbon Fiber Look */
/* Add your SVG element here */

/* Buttons */

#global-save-button, #autosave-box {
    float: right; /* Floats buttons and checkbox to the right */
    margin-right: 10px; /* Adds some margin for spacing */
}

#autoSaveCheckbox:checked + label {
    color: white;
}
#clearAllBtn, #resetOriginalBtn, #toggleHighlightModeBtn {
    float: left; /* Floats buttons and checkbox to the right */
    margin-right: 10px; /* Adds some margin for spacing */
}
#global-save-button, #clearAllBtn, #resetOriginalBtn, #toggleHighlightModeBtn {
    font-size: 18px;
    padding: 10px 15px;
    background: var(--savebar-branding);
    color: white;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.close-editor{
    font-size: 18px;
    padding: 10px 15px;
    background: var(--savebar-branding);
    color: white;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
 .close-editor:hover {
    background: var(--savebar-branding);
    box-shadow: 0 0 15px black;
}
#global-save-button:hover, #autosave-box:hover, #clearAllBtn:hover, #toggleHighlightModeBtn:hover, #resetOriginalBtn:hover {
    background: var(--savebar-branding);
    box-shadow: 0 0 10px white;
}
#autosave-box {
    pointer-events: auto; /* Ensure the autosave box itself is clickable */
}
/* Disable pointer events on all direct children of the autosave box */
#autosave-box > * {
    pointer-events: none;
}

/* Checkbox */
#autoSaveCheckbox {
    display: none;
}

#autoSaveCheckbox + label {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    line-height: 20px;
    float: right;
    margin: 0px;
}

#autoSaveCheckbox + label::before, #autoSaveCheckbox + label::after {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

#autosave-box {


    background: var(--savebar-branding);
    padding: 10px 10px 10px 20px;
}

#autoSaveCheckbox:checked + label::before {
    background: var(--savebar-branding);
}

#autoSaveCheckbox + label::after {
    content: "";
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transition: all 0.3s ease;
    transform: scale(0);
}

#autoSaveCheckbox:checked + label::after {
    transform: translateY(-50%) rotate(45deg) scale(1);
}

/* Tiny MCE */
.editable-field .tox-tinymce{
    border: 2px solid black;
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
    overflow: hidden;
    position: relative;
    visibility: inherit !important;
}
.tox .tox-promotion, .tox-menubar {
    display: none !important;
}

/* Modal CSS */

.custom-modal {
    position: fixed;
    z-index: var(--z-modal);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}
.custom-modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 50%;
}
.custom-close {
    color: #aaaaaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}
.custom-close:hover,
.custom-close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

/** MOdal Elements **/

.edit-buttons-wrapper .edit-preview-thmb {
    width: 200px !important;
    height: auto;
}

/** Wrap elements when changed input **/
.changed-field input, .changed-field .apf-field-content, .changed-field .apf-richtext-wrap, .changed-field .apf-richtext-content {
    border: 3px solid red;
}

/** Tool CSS  */
