@use '../variables' as *;

.proddisp-layout-selector {

    // Base container with white background
    .proddisp-layout-selection,
    .proddisp-mode-selection {
        // max-width: 1200px;
        margin: 0 auto;
        padding: 2rem;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
        background: #ffffff;
        position: relative;
    }

    .proddisp-header {
        text-align: center;
        margin-bottom: 3rem;
        position: relative;

        // Decorative line above title like old design
        &::before {
            content: '';
            position: absolute;
            top: -20px;
            left: 50%;
            transform: translateX(-50%);
            width: 60px;
            height: 4px;
            background: linear-gradient(90deg, #00f2fe 0%, #4facfe 100%);
            border-radius: 2px;
        }

        .header-actions {
            position: absolute;
            top: 0;
            right: 0;
            display: flex;
            gap: $spacing-sm;

            .button {
                background: #f8f9fa;
                border: 1px solid #dee2e6;
                color: #495057;
                border-radius: 6px;
                padding: 8px 16px;
                font-weight: 500;
                transition: all 0.3s ease;

                &:hover {
                    background: #e9ecef;
                    border-color: #adb5bd;
                    transform: translateY(-1px);
                    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
                }
            }
        }

        h1 {
            color: #2d3748;
            font-size: 2.5rem;
            font-weight: 700;
            margin: 0 0 1rem 0;
            letter-spacing: -0.5px;
        }

        p {
            color: #718096;
            font-size: 1.1rem;
            font-weight: 400;
            max-width: 600px;
            margin: 0 auto;
            line-height: 1.6;
        }
    }

    .proddisp-layout-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 2rem;
        padding: 0;
    }

    // Vertical layout for mode selection - different from layout selection
    .proddisp-mode-grid {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        padding: 0;
        // max-width: 800px;
        margin: 0 auto;
    }

    .proddisp-layout-card {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        border-radius: 20px;
        padding: 2.5rem 2rem;
        text-align: center;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        position: relative;
        overflow: hidden;

        // Animated top border
        &::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
            background-size: 200% 100%;
            animation: shimmer 3s ease-in-out infinite;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        &:hover {
            transform: translateY(-10px) scale(1.02);
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
            background: rgba(255, 255, 255, 1);

            &::before {
                opacity: 1;
            }

            .proddisp-layout-icon {
                transform: scale(1.1);
                box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);

                &::before {
                    transform: translateX(100%);
                }
            }

            .button {
                transform: translateY(-2px);
                box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
                background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);

                &::before {
                    left: 100%;
                }
            }
        }

        &.pro-feature {
            opacity: 0.7;

            &::after {
                content: 'PRO';
                position: absolute;
                top: 10px;
                right: 10px;
                background: #f1b600;
                color: white;
                padding: 4px 8px;
                border-radius: 12px;
                font-size: 11px;
                font-weight: 600;
            }
        }

        .proddisp-layout-icon {
            width: 80px;
            height: 80px;
            margin: 0 auto 1.5rem;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;

            // Shine effect
            &::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
                transform: translateX(-100%);
                transition: transform 0.6s ease;
            }

            .dashicons {
                font-size: 2rem;
                color: #ffffff;
                width: auto;
                height: auto;
            }
        }

        h3 {
            color: #2d3748;
            font-size: 1.4rem;
            font-weight: 600;
            margin: 0 0 1rem 0;
            letter-spacing: -0.3px;
        }

        p {
            color: #718096;
            font-size: 0.95rem;
            line-height: 1.6;
            margin: 0 0 2rem 0;
            font-weight: 400;
        }

        .button {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            color: #ffffff;
            padding: 12px 30px;
            border-radius: 50px;
            font-weight: 500;
            font-size: 0.95rem;
            text-decoration: none;
            display: inline-block;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
            position: relative;
            overflow: hidden;
            min-width: 140px;

            // Shine effect on button
            &::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
                transition: left 0.5s ease;
            }

            &:active {
                transform: translateY(0);
            }
        }

        // Animation delays for staggered entrance
        &:nth-child(1) {
            animation: fadeInUp 0.6s ease forwards;
            animation-delay: 0.1s;
        }

        &:nth-child(2) {
            animation: fadeInUp 0.6s ease forwards;
            animation-delay: 0.2s;
        }

        &:nth-child(3) {
            animation: fadeInUp 0.6s ease forwards;
            animation-delay: 0.3s;
        }

        &:nth-child(4) {
            animation: fadeInUp 0.6s ease forwards;
            animation-delay: 0.4s;
        }
    }

    .proddisp-mode-card {
        background: $white;
        border: 1px solid $border-color;
        border-radius: $border-radius-lg;
        padding: $spacing-lg;
        transition: all 0.3s ease;
        position: relative;
        display: flex;
        flex-direction: column;
        gap: $spacing-lg;

        &:hover {
            border-color: #2271b1;
            box-shadow: $shadow-md;
        }

        &.pro-feature {
            opacity: 0.7;

            &::after {
                content: 'PRO';
                position: absolute;
                top: 15px;
                right: 15px;
                background: #f1b600;
                color: white;
                padding: 6px 12px;
                border-radius: 12px;
                font-size: 12px;
                font-weight: 600;
                z-index: 2;
            }
        }



        .proddisp-style-preview {
            width: 70%;
            height: 515px;
            border-radius: $border-radius;
            overflow: hidden;
            border: 1px solid $border-color;
            background: white;
            margin: auto;
        }

        .preview-placeholder {
            height: 100%;
            background: $background-light;
            border: 1px dashed $border-color;
            border-radius: $border-radius;
            display: flex;
            align-items: center;
            justify-content: center;
            color: $text-light;
            font-size: 14px;

            &.pro-preview {
                background: linear-gradient(135deg, #f1b600, #f39c12);
                color: white;
                border: none;

                .dashicons {
                    margin-right: $spacing-xs;
                }
            }
        }

        .preview-loading {
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: $background-light;
            color: $text-light;
            font-size: 14px;

            .spinner {
                width: 20px;
                height: 20px;
                border: 2px solid #f3f3f3;
                border-top: 2px solid #2271b1;
                border-radius: 50%;
                animation: spin 1s linear infinite;
                margin-bottom: $spacing-xs;
            }
        }

        .preview-content {
            height: 100%;
            overflow: hidden;
            background: white;

            // Scale down the preview content to fit
            .wcps-container {
                transform: scale(0.9); // Reduces to 60% of original size
                transform-origin: center center; // Scales from the center (default)
                justify-content: center;
                align-items: center;
                display: flex;
            }
        }

        .proddisp-mode-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;

            h3 {
                font-size: 22px;
                font-weight: 600;
                color: $text-color;
                margin-bottom: $spacing-md;
            }

            .proddisp-name-input {
                width: 100%;
                max-width: 400px;
                margin-bottom: $spacing-lg;

                label {
                    display: block;
                    margin-bottom: $spacing-xs;
                    font-weight: 600;
                    color: $text-color;
                    font-size: 14px;
                    text-align: left;
                }

                input {
                    width: 100%;
                    padding: 10px 14px;
                    border: 1px solid $border-color;
                    border-radius: $border-radius;
                    font-size: 14px;

                    &:focus {
                        border-color: #2271b1;
                        outline: none;
                        box-shadow: 0 0 0 1px #2271b1;
                    }

                    &:disabled {
                        background: #f6f7f7;
                        color: #a7aaad;
                    }
                }

                .description {
                    font-size: 13px;
                    color: $text-light;
                    margin-top: $spacing-xs;
                    margin-bottom: 0;
                    line-height: 1.4;
                    text-align: left;
                }
            }

            .button {
                background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                border: none;
                color: #ffffff;
                padding: 12px 30px;
                border-radius: 50px;
                font-weight: 500;
                font-size: 0.95rem;
                text-decoration: none;
                display: inline-block;
                transition: all 0.3s ease;
                box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
                position: relative;
                overflow: hidden;
                min-width: 140px;

                &:hover {
                    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                    border-color: #2271b1;
                    transform: translateY(-1px);
                    box-shadow: 0 4px 10px rgba(74, 108, 247, 0.25);
                }
                
            }
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }
    }

    // Animations
    @keyframes shimmer {
        0% {
            background-position: -200% 0;
        }

        100% {
            background-position: 200% 0;
        }
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes spin {
        0% {
            transform: rotate(0deg);
        }

        100% {
            transform: rotate(360deg);
        }
    }

    // Responsive Design
    @media (max-width: 768px) {

        .proddisp-layout-selection,
        .proddisp-mode-selection {
            padding: 1.5rem 1rem;
        }

        .proddisp-header {
            h1 {
                font-size: 2rem;
            }

            p {
                font-size: 1rem;
            }

            .header-actions {
                position: static;
                justify-content: center;
                margin-bottom: 1rem;
            }
        }

        .proddisp-layout-grid {
            grid-template-columns: 1fr;
            gap: 1.5rem;
        }

        .proddisp-mode-grid {
            gap: 1rem;
        }

        .proddisp-layout-card {
            padding: 2rem 1.5rem;
        }

        .proddisp-mode-card {
            flex-direction: column;
            text-align: center;
            padding: 1.5rem;

            .proddisp-style-preview {
                width: 100%;
                height: 180px;
                margin-bottom: 1rem;
            }

            .proddisp-mode-content {
                text-align: center;

                .button {
                    align-self: center;
                }
            }
        }

        .proddisp-layout-icon {
            width: 70px;
            height: 70px;

            .dashicons {
                font-size: 1.8rem;
            }
        }
    }

    @media (max-width: 480px) {

        .proddisp-layout-selection,
        .proddisp-mode-selection {
            padding: 1rem;
        }

        .proddisp-header {
            h1 {
                font-size: 1.8rem;
            }
        }

        .proddisp-layout-card {
            padding: 1.5rem 1rem;
        }

        .proddisp-mode-card {
            padding: 1rem;

            .proddisp-style-preview {
                height: 150px;
            }
        }

        .proddisp-layout-icon {
            width: 60px;
            height: 60px;

            .dashicons {
                font-size: 1.5rem;
            }
        }
    }

    // Dark mode support
    @media (prefers-color-scheme: dark) {

        .proddisp-layout-card,
        .proddisp-mode-card {
            background: rgba(26, 32, 44, 0.95);
            border: 1px solid rgba(255, 255, 255, 0.1);

            &:hover {
                background: rgba(26, 32, 44, 1);
            }
        }
    }
}