// Preview Panel Styles
.proddisp-preview-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--editor-bg-primary);

    .preview-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.5rem 2rem;
        border-bottom: 1px solid var(--editor-border);
        background: linear-gradient(135deg, var(--editor-bg-secondary) 0%, var(--editor-bg-tertiary) 100%);

        .preview-title {
            display: flex;
            flex-direction: column;
            gap: 0.25rem;

            h3 {
                margin: 0;
                font-size: 1.125rem;
                font-weight: 700;
                color: var(--editor-text-primary);
                display: flex;
                align-items: center;
                gap: 0.5rem;
            }

            .preview-subtitle {
                font-size: 0.75rem;
                color: var(--editor-text-secondary);
                font-weight: 500;
            }
        }

        .preview-controls {
            display: flex;
            align-items: center;
            gap: 1rem;

            .device-selector {
                display: flex;
                background: var(--editor-bg-primary);
                border: 1px solid var(--editor-border);
                border-radius: var(--editor-radius-lg);
                padding: 0.25rem;
                box-shadow: var(--editor-shadow-sm);

                .device-btn {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    width: 2.5rem;
                    height: 2.5rem;
                    border: none;
                    background: transparent;
                    border-radius: var(--editor-radius-md);
                    cursor: pointer;
                    transition: var(--editor-transition);
                    font-size: 1.125rem;
                    color: var(--editor-text-secondary);

                    &:hover {
                        background: var(--editor-bg-secondary);
                        color: var(--editor-primary);
                        transform: scale(1.05);
                    }

                    &.active {
                        background: var(--editor-primary);
                        color: white;
                        box-shadow: var(--editor-shadow-md);
                    }
                }
            }

            .refresh-preview {
                display: flex;
                align-items: center;
                justify-content: center;
                width: 2.5rem;
                height: 2.5rem;
                border: 1px solid var(--editor-border);
                background: var(--editor-bg-primary);
                border-radius: var(--editor-radius-md);
                cursor: pointer;
                transition: var(--editor-transition);
                font-size: 1.125rem;
                color: var(--editor-text-secondary);
                box-shadow: var(--editor-shadow-sm);

                &:hover:not(:disabled) {
                    background: var(--editor-secondary);
                    color: white;
                    border-color: var(--editor-secondary);
                    transform: scale(1.05);
                    box-shadow: var(--editor-shadow-md);
                }

                &:disabled {
                    opacity: 0.6;
                    cursor: not-allowed;
                    animation: spin 1s linear infinite;
                }
            }
        }
    }

    .preview-content {
        flex: 1;
        padding: 1.5rem;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);

        .preview-frame {
            width: 100%;
            height: 100%;
            border-radius: var(--editor-radius-lg);
            overflow: hidden;
            box-shadow: var(--editor-shadow-xl);
            background: white;
            transition: var(--editor-transition);

            &.preview-desktop {
                max-width: 100%;
                max-height: 100%;
            }

            &.preview-tablet {
                max-width: 768px;
                max-height: 1024px;
                aspect-ratio: 3/4;
            }

            &.preview-mobile {
                max-width: 375px;
                max-height: 667px;
                aspect-ratio: 9/16;
            }

            .preview-loading {
                display: flex;
                align-items: center;
                justify-content: center;
                height: 100%;
                background: var(--editor-bg-secondary);

                .loading-content {
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    gap: 1rem;
                    color: var(--editor-text-secondary);

                    .spinning {
                        font-size: 2rem;
                        animation: spin 1s linear infinite;
                    }

                    p {
                        margin: 0;
                        font-size: 0.875rem;
                        font-weight: 500;
                    }
                }
            }

            .preview-html {
                width: 100%;
                height: 100%;
                overflow: auto;
                padding: 1rem;

                // Custom scrollbar
                &::-webkit-scrollbar {
                    width: 8px;
                }

                &::-webkit-scrollbar-track {
                    background: var(--editor-bg-secondary);
                    border-radius: 4px;
                }

                &::-webkit-scrollbar-thumb {
                    background: var(--editor-border-dark);
                    border-radius: 4px;

                    &:hover {
                        background: var(--editor-text-muted);
                    }
                }
            }

            .preview-placeholder {
                display: flex;
                align-items: center;
                justify-content: center;
                height: 100%;
                background: var(--editor-bg-secondary);

                .placeholder-content {
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    gap: 1rem;
                    color: var(--editor-text-muted);
                    text-align: center;
                    padding: 2rem;

                    .dashicons {
                        font-size: 3rem;
                        opacity: 0.5;
                    }

                    p {
                        margin: 0;
                        font-size: 0.875rem;
                        font-weight: 500;
                        max-width: 200px;
                        line-height: 1.5;
                    }
                }
            }
        }
    }

    .preview-footer {
        padding: 1.5rem 2rem;
        border-top: 1px solid var(--editor-border);
        background: var(--editor-bg-secondary);

        .shortcode-section {
            .shortcode-header {
                display: flex;
                align-items: center;
                gap: 0.5rem;
                margin-bottom: 0.75rem;

                .shortcode-icon {
                    font-size: 1rem;
                }

                label {
                    font-size: 0.875rem;
                    font-weight: 600;
                    color: var(--editor-text-primary);
                    margin: 0;
                }
            }

            .shortcode-container {
                display: flex;
                gap: 0.75rem;

                .shortcode-input {
                    flex: 1;
                    padding: 0.75rem 1rem;
                    border: 1px solid var(--editor-border);
                    border-radius: var(--editor-radius-md);
                    background: var(--editor-bg-primary);
                    font-family: 'JetBrains Mono', 'Fira Code', monospace;
                    font-size: 0.8125rem;
                    font-weight: 500;
                    color: var(--editor-primary);
                    user-select: all;
                    transition: var(--editor-transition);

                    &:focus {
                        outline: none;
                        border-color: var(--editor-primary);
                        box-shadow: 0 0 0 3px var(--editor-primary-light);
                    }
                }

                .copy-shortcode-button {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    width: 2.75rem;
                    height: 2.75rem;
                    border: 1px solid var(--editor-border);
                    background: var(--editor-primary);
                    color: white;
                    border-radius: var(--editor-radius-md);
                    cursor: pointer;
                    transition: var(--editor-transition);
                    font-size: 1rem;
                    box-shadow: var(--editor-shadow-sm);

                    &:hover {
                        background: var(--editor-primary-hover);
                        transform: scale(1.05);
                        box-shadow: var(--editor-shadow-md);
                    }

                    &:active {
                        transform: scale(0.95);
                    }
                }
            }
        }
    }
}

// Animations
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

// Responsive Design
@media (max-width: 768px) {
    .proddisp-preview-panel {
        .preview-header {
            padding: 1rem 1.5rem;
            flex-direction: column;
            gap: 1rem;
            align-items: stretch;

            .preview-title {
                text-align: center;
            }

            .preview-controls {
                justify-content: center;
            }
        }

        .preview-content {
            padding: 1rem;

            .preview-frame {
                &.preview-tablet,
                &.preview-mobile {
                    max-width: 100%;
                    height: 400px;
                }
            }
        }

        .preview-footer {
            padding: 1rem 1.5rem;

            .shortcode-section {
                .shortcode-container {
                    flex-direction: column;
                    gap: 0.5rem;

                    .copy-shortcode-button {
                        width: 100%;
                        height: 2.5rem;
                    }
                }
            }
        }
    }
}