/* nuVision Studio Styles */
:root {
    --nuvision-primary: #667eea;
    --nuvision-secondary: #764ba2;
    --nuvision-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --nuvision-light: #f8faff;
    --nuvision-dark: #2d3748;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-light: #e2e8f0;
    --background-card: #ffffff;
    --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-strong: 0 20px 40px rgba(102, 126, 234, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f8faff 0%, #f1f5f9 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */

h1, h2, h3, h4, h5, h6, .logo-title {
    font-family: 'League Spartan', 'Open Sans', sans-serif;
    letter-spacing: 0.5px;
}

/* Hide results section by default until JS shows it */
/* Results section visibility handled via body.show-results toggle */
body:not(.show-results) #resultsState {
    display: none !important;
}

body.show-results #resultsState {
    display: block !important;
}

body.show-results .step-actions {
    display: none !important;
}

/* Header Styles */
header {
    background: var(--nuvision-gradient);
    color: white;
    padding: 0.25rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-strong);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    min-height: auto;
}

.header-left, .header-right {
    flex: 1;
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex: 2;
}

.nuvision-logo {
    margin: 0;
    width: auto;
    height: 60px;
    filter: none;
    object-fit: contain;
    display: block;
}

.header-center h1 {
    text-align: center;
    margin: 0.25rem 0 0 0;
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(45deg, #fff, #f0f8ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-weight: 500;
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Main Content */
.nuvision-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 90px);
}

/* Step Container */
.step-container {
    display: none;
    background: var(--background-card);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow-strong);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.step-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--nuvision-gradient);
    border-radius: 24px 24px 0 0;
}

/* Core Step Container Styles */
.step-container {
    display: none !important; /* Force hide all steps by default */
    background: var(--background-card);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow-strong);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

/* Override for Active Step Only */
.step-container.active {
    display: block !important; /* Force show only active steps */
    animation: slideInUp 0.6s ease-out;
    z-index: 2;
}

/* Extra Media Query to Override Desktop Styles */
@media screen and (min-width: 768px) {
    .step-container:not(.active) {
        display: none !important;
        height: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Step Header */
.step-header {
    text-align: center;
    margin-bottom: 2rem;
}

.step-header h2 {
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    background: var(--nuvision-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.step-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0;
    font-weight: 400;
}

/* Upload Container */
.upload-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    margin: 0 auto 3rem auto;
    max-width: 1100px;
}

.upload-placeholder {
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
    margin-bottom: 1.5rem;
}

.upload-area {
    border: 3px dashed var(--nuvision-primary);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    transition: all 0.3s ease;
    position: relative;
}

#image-preview-container {
    display: none;
    margin-top: 1rem;
    text-align: center;
    width: 100%;
}

#image-preview {
    max-width: 90%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin: 0 auto;
    display: block;
}

.upload-area:hover {
    border-color: var(--nuvision-secondary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.upload-area.dragover {
    border-color: #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(102, 126, 234, 0.1));
}

.upload-placeholder i {
    font-size: 5rem;
    color: var(--nuvision-primary);
    margin-bottom: 1.5rem;
    display: block;
}

.upload-placeholder h3 {
    color: var(--text-primary);
    font-size: 1.75rem;
    margin: 0 0 0.75rem 0;
    font-weight: 600;
}

.upload-placeholder p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 1.1rem;
}

.upload-requirements {
    background: linear-gradient(135deg, #f8faff, #f1f5f9);
    border-radius: 16px;
    padding: 2.5rem;
    border-left: 5px solid var(--nuvision-primary);
    box-shadow: var(--shadow-soft);
}

.upload-requirements h4 {
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.upload-requirements ul {
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.upload-requirements li {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

/* Styles Grid */
.styles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.style-card {
    background: var(--background-card);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
}

.style-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-medium);
}

.style-card.selected {
    border-color: var(--nuvision-primary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2);
}

.style-card.selected::after {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: var(--nuvision-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.style-card img {
    width: 55%; /* Further reduced */
    height: 100px;
    object-fit: contain;
    filter: none !important;
    margin: 0 auto;
    display: block;
}

.style-card-content {
    padding: 1.75rem;
}

.style-card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 700;
    white-space: normal;
    word-break: break-word;
    text-align: center;
    hyphens: auto;
}

.style-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Color Selection */
.color-selection-area {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.selected-style-preview {
    background: linear-gradient(135deg, #f8faff, #f1f5f9);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    height: fit-content;
}

.selected-style-preview img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-soft);
}

.selected-style-preview h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

/* Colors Grid */
.colors-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 340px; /* Reduced by 15% */
    overflow-y: auto;
    padding-right: 0.5rem;
}

.color-card {
    background: var(--background-card);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    justify-content: flex-start;
}

.color-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.color-card.selected {
    border-color: var(--nuvision-primary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.color-card.selected::after {
    content: '✓';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    background: var(--nuvision-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
}

.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 0; /* Changed from 50% to make it square */
    margin-right: 1rem;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.color-card h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
    font-family: 'League Spartan', sans-serif;
}

/* Customization Grid - Updated for Dropdowns */
.customization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.customization-section {
    background: linear-gradient(135deg, #f8faff, #f1f5f9);
    border-radius: 20px;
    padding: 2.5rem;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
}

.customization-section h3 {
    margin: 0 0 2rem 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.customization-section h3 i {
    color: var(--nuvision-primary);
    font-size: 1.6rem;
}

/* Custom Dropdown Styles */
.dropdown-container {
    position: relative;
    width: 100%;
}

.dropdown-select {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    background: white;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23667eea" viewBox="0 0 16 16"><path d="M8 11.2L3.2 6.4 4.4 5.2 8 8.8l3.6-3.6 1.2 1.2L8 11.2z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    padding-right: 3rem;
}

.dropdown-select:hover {
    border-color: var(--nuvision-primary);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.dropdown-select:focus {
    outline: none;
    border-color: var(--nuvision-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dropdown-select option {
    padding: 0.75rem;
    color: var(--text-primary);
    background: white;
}

/* Animations for style selection */
@keyframes zoomToCenter {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.15); opacity: 1; }
}

@keyframes fadeOutStyle {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.8); }
}

.animate-selected {
    animation: zoomToCenter 0.4s forwards;
    z-index: 2;
}
.animate-out {
    animation: fadeOutStyle 0.4s forwards;
}

/* ---------------- Responsive Tweaks ---------------- */
@media (max-width: 768px) {
    /* Smaller style card/images */
    .style-card img {
        height: 120px;
    }
    .door-style-item img {
        max-width: 110px;
    }
    #image-preview {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .style-card img {
        height: 100px;
    }
    .door-style-item img {
        max-width: 110px;
    }
    #image-preview {
        max-height: 220px;
    }
}

/* Step Actions */

/* ===== Door Style Grid Enhancements ===== */
.door-style-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
}

.door-style-item img {
    width: 160px;
    height: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
}

/* Stacked style name */
.style-name-stacked {
    text-align: center;
    font-family: "League Spartan", sans-serif;
    font-weight: 600;
    line-height: 1.1;
    font-size: 1rem;
}

/* Desktop tweaks (shrink images 35%) */
@media (min-width: 1024px) {
    #style-grid {
        grid-template-columns: repeat(4, 1fr); /* 4 columns on PC */
    }
    .door-style-item img { width: 120px; }
    .style-name-stacked { font-size: 1.44rem; /* 60% larger */ }

    #style-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    .door-style-item img {
        width: 120px; /* ~25-35% smaller */
    }
    .style-name-stacked { font-size: 0.9rem; }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
    #style-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    .door-style-item img { width: 130px; }
}

/* Mobile: 3-column tight grid */
@media (max-width: 767px) {
    /* Phone: door images 25% larger than tablet and tighter gap */
    #style-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 2px; /* 50% tighter */
    }
    .door-style-item img { width: 160px; }
    .style-name-stacked { font-size: 1.1rem; }

    #style-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    .door-style-item img { width: 110px; }
    .style-name-stacked { font-size: 0.85rem; }
}

/* ===== Color List Row Layout ===== */
.color-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
}

.color-item.selected {
    outline: 2px solid var(--accent-color, #444);
}

.color-swatch {
    flex: 0 0 16.6%; /* ~1/6th */
    width: 100%;
    padding-top: 100%; /* square */
    border: 1px solid #ccc;
    box-sizing: border-box;
    /* Removed 'inherit' which was overriding inline styles */
}

.color-item p {
    flex: 1;
    margin: 0;
    font-family: "League Spartan", sans-serif;
    font-weight: 700;
}

.step-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

/* Loading Animation - Fun Cabinet Doors */

/* ==== 2025-06-25 Responsive & UI Tweaks ==== */

/* Enlarge logo */
header .nuvision-logo {
    height: 60px; /* 50% larger than original 40px */
    width: auto;
}

/* ----- Door Style Grid ----- */
@media (min-width: 1024px) {
    /* Desktop: 4 columns, smaller gap, larger text */
    #style-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    .door-style-item img { width: 120px; }
    .style-name-stacked { font-size: 1.6rem; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    /* Tablet: keep 4 columns but moderate image size */
    #style-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
    .door-style-item img { width: 130px; }
}

@media (max-width: 767px) {
    /* Phone: 3-col, tighter gap, images +25% vs tablet */
    #style-grid { grid-template-columns: repeat(3, 1fr); gap: 2px; }
    .door-style-item img { width: 160px; }
    .style-name-stacked { font-size: 1.1rem; }
}

/* ----- Color Selection Row ----- */
.color-item {
    gap: 12px;
    min-height: 80px;
}

.color-swatch {
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
    padding: 0;
    border-radius: 0; /* square */
    /* No background-color override, allow inline styles to work */
}

.loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 3rem 0;
    position: relative;
}

.cabinet-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 2rem;
}

.cabinet-door {
    width: 80px;
    height: 100px;
    border-radius: 8px;
    position: relative;
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    animation: doorPulse 2s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cabinet-door::before {
    content: '';
    position: absolute;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}

.cabinet-door::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    transform: translateY(-50%);
    opacity: 0.8;
}

.cabinet-door-1 {
    animation-delay: 0s;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.cabinet-door-2 {
    animation-delay: 0.5s;
    background: linear-gradient(135deg, #764ba2, #667eea);
}

.cabinet-door-3 {
    animation-delay: 1s;
    background: linear-gradient(135deg, #667eea, #8b5cf6);
}

.cabinet-door-4 {
    animation-delay: 1.5s;
    background: linear-gradient(135deg, #8b5cf6, #667eea);
}

@keyframes doorPulse {
    0%, 100% {
        transform: scale(1) rotateY(0deg);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }
    25% {
        transform: scale(1.1) rotateY(5deg);
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
    }
    50% {
        transform: scale(1.05) rotateY(-3deg);
        box-shadow: 0 6px 20px rgba(118, 75, 162, 0.4);
    }
    75% {
        transform: scale(1.08) rotateY(8deg);
        box-shadow: 0 10px 30px rgba(139, 92, 246, 0.6);
    }
}

.loading-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.sparkle {
    position: absolute;
    font-size: 1.5rem;
    animation: sparkleFloat 3s ease-in-out infinite;
    opacity: 0;
}

.sparkle-1 {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.sparkle-2 {
    top: 30%;
    right: 15%;
    animation-delay: 0.8s;
}

.sparkle-3 {
    bottom: 25%;
    left: 20%;
    animation-delay: 1.6s;
}

.sparkle-4 {
    bottom: 15%;
    right: 10%;
    animation-delay: 2.4s;
}

@keyframes sparkleFloat {
    0%, 100% {
        opacity: 0;
        transform: translateY(0px) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(-20px) scale(1);
    }
}

/* Progress Container */
.comparison-container {
    width: 100%;
    max-width: 100%;
    overflow: visible; /* allow images to scale without clipping */
    text-align: center;
    padding: 0;
}

.progress-container {
    width: 100%;
    max-width: 500px;
    margin: 2rem 0;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--nuvision-gradient);
    border-radius: 6px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    text-align: center;
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--nuvision-primary);
}

/* Processing Info */
.processing-info {
    text-align: center;
    max-width: 500px;
}

.processing-info h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.processing-info p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0;
}

/* Results State */
#resultsState {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* Transition animations */
#processingState, #resultsState {
    transition: opacity 0.5s ease-in-out;
}

#processingState.fade-out {
    opacity: 0;
    pointer-events: none;
}

#resultsState.fade-in {
    opacity: 1;
}

.results-comparison {
    margin-bottom: 2rem;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 100%;
    overflow: hidden;
}

@media (min-width: 992px) {
    .results-comparison {
        /* Stack vertically instead of splitting columns */
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

.before-after {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 100%;
    overflow: visible; /* allow full image visibility */
    text-align: center;
    align-items: center;
}

@media (min-width: 768px) {
    .before-after {
        flex-direction: column; /* always stack vertically */
        justify-content: center;
        align-items: center;
    }
}

.before figure, .after figure {
    width: 100%;
    max-width: 345px; /* cap actual render width */
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.before figure img, .after figure img {
    width: 100%;             /* matches figure width */
    max-width: 345px;        /* absolute cap so image can never exceed container */
    height: auto;            /* maintain aspect ratio */
    object-fit: contain;
    object-position: center center;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
}

.before figcaption, .after figcaption {
    margin-top: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Hide 'After' label under the transformed image */
.after figcaption {
    display: none;
}

/*
==============================================
  V1 UI Additions
==============================================
*/

.logo-title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.version-label {
    font-family: 'League Spartan', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    background: rgba(0,0,0,0.15);
    padding: 2px 8px;
    border-radius: 6px;
    margin-top: -10px; /* Adjust to position under the title */
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.image-disclaimer {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0 auto 1.5rem auto;
    max-width: 80%;
}

.btn-quote {
    font-family: 'League Spartan', sans-serif;
    background: var(--nuvision-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    box-shadow: var(--shadow-soft);
}

.btn-quote:hover {
    background: var(--nuvision-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Responsive image sizing for mobile */
@media (max-width: 767px) {
    .before figure img, .after figure img {
        max-width: 80%;
        max-height: 150px;
    }
    
    .before-after {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .image-comparison {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .before figure img, .after figure img {
        max-width: 100%;
        width: 100%;
        max-height: 200px;
        margin-bottom: 1rem;
        object-fit: contain;
    }
    
    .comparison-container {
        padding: 0;
    }
    
    .results-comparison {
        gap: 1rem;
    }
    
    .before-after {
        padding: 0 0.5rem;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .before figure, .after figure {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }
    
    .email-section input[type="email"] {
        border: 2px solid var(--border-color);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

.before-image img:hover, .after-image img:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

/* Fix before/after display and sizing */
.before-after {
    gap: 1rem;
}

#originalImage,
#transformedImage {
    width: 100%;
    max-width: 345px;
    height: auto;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

/* Email section styling */

/* Center email field on larger screens */
@media (min-width: 768px) {
    .email-section {
        align-items: center;
    }
    .email-section input[type="email"] {
        margin: 0 auto;
    }
}
.email-section-container {
    margin: 1.5rem 0;
    padding: 1rem;
    border-radius: 10px;
    background-color: rgba(240, 240, 240, 0.5);
    backdrop-filter: blur(5px);
}

.dark-mode .email-section-container {
    background-color: rgba(40, 44, 52, 0.7);
}

.email-blurb {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #333;
    font-weight: 500;
    text-align: center;
    font-family: 'League Spartan', sans-serif;
}

.dark-mode .email-blurb {
    color: #e0e0e0;
}

.email-section {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
}

.inline-email {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.email-section input[type="email"] {
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--border-light);
    font-size: 16px;
    width: 100%;
    max-width: 345px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.email-section input[type="email"]:focus {
    border-color: var(--nuvision-primary);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    outline: none;
}

@media (max-width: 480px) {
    .email-section input[type="email"] {
        padding: 14px;
        font-size: 16px;
        width: 100%;
        max-width: none;
    }
    
    .email-section button {
        padding: 14px;
        font-size: 16px;
        margin-top: 8px;
    }
}

.results-details {
    background: #ffffff; /* light-mode background */
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid #d0d0d0;
    color: var(--text-primary);
}

.results-details h3 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
}

.details-grid {
    display: grid;
    gap: 1rem;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
}

.detail-item i {
    color: var(--nuvision-primary);
    font-size: 1.2rem;
}

.detail-label {
    font-weight: 600;
    color: var(--text-primary);
}

.detail-value {
    color: var(--text-secondary);
}

.results-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    width: 100%;
}

.results-actions .btn {
    padding: 1rem 2.5rem;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 2px solid transparent;
    text-decoration: none;
    min-width: 160px;
    justify-content: center;
}

/* Image Modal */
#imageModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#imageModal.visible {
    opacity: 1;
    pointer-events: all;
}

#imageModal img {
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    border-radius: 16px;
}

#imageModal .close-modal {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 2.5rem;
    color: white;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nuvision-main {
        padding: 2rem 1rem;
    }
    
    .step-container {
        padding: 2rem;
    }
    
    .upload-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .color-selection-area {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .customization-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .comparison-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .email-input-group {
        flex-direction: column;
        gap: 1rem;
    }
    
    .email-input-group .btn-primary {
        width: 100%;
    }
    
    .cabinet-container {
        gap: 6px;
    }
    
    .cabinet-door {
        width: 60px;
        height: 80px;
    }
    
    .step-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .header-center h1 {
        font-size: 1.6rem;
    }
    
    .nuvision-logo {
        width: 40px;
        height: 40px;
    }
    
    .before-after {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1rem;
    }
    
    .step-header h2 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 3rem 1.5rem;
    }
    
    .styles-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .colors-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        margin: 0;
    }
}

/* Step 3 Color Selection - Reorder for Better UX */
@media (min-width: 768px) {
    #step3 {
        display: flex;
        flex-direction: column;
    }
    
    #step3 .step-header {
        order: 1;
    }
    
    #step3 .step-actions {
        order: 2;
        margin-top: 1rem;
        margin-bottom: 2rem;
    }
    
    #step3 .color-selection-area {
        order: 3;
        margin-bottom: 1rem;
    }
}

.beta-tag {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
    vertical-align: middle;
    margin-left: 0.75rem;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 1rem 2.5rem;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 2px solid transparent;
    text-decoration: none;
    min-width: 160px;
    justify-content: center;
}

/* Image Modal Styles */
.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.image-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.image-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    object-fit: contain;
    overflow: hidden; /* Ensure internal img is clipped */
}

/* Make sure the image inside the modal is fully responsive */
.image-modal-content img#modal-image {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}


.image-modal-overlay .close-modal {
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-size: 3rem;
    color: white;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.2s ease;
}

.image-modal-overlay .close-modal:hover {
    transform: scale(1.1);
}

/* === nuVision Studio Tweaks (2024-06-11) === */
header .header-center {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* Compact header with minimal padding - STATIC POSITIONING */
header {
    position: static;
    padding: 0.25rem 2rem;
    min-height: auto;
}

/* Center logo above header text */
header .nuvision-logo {
    margin: 0;
    width: auto;
    height: 60px;
    display: block;
}

.header-center h1 {
    text-align: center;
    margin: 0.25rem 0 0 0;
}

/* Make beta tag visible and place it on its own line */
.beta-tag {
    display: block;
    margin: 0;
    margin-top: 0.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    background: none;
    -webkit-text-fill-color: #ffffff;
}

/* Enhanced buttons */
.btn-primary {
    background: var(--nuvision-gradient);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 18px rgba(102, 126, 234, 0.35);
}

.btn-primary:hover,
.btn-primary:focus {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.45);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--nuvision-primary);
    color: var(--nuvision-primary);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: var(--nuvision-primary);
    color: #ffffff;
    transform: translateY(-2px);
}

/* Center processing state content */
#processingState {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#processingState .progress-container {
    margin: 2rem auto;
}

#processingState .processing-info {
    margin: 0 auto;
}

/* === Mobile Responsiveness Improvements === */
@media (max-width: 768px) {
    /* Smaller header fonts */
    .header-center h1 {
        font-size: 1.6rem;
    }
    
    header .nuvision-logo {
        height: 45px;
    }
    
    .beta-tag {
        font-size: 0.8rem;
    }
    
    /* Tighter main content */
    .nuvision-main {
        padding: 1rem;
    }
    
    /* Compact step containers */
    .step-container {
        padding: 1.5rem;
    }
    
    /* Smaller step headers */
    .step-header h2 {
        font-size: 1.5rem;
    }
    
    .step-header p {
        font-size: 1rem;
    }
    
    /* Tighter upload requirements */
    .upload-requirements {
        padding: 1.5rem;
    }
    
    .upload-requirements h4 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .upload-requirements ul {
        margin: 0;
        padding-left: 1.2rem;
    }
    
    .upload-requirements li {
        margin-bottom: 0.25rem;
        font-size: 0.9rem;
    }
    
    /* 2x2 grid for styles and colors on mobile */
    .styles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .colors-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Smaller style and color cards */
    .style-card {
        padding: 0.75rem;
    }
    
    .style-card img {
        height: 100px;
    }
    
    .style-card h3 {
        font-size: 1rem;
        margin: 0.5rem 0 0.25rem 0;
    }
    
    .style-card p {
        font-size: 0.8rem;
    }
    
    .color-card {
        padding: 0.75rem;
    }
    
    .color-swatch {
        width: 50px;
        height: 50px;
        /* Ensure no background-color overrides here */
    }
    
    .color-card h4 {
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }
    
    /* Compact buttons */
    .btn-primary, .btn-secondary {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        min-width: 120px;
    }
    
    /* Tighter customization sections */
    .customization-section {
        padding: 1rem;
    }
    
    .customization-section h3 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
}

@media (max-width: 480px) {
    /* Extra small screens - even more compact */
    header {
        padding: 0.2rem 1rem;
    }
    
    .header-center h1 {
        font-size: 1.4rem;
    }
    
    header .nuvision-logo {
        height: 40px;
    }
    
    .step-container {
        padding: 1rem;
    }
    
    .step-header h2 {
        font-size: 1.3rem;
    }
    
    .upload-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-placeholder h3 {
        font-size: 1.4rem;
    }
    
    .upload-requirements {
        padding: 1rem;
    }
}