/**
 * DigiFusion Customizer Controls CSS
 * 
 * @package DigiFusion
 */

/* Common Control Styles */
.accordion-section-title button.accordion-trigger:focus {
    box-shadow: none;
    outline: none;
}

.customize-control {
    margin-bottom: 1rem;
}

.customize-control-title {
    margin-bottom: 6px;
}

.digifusion-control-header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;

    .digifusion-control-left {
        display: flex;
        align-items: center;
        gap: 8px;

        .customize-control-title {
            margin-bottom: 0;
        }
    }

    .digifusion-control-right {
        display: flex;
        align-items: center;
        gap: 5px;
    }
}

.digifusion-reset.components-button.has-icon {
    margin-left: 0;
}

.digifusion-control-right {
    .components-base-control {
        display: flex;
        align-items: center;
    }

    .components-toggle-group-control {
        background: none;
        padding: 0;
        border: 0 !important;
        gap: 0.25rem;
        min-height: auto;
        outline: none !important;
        box-shadow: none !important;

        > div {
            min-width: auto;
        }

        &::before {
            display: none;
        }
    }

    .components-toggle-group-control-option-base {
        padding: 0;
        background: none;

        &[aria-checked="true"] {
            color: #007cba;
        }

        &[aria-checked="false"] {
            color: #757575;

            &:hover {
                color: #333333;
            }
        }
    }
}

/* Reset Button */
.digifusion-reset.components-button.is-small.has-icon:not(.has-text) {
    min-width: auto;
    padding: 0;
    width: auto;
}

body .components-button.is-secondary.digifusion-reset.is-small {
    box-shadow: unset;
    background: transparent;
    color: #ccc;
    padding: 0 4px;

    &:not(:disabled) {
        color: #007cba;
    }
}

.digifusion-reset .dashicons-image-rotate {
    width: 10px;
    height: 10px;
    font-size: 10px;
}

.digifusion-reset.is-small.is-pressed,
.digifusion-reset.is-small:focus:not(:disabled) {
    border: 0;
}

/* Responsive Controls */
.digifusion-responsive-device-toggle {
    border: 0;
    box-shadow: none !important;
    color: #50575e;
    cursor: pointer;
    display: flex;
    height: auto;
    line-height: 0;
    margin: 0;
    outline: 0;
    padding: 4px;

    &:hover,
    &:focus {
        background: transparent !important;
        box-shadow: none !important;
    }

    svg {
        height: 0.6rem;
        width: 0.6rem;
        fill: currentColor;
    }
}

/* Range Control */
.digifusion-custom-range-control {
    display: flex;
    gap: 10px;
    align-items: center;

    .range-slider-wrapper {
        position: relative;
        flex: 1;
        height: 30px;

        .range-slider {
            appearance: none;
            -webkit-appearance: none;
            height: 24px;
            background: transparent;
            top: 0;
            left: 0;

            &:focus {
                outline: none;
            }
        }

        .range-track {
            top: 50%;
            transform: translateY(-50%);
            height: 4px;
            z-index: 1;
        }

        .range-track-fill {
            position: absolute;
            height: 100%;
            background-color: var(--wp-admin-theme-color);
            border-radius: 3px;
        }

        .range-thumb {
            top: 50%;
            margin-left: 0;
            transform: translate(-50%, -50%);
            z-index: 1;
        }
    }

    .input-wrapper {
        width: 70px;
        margin: 0;

        .number-input {
            border-color: #d5d5d5;

            &::-webkit-inner-spin-button,
            &::-webkit-outer-spin-button {
                margin: 0;
            }

            &:focus {
                border-color: var(--wp-admin-theme-color);
                box-shadow: none;
                outline: none;
            }
        }
    }
}

/* Dimensions Control */
.digifusion-spacing-inputs {
    display: flex;

    > .digifusion-spacing-input:first-child {
        border-radius: 3px 0 0 3px;
    }
}

.digifusion-spacing-input {
    &[type="number"] {
        border-left: 1px solid;
        border-right: 1px solid;
        border-color: #d5d5d5;
        color: #50575e;
        border-radius: 0;
        box-shadow: none !important;
        height: 30px;
        margin: 0 -1px 0 0 !important;
        padding-right: 1px;
        flex: 1;
        font-size: 14px;
        line-height: 20px;
        padding-left: 4px;
        text-align: center;
    }

    &::-webkit-outer-spin-button,
    &::-webkit-inner-spin-button {
        margin: 0;
    }

    &:focus {
        z-index: 1;
        outline-offset: -1px;
        outline: 1px solid #cccccc;
    }

    &::placeholder {
        color: #aaa;
    }
}

/* Link/Unlink Button */
.digifusion-spacing-link {
    border: 1px solid #959595;
    background-color: #959595;
    color: #ffffff;
    justify-content: center;
    display: flex;
    align-items: center;
    flex: 1;
    height: auto;
    font-size: 12px;
    cursor: pointer;
    transition: none;
    border-radius: 0 3px 3px 0;

    &.digifusion-spacing-control-disconnected {
        border-color: #d5d5d5;
        background-color: #ffffff;
        color: #959595;
    }
}

/* Labels */
.digifusion-spacing-labels {
    display: flex;
    margin-top: 5px;
}

.digifusion-spacing-label {
    color: #cccccc;
    display: block;
    font-size: 10px;
    text-align: center;
    flex: 1;

    &.digifusion-spacing-link-label {
        flex: 1;
    }
}

/* Color Picker Control */
.digifusion-color-picker-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;

    .digifusion-color-label {
        margin: 0;
    }

    .digifusion-color-preview {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
        padding: 0;
        border: none;
        cursor: pointer;
        overflow: hidden;

        &:focus {
            box-shadow: 0 0 0 2px var(--wp-admin-theme-color),
                inset 0 0 0 1px rgba(0, 0, 0, 0.2);
            outline: none;
        }
    }

    .digifusion-color-picker-popover {
        padding: 12px;
    }

    .components-color-picker {
        width: 100%;
    }
}

/* Box Shadow Control */
.digifusion-box-shadow-control-inner {
    .components-toggle-group-control {
        border-color: #d5d5d5;
    }

    .components-button-group.is-block {
        display: flex;

        .components-button {
            flex: 1;
            justify-content: center;
        }
    }

    .digifusion-control-tabs {
        .components-tab-panel__tabs {
            display: flex;
            border-bottom: 1px solid #e0e0e0;
            margin-bottom: 16px;

            .components-tab-panel__tabs-item {
                flex: 1;
                justify-content: center;
                border-bottom: 3px solid transparent;
                margin-bottom: -1px;

                &.active-tab {
                    border-bottom-color: var(--wp-admin-theme-color);
                }
            }
        }
    }

    .digifusion-box-shadow-color {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 1rem;
        margin-bottom: 12px;

        .digifusion-color-preview {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
            padding: 0;
            border: none;
            cursor: pointer;
            overflow: hidden;

            &:focus {
                box-shadow: 0 0 0 2px var(--wp-admin-theme-color),
                    inset 0 0 0 1px rgba(0, 0, 0, 0.2);
                outline: none;
            }
        }

        .digifusion-color-picker-popover {
            padding: 12px;
        }
    }

    .digifusion-multi-buttons-control {
        margin-top: 12px;

        &__label {
            margin-bottom: 8px;
            font-weight: 500;
        }
    }
}

/* Toggle Control */
.digifusion-toggle-switch-wrap {
    margin-top: 5px;

    /* Style adjustments for the WP component */
    .components-toggle-control {
        margin-bottom: 0;

        .components-base-control__field {
            margin-bottom: 0;
        }

        .components-toggle-control__label {
            font-weight: 500;
        }
    }

    /* Improve toggle appearance */
    .components-form-toggle.is-checked .components-form-toggle__track {
        background-color: var(--wp-admin-theme-color);
    }
}

/* Rich Text Control */
.digifusion-rich-text-container {
    .quicktags-toolbar {
        padding: 3px;
        position: relative;
        border: 1px solid #d5d5d5;
        border-bottom: 0;
        background: #f6f7f7;
        min-height: 30px;
    }

    .digifusion-rich-text-editor {
        border-color: #d5d5d5;
        width: 100%;
        border-radius: 0;

        &:focus {
            border-color: var(--wp-admin-theme-color);
            box-shadow: none;
            outline: none;
        }
    }
}

/* Button Group Control */
.digifusion-button-group-options {
    .components-toggle-group-control {
        border-color: #d5d5d5;
    }

    .components-button-group.is-block {
        display: flex;

        .components-button {
            flex: 1;
            justify-content: center;

            &.is-pressed {
                background-color: var(--wp-admin-theme-color);
                color: #fff;
            }
        }
    }
}

/* Text Control */
.digifusion-text-control-inner {
    .components-text-control__input {
        border-color: #d5d5d5;

        &:focus {
            border-color: var(--wp-admin-theme-color);
            box-shadow: none;
            outline: none;
        }
    }
}

/* Select Control */
.digifusion-select-control-inner {
    .components-select-control__input {
        margin: 0;

        &:focus {
            border-color: var(--wp-admin-theme-color);
        }
    }
}

/* Image Control */
.digifusion-image-control-inner {
    .digifusion-image-preview {
        position: relative;
        margin-bottom: 12px;

        img {
            max-width: 100%;
            height: auto;
            display: block;
        }
    }
}

.digifusion-background-settings {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.digifusion-image-container .digifusion-image-preview .components-button {
    position: absolute;
    right: 5px;
    top: 5px;
    border-radius: 50%;
    height: 28px;
    justify-content: center;
    margin: 0;
    outline: none;
    padding: 0;
    width: 28px;
    background-color: #dc3545;
    color: #fff !important;

    &:hover {
        background-color: #a32531;
    }
}
