/* styleselection.css - Styles specific to the style selection page */
/* Style selection page */
.style-selection-container {
    height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
}

/* Override Bootstrap's negative margins on content-row */
.content-row.row {
    margin-left: 0;
    margin-right: 0;
}

/* Content row - default is horizontal layout for landscape */
.content-row {
    display: flex;
    flex-direction: row;
    height: 100%;
    flex: 1;
}

/* Style Selection - Styles Column */
.styles-column {
    background-color: #f0f0f0;
    padding: 15px;
    height: 100%;
    /* Let Bootstrap handle the width */
}

/* Style column headers */
.styles-column h5 {
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.styles-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    max-height: calc(100vh - 150px);
    padding: 10px 5px;
}

/* Update themes grid layout to fill remaining space */
.themes-column {
    flex: 1;
    padding: 15px;
    height: 100%;
    overflow-y: auto;
}

.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* Fixed height text area */
.style-item .style-name {
    padding: 10px 8px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    height: 50px; /* Default height for portrait mode */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    flex: 0 0 auto;
    overflow: hidden;
    line-height: 1.2;
}

/* Portrait Mode - Specifically when width < height */
@media (orientation: portrait) {
    /* Change content row to vertical in portrait mode */
    .content-row {
        flex-direction: column;
        height: auto;
    }

    /* Styles column becomes horizontal across the top in portrait */
    .styles-column {
        height: auto;
        width: 100%;
        padding: 10px;
        flex: 0 0 auto;
    }

    /* Make styles list horizontal in portrait with exactly 3 items per row */
    .styles-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr); /* Exactly 3 columns */
        gap: 10px;
        width: 100%;
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 5px;
    }

    /* Style items in portrait take up exactly 1/3 of the available width */
    .style-item {
        width: 100%;
        margin: 0 auto;
        flex: 0 0 auto;
    }

    /* Themes column fills remaining space */
    .themes-column {
        height: auto;
        flex: 1;
        padding: 10px;
        width: 100%;
    }

    /* Adjust themes grid for smaller screen width */
    .themes-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Landscape Mode - Specifically when width >= height */
@media (orientation: landscape) {
    /* Content row remains horizontal (default) */
    .content-row {
        flex-direction: row;
    }

    /* Styles list remains vertical */
    .styles-list {
        flex-direction: column;
        display: flex;
    }

    /* Reduce style name height in landscape mode for all screen sizes */
    .style-item .style-name {
        height: 35px !important; /* Force priority */
        padding: 5px 8px;
    }
}

@media (orientation: landscape) and (max-width: 767px) {
    .styles-column {
        flex: 0 0 auto;
        width: auto;
    }
}

/* Adjustments for small height landscape mode (phone landscape) */
@media (orientation: landscape) and (max-height: 600px) {
    /* Adjust styles list to be more compact */
    .styles-list {
        gap: 6px; /* Reduced gap */
        padding: 5px 3px;
    }

    /* Reduce padding on styles column */
    .styles-column {
        padding: 8px 5px;
    }

    /* Make the style-item narrower */
    .style-item {
        max-width: 120px; /* Limit maximum width */
    }

    /* Make style thumbnail container smaller in height */
    .style-thumbnail-container {
        padding-bottom: 70%; /* Reduced aspect ratio */
    }

    /* Make style name area more compact */
    .style-item .style-name {
        height: 25px !important; /* Force priority */
        padding: 2px 4px;
        font-size: 12px;
        min-height: auto;
    }

    /* Adjust column header text for smaller width */
    .styles-column h5 {
        font-size: 0.9rem;
        text-align: center;
        margin-bottom: 5px;
    }
}

/* Extra small landscape screens (very small phones) */
@media (orientation: landscape) and (max-height: 450px) {
    /* Make styles list even more compact */
    .styles-list {
        gap: 4px;
    }

    /* Further reduce padding */
    .styles-column {
        padding: 5px 3px;
    }

    /* Make the style-item even narrower */
    .style-item {
        max-width: 100px; /* Even smaller max width */
    }

    /* Even smaller thumbnail container */
    .style-thumbnail-container {
        padding-bottom: 60%; /* Even more reduced aspect ratio */
    }

    /* Further reduce style name area */
    .style-item .style-name {
        height: 20px !important; /* Force priority */
        padding: 1px;
        font-size: 10px;
        line-height: 1;
    }

    /* Further adjust column header for very small screens */
    .styles-column h5 {
        font-size: 0.8rem;
        margin-bottom: 3px;
    }

    /* For extremely small screens, you can use an abbreviated header */
    .styles-column h5 {
        /* Create a shortened version of the header text */
        display: flex;
        flex-direction: column;
    }

    /* Add a class to be used in HTML for small screens */
    .styles-column .header-full {
        display: none; /* Hide the full header text */
    }

    .styles-column .header-short {
        display: block; /* Show abbreviated version */
    }
}

.style-item {
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    width: 100%; /* Fill parent container */
    max-width: 180px; /* Default max width */
    margin: 0 auto; /* Center in container */
    flex: 0 0 auto;
}

.style-item:hover {
    transform: translateY(-2px);
}

/* Hide/show abbreviated header versions by default */
.header-short {
    display: none;
}

.header-full {
    display: block;
}

/* Force a perfect square for images */
.style-thumbnail-container {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Create a square using aspect ratio hack */
    overflow: hidden;
    background-color: #f0f0f0; /* Background color in case image fails to load */
}

.style-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.theme-item {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
}

.theme-item:hover {
    transform: translateY(-3px);
}

.theme-thumbnail {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.theme-name {
    padding: 10px;
    text-align: center;
    font-weight: 500;
}

/* Define keyframes for selection outline animations */
@keyframes outlineAppear {
    from {
        opacity: 0;
        transform: scale(1.05);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes outlineFade {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(1.05);
    }
}

/* Base selection outline style (common to both style and theme items) */
.selection-outline {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid #6200ee;
    border-radius: 4px;
    pointer-events: none;
    animation: outlineAppear 0.25s ease-out forwards;
    z-index: 1; /* Ensure it's above the item but below any text or controls */
}

/* Fade out animation class - will be added dynamically via JS */
.selection-outline-fade {
    animation: outlineFade 0.25s ease-out forwards;
}

/* Style item selection specific */
.style-item .selection-outline {
    border-radius: 4px; /* Match style item border radius */
}

/* Theme item selection specific */
.theme-item .selection-outline {
    border-radius: 8px; /* Match theme item border radius */
}

/* Give the item a slight effect when selected */
.style-item.selected, .theme-item.selected {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* When item is selected and hovered, enhance the effect slightly */
.style-item.selected:hover, .theme-item.selected:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

/* Reduce selection effects for small screens to save space */
@media (orientation: landscape) and (max-height: 600px) {
    .style-item.selected, .style-item:hover,
    .style-item.selected:hover {
        transform: translateY(-1px);
    }

    .selection-outline {
        border-width: 2px;
    }
}

/* Fixed Process Button Styling */
.process-button-container {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    margin-top: 15px;
}

#btnProcess {
    background-color: #4CAF50; /* Same green as take photo button for consistency */
    color: white;
    font-weight: 600;
    padding: 12px 20px;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
    font-size: 1.2rem;
    position: relative;
    overflow: hidden;
}

#btnProcess:hover:not(:disabled) {
    background-color: #43A047; /* Slightly darker green on hover */
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

#btnProcess:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

#btnProcess:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    box-shadow: none;
}

/* Smaller process button for small screens */
@media (orientation: landscape) and (max-height: 450px) {
    .process-button-container {
        padding: 8px;
    }

    #btnProcess {
        padding: 8px 16px;
        font-size: 1rem;
    }
}

/* Add a pulsing animation when both style and theme are selected */
@keyframes processButtonPulse {
    0% {
        box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 4px 15px rgba(76, 175, 80, 0.5);
    }
    100% {
        box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
    }
}

#btnProcess:not(:disabled) {
    animation: processButtonPulse 2s infinite ease-in-out;
}

/* Attention flash animation for the Process button */
@keyframes attentionFlash {
    0%, 100% {
        transform: scale(1);
        background-color: #4CAF50;
    }
    50% {
        transform: scale(1.05);
        background-color: #43A047;
    }
}

.attention-flash {
    animation: attentionFlash 0.5s ease-in-out;
}

/* Handle narrow screens with adjusted spacing */
@media (orientation: portrait) and (max-width: 400px) {
    .styles-list {
        gap: 5px;
        padding: 2px;
    }

    .style-item .style-name {
        font-size: 12px;
        padding: 5px;
        height: 40px;
    }
}

@media (orientation: landscape) and (max-width: 991px) {
    /* Styles column fix */
    .styles-column {
        flex: 0 0 auto;
        width: auto;
    }

    /* Reduce heading size and remove bottom margin */
    .themes-column h5, .styles-column h5 {
        font-size: 1rem;
        margin-bottom: 5px;
        padding: 5px 0;
    }

    /* Reduce padding on the theme column */
    .themes-column {
        padding: 8px;
    }

    /* Optimize theme grid for vertical space with 4 items per row */
    .themes-grid {
        max-height: 78vh; /* Limit height and enable scrolling */
        overflow-y: auto;
        padding: 5px;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start; /* Align items to start */
        align-content: flex-start;
        gap: 8px; /* Consistent gap for cleaner layout */
    }

    /* Resize theme items to fit 4 per row */
    .theme-item {
        width: calc((100% - 24px) / 4); /* Four items per row with 8px gap */
        margin-bottom: 8px; /* Space between rows */
        margin-right: 0; /* Remove any default right margin */
    }

    /* Ensure images scale proportionally */
    .theme-item img.theme-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 1; /* Maintain square aspect ratio */
    }

    /* Make theme name smaller but still readable */
    .theme-name {
        font-size: 0.8rem;
        margin-top: 3px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Ensure selection outline is visible but not too large */
    .theme-item .selection-outline {
        border-width: 2px;
    }

    /* For smaller screens within this range, make further adjustments */
    @media (max-width: 767px) {
        /* Even more compact layout for smaller screens */
        .themes-column h5, .styles-column h5 {
            font-size: 0.9rem;
            margin-bottom: 0;
        }

        .themes-column {
            padding: 5px;
        }

        .themes-grid {
            padding: 4px;
            gap: 6px;
            max-height: 75vh;
        }

        .theme-item {
            width: calc((100% - 18px) / 4); /* Four items per row with 6px gap */
            margin-bottom: 6px;
        }

        .theme-name {
            font-size: 0.7rem;
            margin-top: 2px;
        }
    }

    /* For very short screens (like iPhone in landscape) */
    @media (max-height: 450px) {
        .themes-grid {
            max-height: 65vh; /* Take less vertical space */
        }

        .theme-name {
            font-size: 0.65rem; /* Even smaller font */
        }

        .themes-column h5, .styles-column h5 {
            font-size: 0.85rem;
        }
    }
}

/* Visual filter for selected items - applying effects to theme-item parent */

/* Base styles for thumbnails - needed for proper transitions */
.style-thumbnail-container,
.theme-item {
    position: relative;
    overflow: hidden;
}

/* Make sure theme-thumbnail maintains relative positioning for proper scaling */
.theme-thumbnail {
    position: relative;
    display: block;
    z-index: 1;
}

/* Overlay effect for selected style items */
.style-item.selected .style-thumbnail-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(98, 0, 238, 0.4), rgba(98, 0, 238, 0.1));
    pointer-events: none;
    z-index: 2;
    opacity: 0; /* Start invisible for appear animation */
    animation: filterAppear 0.3s forwards ease-out;
}

/* Overlay effect for selected theme items - on the parent item */
.theme-item.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    /* Only cover the image area, not the text */
    bottom: 30px; /* Adjust based on your theme-name height */
    background: linear-gradient(135deg, rgba(98, 0, 238, 0.4), rgba(98, 0, 238, 0.1));
    pointer-events: none;
    z-index: 2;
    opacity: 0; /* Start invisible for appear animation */
    animation: filterAppear 0.3s forwards ease-out;
    border-radius: 8px 8px 0 0; /* Match the top corners of theme-item */
}

/* Appear animation - from no filter to applied filter */
@keyframes filterAppear {
    0% {
        opacity: 0;
        background: linear-gradient(135deg, rgba(98, 0, 238, 0), rgba(98, 0, 238, 0));
    }
    100% {
        opacity: 1;
        background: linear-gradient(135deg, rgba(98, 0, 238, 0.4), rgba(98, 0, 238, 0.1));
    }
}

/* Separate idle pulse animation that starts after appear completes - STYLE */
.style-item.selected:not(.removing-selection) .style-thumbnail-container::after {
    animation: filterAppear 0.3s forwards ease-out, filterPulse 2s infinite alternate ease-in-out 0.3s;
}

/* Separate idle pulse animation that starts after appear completes - THEME */
.theme-item.selected:not(.removing-selection)::after {
    animation: filterAppear 0.3s forwards ease-out, filterPulse 2s infinite alternate ease-in-out 0.3s;
}

/* Idle state - pulse between applied filter and stronger filter */
@keyframes filterPulse {
    0% {
        background: linear-gradient(135deg, rgba(98, 0, 238, 0.4), rgba(98, 0, 238, 0.1));
    }
    100% {
        background: linear-gradient(135deg, rgba(98, 0, 238, 0.6), rgba(98, 0, 238, 0.2));
    }
}

/* Image enhancement for selected style items - BASE STYLES */
.style-item.selected .style-thumbnail {
    filter: brightness(1.1) contrast(1.1) saturate(1.1); /* Base filter */
    transform: scale(1); /* Base scale */
    transition: filter 0.3s ease, transform 0.3s ease;
}

/* Image enhancement for selected theme items - BASE STYLES */
.theme-item.selected .theme-thumbnail {
    filter: brightness(1.1) contrast(1.1) saturate(1.1); /* Base filter */
    transform: scale(1); /* Base scale */
    transition: filter 0.3s ease, transform 0.3s ease;
}

/* Combined scale and filter animation - STYLE ITEMS */
.style-item.selected:not(.removing-selection) .style-thumbnail {
    animation: selectedImageEnhance 2s infinite alternate ease-in-out 0.3s;
}

/* Combined scale and filter animation - THEME ITEMS */
.theme-item.selected:not(.removing-selection) .theme-thumbnail {
    animation: selectedImageEnhance 2s infinite alternate ease-in-out 0.3s;
}

/* Combined enhancement animation for both scale and filter */
@keyframes selectedImageEnhance {
    0% {
        transform: scale(1);
        filter: brightness(1.1) contrast(1.1) saturate(1.1);
    }
    100% {
        transform: scale(1.03); /* Keeping the scale effect as requested */
        filter: brightness(1.2) contrast(1.15) saturate(1.2);
    }
}

/* Add a selection shine effect that moves across the image - STYLE */
.style-item.selected .style-thumbnail-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
            to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.2) 50%, /* Stronger shine */
            rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shineSweep 3s infinite linear;
    z-index: 3;
    pointer-events: none;
}

/* Fixed shine effect for theme items */
.theme-item.selected::before {
    content: '';
    position: absolute;
    top: -100%; /* Increased from -50% to ensure full coverage */
    left: -100%; /* Increased from -50% to ensure full coverage */
    width: 300%; /* Increased from 200% to ensure full coverage */
    height: 300%; /* Increased from 100% to cover the entire image area */
    background: linear-gradient(
            to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shineSweep 3s infinite linear;
    z-index: 3;
    pointer-events: none;
    /* Clip to image area only */
    clip-path: inset(0 0 30px 0); /* Clip the bottom to avoid overlapping text */
}

@keyframes shineSweep {
    0% {
        transform: rotate(30deg) translateX(-100%);
    }
    100% {
        transform: rotate(30deg) translateX(100%);
    }
}

/* Animation for removing selection effect - STYLE */
.style-item.selected.removing-selection .style-thumbnail-container::after {
    animation: filterDisappear 0.3s forwards ease-out !important;
}

/* Animation for removing selection effect - THEME */
.theme-item.selected.removing-selection::after {
    animation: filterDisappear 0.3s forwards ease-out !important;
}

@keyframes filterDisappear {
    0% {
        opacity: 1;
        background: linear-gradient(135deg, rgba(98, 0, 238, 0.4), rgba(98, 0, 238, 0.1));
    }
    100% {
        opacity: 0;
        background: linear-gradient(135deg, rgba(98, 0, 238, 0), rgba(98, 0, 238, 0));
    }
}

/* Reset the image enhancements when deselecting */
.style-item.selected.removing-selection .style-thumbnail,
.theme-item.selected.removing-selection .theme-thumbnail {
    animation: none !important;
    transform: scale(1);
    filter: brightness(1) contrast(1) saturate(1);
    transition: transform 0.3s ease, filter 0.3s ease;
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    /* Style items accessibility */
    .style-item.selected .style-thumbnail-container::after,
    .style-item.selected .style-thumbnail-container::before,
    .style-item.selected .style-thumbnail {
        animation: none;
        opacity: 1;
        background: linear-gradient(135deg, rgba(98, 0, 238, 0.4), rgba(98, 0, 238, 0.1));
        filter: brightness(1.1) contrast(1.1) saturate(1.1);
        transform: scale(1);
    }

    /* Theme items accessibility */
    .theme-item.selected::after,
    .theme-item.selected::before,
    .theme-item.selected .theme-thumbnail {
        animation: none;
        opacity: 1;
        background: linear-gradient(135deg, rgba(98, 0, 238, 0.4), rgba(98, 0, 238, 0.1));
        filter: brightness(1.1) contrast(1.1) saturate(1.1);
        transform: scale(1);
    }
}

/* Visual filter for selected items - using consistent structure */

/* Add these styles for the theme thumbnail container */
.theme-thumbnail-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

/* Keep aspect ratio consistent */
.theme-thumbnail {
    width: 100%;
    height: auto;
    display: block;
}

/* Overlay effect for both style and theme items */
.style-item.selected .style-thumbnail-container::after,
.theme-item.selected .theme-thumbnail-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(98, 0, 238, 0.4), rgba(98, 0, 238, 0.1));
    pointer-events: none;
    z-index: 2;
    opacity: 0; /* Start invisible for appear animation */
    animation: filterAppear 0.3s forwards ease-out;
}

/* Animation for both item types */
.style-item.selected:not(.removing-selection) .style-thumbnail-container::after,
.theme-item.selected:not(.removing-selection) .theme-thumbnail-container::after {
    animation: filterAppear 0.3s forwards ease-out, filterPulse 2s infinite alternate ease-in-out 0.3s;
}

/* Shine effect for both item types */
.style-item.selected .style-thumbnail-container::before,
.theme-item.selected .theme-thumbnail-container::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: linear-gradient(
            to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shineSweep 3s infinite linear;
    z-index: 3;
    pointer-events: none;
}

/* Simplified animation sequence without separate appear effect */

/* Base styles for thumbnail containers */
.style-thumbnail-container,
.theme-thumbnail-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

/* Keep theme thumbnails contained properly */
.theme-thumbnail {
    width: 100%;
    height: auto;
    display: block;
}

/* REMOVE any previous animation or effects applied directly to theme-item */
.theme-item.selected::before,
.theme-item.selected::after {
    content: none !important; /* Override existing rules */
    display: none !important; /* Ensure they don't appear */
    animation: none !important; /* Stop any animations */
}

/* Overlay effect for both item types - simplified with single animation */
.style-item.selected .style-thumbnail-container::after,
.theme-item.selected .theme-thumbnail-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(98, 0, 238, 0.4), rgba(98, 0, 238, 0.1));
    pointer-events: none;
    z-index: 2;
    opacity: 1; /* Start visible immediately */
    /* Single animation for pulsing effect */
    animation: filterPulse 2s infinite alternate ease-in-out;
}

/* Simplified pulse animation */
@keyframes filterPulse {
    0% {
        background: linear-gradient(135deg, rgba(98, 0, 238, 0.4), rgba(98, 0, 238, 0.1));
        opacity: 0.9;
    }
    100% {
        background: linear-gradient(135deg, rgba(98, 0, 238, 0.6), rgba(98, 0, 238, 0.2));
        opacity: 1;
    }
}

/* Shine effect for both item types */
.style-item.selected .style-thumbnail-container::before,
.theme-item.selected .theme-thumbnail-container::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: linear-gradient(
            to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shineSweep 3s infinite linear;
    z-index: 3;
    pointer-events: none;
}

@keyframes shineSweep {
    0% {
        transform: rotate(30deg) translateX(-100%);
    }
    100% {
        transform: rotate(30deg) translateX(100%);
    }
}

/* Animation for removing selection effect - simple fade out */
.style-item.selected.removing-selection .style-thumbnail-container::after,
.theme-item.selected.removing-selection .theme-thumbnail-container::after {
    animation: none !important; /* Stop any running animations */
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

/* Ensure images still get scale effects */
.style-item.selected .style-thumbnail,
.theme-item.selected .theme-thumbnail {
    filter: brightness(1.1) contrast(1.1) saturate(1.1);
    transform: scale(1);
    transition: filter 0.3s ease, transform 0.3s ease;
}

/* Animation for thumbnails */
.style-item.selected:not(.removing-selection) .style-thumbnail,
.theme-item.selected:not(.removing-selection) .theme-thumbnail {
    animation: selectedImageEnhance 2s infinite alternate ease-in-out;
}

/* Combined enhancement animation for both scale and filter */
@keyframes selectedImageEnhance {
    0% {
        transform: scale(1);
        filter: brightness(1.1) contrast(1.1) saturate(1.1);
    }
    100% {
        transform: scale(1.03); /* Keeping the scale effect as requested */
        filter: brightness(1.2) contrast(1.15) saturate(1.2);
    }
}

/* Reset the image enhancements when deselecting */
.style-item.selected.removing-selection .style-thumbnail,
.theme-item.selected.removing-selection .theme-thumbnail {
    animation: none !important;
    transform: scale(1);
    filter: brightness(1) contrast(1) saturate(1);
    transition: transform 0.3s ease, filter 0.3s ease;
}

/* Enhanced styles for the Generate Image button */

/* Base button styling */
#btnProcess {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

/* Button enhancement when enabled */
#btnProcess:not(:disabled) {
    /* More pronounced shadow */
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);

    /* Add pulsing glow animation */
    animation: buttonGlow 2s infinite alternate ease-in-out;

    /* Make it slightly pop up */
    transform: translateY(-2px);
}

/* Pulsing glow animation */
@keyframes buttonGlow {
    0% {
        box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
    }
    100% {
        box-shadow: 0 8px 25px rgba(76, 175, 80, 0.7);
    }
}

/* Add a sliding shine effect across the button */
#btnProcess:not(:disabled)::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
            to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.3) 50%,
            rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    animation: buttonShine 3s infinite;
}

/* Sliding shine animation */
@keyframes buttonShine {
    0% {
        left: -100%;
    }
    20%, 100% {
        left: 150%;
    }
}

/* Additional attention-grabbing effect when first enabled */
#btnProcess.attention-flash {
    animation:
            buttonAttention 0.6s ease-out,
            buttonGlow 2s infinite alternate ease-in-out;
}

@keyframes buttonAttention {
    0% {
        transform: scale(1) translateY(-2px);
    }
    50% {
        transform: scale(1.05) translateY(-3px);
    }
    100% {
        transform: scale(1) translateY(-2px);
    }
}

/* Enhanced hover effect */
#btnProcess:not(:disabled):hover {
    background-color: #45a049; /* Slightly darker green */
    transform: translateY(-3px); /* More pronounced lift */
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.6); /* Bigger shadow */
}

/* Active/pressed state */
#btnProcess:not(:disabled):active {
    transform: translateY(0); /* Button presses down */
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.4); /* Smaller shadow */
    transition: transform 0.1s ease, box-shadow 0.1s ease; /* Faster transition for clicking */
}