/**
 * Editor styles for the Social Sharing Block
 */

// Import common SCSS
@import '../common.scss';

.wp-block-wpzoom-blocks-social-sharing {
    position: relative;
    
    .social-sharing-icons {
        display: flex;
        flex-wrap: wrap;
        list-style: none;
        padding: 0;
        margin: 0;
        
        &.align-left {
            justify-content: flex-start;
        }
        
        &.align-center {
            justify-content: center;
        }
        
        &.align-right {
            justify-content: flex-end;
        }
        
        .social-sharing-icon-li {
            position: relative;
            display: inline-block;
            margin: 0;
            padding: 0;
        }
        
        .social-sharing-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
            transition: all 0.3s ease;
            color: #fff;
            
            &:hover {
                opacity: 0.9;
            }

            // Make icons clickable in editor
            .block-editor-block-list__layout & {
                cursor: pointer;
                
                &:hover {
                    box-shadow: 0 0 0 2px #007cba;
                    position: relative;
                    z-index: 1;
                    
                    &::after {
                        content: "\f464"; // WordPress dashicon pencil
                        font-family: dashicons;
                        position: absolute;
                        top: -8px;
                        right: -8px;
                        background: #007cba;
                        color: white;
                        border-radius: 50%;
                        width: 16px;
                        height: 16px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        font-size: 12px;
                        line-height: 1;
                    }
                }
            }
        }
        
        .social-sharing-icon-label {
            margin-left: 8px;
        }
    }

    .no-sharing-platforms-selected {
        padding: 12px;
        text-align: center;
        background: #f0f0f0;
        border-radius: 4px;
        color: #757575;
    }
    
    // Style for edit hint
    .wpzoom-click-to-edit-hint {
        opacity: 0.8;
        padding: 5px 10px;
        animation: fadeIn 0.3s ease-in-out;
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 0.8; }
        }
    }
}

// Custom styles for the label edit popover
.wpzoom-social-sharing-edit-label-popover {
    .components-popover__content {
        padding: 0;
        box-shadow: 0 3px 10px rgba(25, 30, 35, 0.2);
        border-radius: 4px;
        border: none;
        
        h3 {
            padding-bottom: 8px;
            border-bottom: 1px solid #e0e0e0;
        }
        
        .components-base-control {
            margin-bottom: 16px;
            width: 100%;
            
            .components-base-control__field {
                margin-bottom: 0;
            }
        }
        
        .components-button {
            height: 32px;
        }
    }
}

// Styles for Inspector Controls
.components-panel {
    .components-base-control {
        margin-bottom: 16px;
    }
    
    .components-panel__row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }
    
    // Styles for the drag and drop functionality
    .wpzoom-social-icons-platforms-list {
        margin-top: 10px;
        
        .wpzoom-social-platform-item {
            transition: background-color 0.2s, transform 0.15s;
            
            &:hover {
                background-color: #f8f8f8;
                
                .drag-handle {
                    color: #1e1e1e;
                }
            }
            
            &.is-dragging {
                background-color: #f0f7ff;
                box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
                z-index: 1;
                position: relative;
                transform: scale(1.02);
                opacity: 0.8;
            }
            
            &.drag-over {
                border-top: 2px solid #007cba;
                box-shadow: 0 0 0 1px #007cba;
                position: relative;
                z-index: 0;
                background-color: #f0f7ff;
                
                &::before {
                    content: "";
                    position: absolute;
                    top: -4px;
                    left: 0;
                    right: 0;
                    height: 2px;
                    background-color: #007cba;
                    z-index: 1;
                }
            }
            
            .drag-handle {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 24px;
                height: 24px;
                cursor: grab;
                
                &:active {
                    cursor: grabbing;
                }
                
                svg {
                    width: 20px;
                    height: 20px;
                }
            }
            
            // Style the checkbox control inside
            .components-checkbox-control {
                margin-bottom: 0;
            }
            
            // Style the button group
            .components-button-group {
                display: flex;
                gap: 2px;
                
                .components-button {
                    padding: 0;
                    min-width: 24px;
                    height: 24px;
                    
                    &:disabled {
                        opacity: 0.5;
                    }
                }
            }
        }
        
        // Style for when dragging
        .wpzoom-social-platform-item-placeholder {
            border: 1px dashed #ccc;
            background-color: #f8f9fa;
            height: 40px;
            margin: 4px 0;
        }
    }
}

// Block style variations
.is-style-default {
    .social-sharing-icon {
        border-radius: 50%;
        // No color overrides here to allow custom colors
    }
}

.is-style-filled {
    .social-sharing-icon {
        border-radius: 0;
        // No color overrides here to allow custom colors
    }
}

.is-style-rounded {
    .social-sharing-icon {
        border-radius: 8px;
        // No color overrides here to allow custom colors
    }
}

.is-style-outlined-pill {
    .social-sharing-icon {
        background-color: transparent !important;
        border: 1px solid currentColor;
        border-radius: 50%;
        
        // Only override colors if they haven't been customized
        &:not([style*="color:"]) {
            svg {
                fill: #000;
            }

            .social-sharing-icon-label {
                color: #000;
            }
        }
    }
}

.is-style-outlined-square {
    .social-sharing-icon {
        background-color: transparent !important;
        border: 1px solid currentColor;
        border-radius: 0;

        // Only override colors if they haven't been customized
        &:not([style*="color:"]) {
            svg {
                fill: #000;
            }
            
            .social-sharing-icon-label {
                color: #000;
            }
        }
    }
}

.is-style-minimal {
    .social-sharing-icon {
        background-color: transparent !important;
        border: none !important;
        padding: 5px !important;
        
        // Only override colors if they haven't been customized
        &:not([style*="color:"]) {
            svg {
                fill: #000;
            }

            .social-sharing-icon-label {
                color: #000;
            }
        }
    }
}

.is-style-one-tone {
    .social-sharing-icon {
        // No background-color override to allow custom colors

        // Don't override SVG fill to respect the icon color set in attributes
    }
} 