// Theme Selector
.theme-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;

    // Theme Item
    .theme-item {
        position: relative;
        border-radius: 10px;
        overflow: hidden;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
        transition: all 0.3s ease;
        cursor: pointer;
        background-color: #fff;

        &:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
        }

        // Active state
        &.active {
            outline: 3px solid #4a6cf7;
            transform: translateY(-5px);

            &::after {
                content: '✓';
                position: absolute;
                top: 10px;
                right: 10px;
                width: 24px;
                height: 24px;
                background-color: #4a6cf7;
                color: white;
                border-radius: 50%;
                display: flex;
                align-items: center;
                justify-content: center;
                font-weight: bold;
                font-size: 14px;
            }
        }

        // Theme thumbnail
        img {
            width: 100%;
            height: auto;
            display: block;
            aspect-ratio: 16/10;
            object-fit: cover;
            border-top-left-radius: 8px;
            border-top-right-radius: 8px;
            transition: transform 0.3s ease;

            &:hover {
                transform: scale(1.03);
            }
        }

        // Theme title
        span {
            display: block;
            padding: 0.75rem;
            text-align: center;
            font-weight: 500;
            color: #343a40;
            background-color: #f8f9fa;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            border-top: 1px solid rgba(0, 0, 0, 0.05);
        }
    }

    // Responsive adjustments
    @media (max-width: 1200px) {
        grid-template-columns: repeat(3, 1fr);
    }

    @media (max-width: 992px) {
        grid-template-columns: repeat(2, 1fr);
    }

    @media (max-width: 576px) {
        grid-template-columns: 1fr;
        gap: 1rem;

        .theme-item {
            max-width: 400px;
            margin: 0 auto;
        }
    }
}

// Add a subtle animation for theme selection
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 108, 247, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(74, 108, 247, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(74, 108, 247, 0);
    }
}

.theme-item.active {
    animation: pulse 1.5s ease-in-out;
}

// Add a smooth hover effect on all theme cards
.theme-selector .theme-item {
    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.03) 100%);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
        z-index: 1;
    }

    &:hover::before {
        opacity: 1;
    }
}

// Optional: Add theme preview on hover
.theme-item {
    position: relative;

    &:hover {
        z-index: 10;
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

// Modern theme tabs styling
.theme-tabs {
    display: flex;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    position: relative;
    overflow: hidden;

    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
        border-radius: 16px;
        pointer-events: none;
    }

    .theme-tab {
        flex: 1;
        padding: 14px 20px;
        background: transparent;
        border: none;
        cursor: pointer;
        font-size: 15px;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.7);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        border-radius: 12px;
        backdrop-filter: blur(10px);
        text-align: center;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;

        &:hover:not(.active) {
            color: rgba(255, 255, 255, 0.9);
            background: rgba(255, 255, 255, 0.1);
            transform: translateY(-2px);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        }

        &.active {
            color: #333;
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            box-shadow:
                0 8px 32px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
            transform: translateY(-3px);

            &::after {
                content: '';
                position: absolute;
                bottom: -2px;
                left: 50%;
                transform: translateX(-50%);
                width: 30px;
                height: 3px;
                background: linear-gradient(90deg, #a177f8, #8b5cf6);
                border-radius: 2px;
            }
        }

        // Icon styling
        &::before {
            content: '';
            display: inline-block;
            width: 18px;
            height: 18px;
            margin-right: 8px;
            vertical-align: middle;
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            filter: brightness(0) invert(1);
            opacity: 0.8;
            transition: all 0.3s ease;
        }

        &.active::before {
            filter: brightness(0) invert(0);
            opacity: 0.6;
        }

        &:first-child::before {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
        }

        &:last-child::before {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm3.5 6L12 10.5 8.5 8 12 5.5 15.5 8zM8.5 16L12 13.5 15.5 16 12 18.5 8.5 16z'/%3E%3C/svg%3E");
        }
    }
}

.theme-content {
    margin-top: 20px;
}

// Custom theme item styling and actions
.theme-item.custom-theme {
    border: 2px dashed #a177f8;

    &::before {
        content: 'CUSTOM';
        position: absolute;
        top: 0px;
        left: 1px;
        background: rgba(161, 119, 248, 0.15);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
        color: #a177f8;
        padding: 4px 8px;
        font-size: 10px;
        font-weight: 600;
        border-radius: 10px;
        border: 1px solid rgba(161, 119, 248, 0.3);
        box-shadow: 0 2px 8px rgba(161, 119, 248, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
        z-index: 2;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

    .custom-theme-actions {
        position: absolute;
        top: 8px;
        right: 8px;
        display: flex;
        gap: 4px;
        opacity: 0;
        transition: all 0.3s ease;
        z-index: 3;

        .edit-custom-theme,
        .delete-custom-theme {
            width: 32px;
            height: 32px;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            font-size: 14px;
            line-height: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            backdrop-filter: blur(20px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            box-shadow:
                0 4px 16px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);

            &:disabled {
                cursor: not-allowed;
                opacity: 0.4;
            }
        }

        .edit-custom-theme {
            background: rgba(40, 167, 69, 0.15);
            color: #28a745;
            border-color: rgba(40, 167, 69, 0.3);

            &:hover:not(:disabled) {
                background: rgba(40, 167, 69, 0.25);
                color: #ffffff;
                transform: scale(1.15) translateY(-2px);
                box-shadow:
                    0 8px 25px rgba(40, 167, 69, 0.3),
                    inset 0 1px 0 rgba(255, 255, 255, 0.3);
            }
        }

        .delete-custom-theme {
            background: rgba(220, 53, 69, 0.15);
            color: #dc3545;
            font-size: 16px;
            border-color: rgba(220, 53, 69, 0.3);

            &:hover:not(:disabled) {
                background: rgba(220, 53, 69, 0.25);
                color: #ffffff;
                transform: scale(1.15) translateY(-2px);
                box-shadow:
                    0 8px 25px rgba(220, 53, 69, 0.3),
                    inset 0 1px 0 rgba(255, 255, 255, 0.3);
            }
        }
    }

    &:hover .custom-theme-actions {
        opacity: 1;
    }
}

// Locked theme styles
.theme-item.locked-theme {
    position: relative;
    cursor: not-allowed;

    &:hover {
        transform: translateY(-2px);
    }

    img.blurred {
        filter: blur(1px);
        // opacity: 0.6;
    }

    .theme-lock-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.3);
        backdrop-filter: blur(1px);
        z-index: 2;

        .pro-badge {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 8px 16px;
            border-radius: 20px;
            font-weight: 600;
            font-size: 14px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            animation: pulse-badge 2s infinite;
        }
    }

    &:hover .theme-lock-overlay {
        background: rgba(0, 0, 0, 0.4);
    }
}

@keyframes pulse-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}