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

/* DigiFusion Pro */
#accordion-section-digifusion_pro_section {
    background-color: #fff;
    display: flex !important;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1.1rem 1.1rem 1.3rem;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 2px 8px 20px 0 rgba(44, 62, 80, 0.1);

    h3 {
        font-weight: 700;

        &::after {
            display: none;
        }
    }

    h3,
    p {
        background-color: transparent !important;
        border: 0 !important;
        margin: 0;
        padding: 0;
        text-decoration: none;
    }

    .accordion-section-buttons {
        display: flex;
        gap: 8px;
        justify-content: flex-end;
        margin-block-start: 16px;

        a {
            background-color: #e74c3c;
            border-radius: 4px;
            color: #fff;
            padding: 8px 16px;
            text-decoration: none;
            transition: all 300ms ease-in-out;

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

/* 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;
    }
}

/* 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 {
    .digifusion-color-label {
        margin: 0 0 8px 0;
        font-weight: 600;
        display: block;
    }

    /* Single color picker */
    .digifusion-control-header-row {
        display: flex;
        justify-content: space-between;
        align-items: center;

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

    .digifusion-color-preview {
        width: 40px;
        height: 30px;
        border-radius: 3px;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
        padding: 0;
        border: 1px solid #ddd;
        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;
        }
    }

    /* Multi-color picker */
    .digifusion-color-list {
        display: flex;
        flex-direction: column;
        border: 1px solid #ddd;
        border-radius: 4px;

        .digifusion-color-item {
            position: relative;
            border-bottom: 1px solid #ddd;

            &:last-child {
                border-bottom: none;
            }
        }
    }

    .digifusion-color-button {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 8px 12px;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 13px;
        text-align: left;

        &:hover {
            border-color: #999;
            background: #f9f9f9;
        }

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

        &[aria-expanded="true"] {
            border-color: var(--wp-admin-theme-color);
            box-shadow: 0 0 0 1px var(--wp-admin-theme-color);
        }
    }

    .digifusion-color-indicator-wrapper {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
    }

    .digifusion-color-indicator {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
        flex-shrink: 0;
        display: block;
    }

    .digifusion-color-name {
        color: #1e1e1e;
        font-size: 13px;
        font-weight: 400;
        flex: 1;
    }

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

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

/* Reset Button */
.digifusion-color-item-inner {
    position: relative;
}

.digifusion-color-reset {
    position: absolute;
    top: 50%;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    cursor: pointer;
    transform: translateY(-50%);
    transition: all 0.2s ease;

    &:hover:not(:disabled) {
        color: #333;
    }

    &:disabled {
        opacity: 0.4;
        cursor: not-allowed;
        color: #ccc;
    }

    .dashicons {
        width: 13px;
        height: 13px;
        font-size: 13px;
    }
}

/* 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);
    }
}

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

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

/* Typography Control */
.digifusion-typography-control {
    .digifusion-control-header-wrap,
    .digifusion-control-label {
        margin: 0;
    }
}

/* Typography options container */
.digifusion-typography-options {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 16px;
    margin-top: 1rem;

    .components-select-control {
        margin-bottom: 15px;
    }

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

    .components-range-control {
        margin-bottom: 0;

        .components-range-control__wrapper {
            margin-bottom: 0;
        }
    }
}

/* Typography row spacing */
.digifusion-typography-row {
    margin-bottom: 15px;

    &:last-child {
        margin-bottom: 0;
    }
}

/* Edit button for typography */
.digifusion-edit.components-button.is-small.has-icon {
    color: #666;
    border: 1px solid #ddd;
    border-radius: 50%;
    min-width: auto;
    width: 28px;
    height: 28px;
    padding: 6px;

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

    &.is-pressed {
        color: #007cba;
        border-color: #007cba;
        background: #f0f8ff;
    }

    .dashicons {
        width: 12px;
        height: 12px;
        font-size: 12px;
    }
}

/* Typography responsive control */
.digifusion-responsive-control {
    width: 100%;
}

/* Typography control label */
.digifusion-control-label {
    color: #50575e;
    font-size: 13px !important;
    line-height: 1.4em !important;
    margin-bottom: 8px;
    text-transform: none !important;
    font-weight: 500 !important;
    display: block;
}
