/* Screen-specific styles */

/* Ensure all screens fit within viewport */
.screen {
    padding-top: 0; /* Remove top padding */
}

.screen-content {
    max-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto; /* Allow vertical scrolling */
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center content vertically */
    height: 100vh;
    padding-top: 80px; /* Account for header */
    padding-bottom: 100px; /* Account for button container */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.content-top {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content horizontally */
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

/* Position buttons consistently at bottom with safe area for mobile devices */
.btn-container {
    position: absolute;
    bottom: 100px; /* Increased from 80px to 100px for more bottom space */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 20px;
    padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 20px); /* Increased padding for iOS */
}

.screen .btn,
.screen .btn-group {
    margin-top: 0;
    min-width: 280px; /* Changed from fixed width to min-width */
    max-width: 320px; /* Added max-width */
    width: auto; /* Allow buttons to expand based on content */
    text-align: center;
}

.btn-container .btn-primary,
.btn-container .btn-secondary {
    min-width: 280px; /* Changed from fixed width to min-width */
    max-width: 320px; /* Added max-width */
    width: auto; /* Allow buttons to expand based on content */
}

.btn-container .btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 280px; /* Changed from fixed width to min-width */
    max-width: 320px; /* Added max-width */
    width: auto; /* Allow buttons to expand based on content */
}

.btn-container .delivery-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 280px; /* Changed from fixed width to min-width */
    max-width: 320px; /* Added max-width */
    width: auto; /* Allow buttons to expand based on content */
}


/* Screen 1: Intro / Hook */
#screen-intro {
    background-color: var(--bg-primary);
    position: relative;
}

#screen-intro .blurred-collage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/collage-bg.png');
    background-size: cover;
    background-position: top left; /* Different offset than screen-struggle */
    filter: blur(6px); /* Less blur than screen-struggle */
    opacity: 0.3;
    z-index: 1;
}

/* Make background less blurry on mobile devices */
@media (max-width: 768px) {
    #screen-intro .blurred-collage,
    #screen-struggle .blurred-collage {
        filter: blur(4px);
        opacity: 0.25;
    }
}

#screen-intro .screen-content {
    position: relative;
    z-index: 2;
}

#screen-intro .headline {
    margin-bottom: 1.5rem;
    max-width: 720px;
}

#screen-intro .subline {
    margin-bottom: 2.5rem;
    color: var(--muted-text);
    max-width: 540px;
}

/* Screen 2: Shared Struggle */
#screen-struggle {
    background-color: var(--bg-primary);
}

#screen-struggle .blurred-collage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/collage-bg.png');
    background-size: cover;
    background-position: center; /* Different offset than screen-intro */
    filter: blur(8px);
    opacity: 0.3;
    z-index: 1;
}

#screen-struggle .screen-content {
    position: relative;
    z-index: 2;
}

#screen-struggle .message {
    font-size: 1.5rem;
    font-weight: 500;
    max-width: 600px;
    margin-bottom: 2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.panel-semi-opaque {
    background-color: var(--panel-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-medium);
    max-width: 600px;
}

/* Screen 3: Service Intro */
#screen-service-intro {
    background-color: var(--bg-primary);
}

#screen-service-intro .photo-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/photo-frame.png');
    background-size: cover;
    background-position: center;
    filter: blur(3px);
    opacity: 0.2;
    z-index: 1;
    transition: filter var(--transition-medium), opacity var(--transition-medium);
}

#screen-service-intro[data-active="true"] .photo-frame {
    filter: blur(0);
    opacity: 0.4;
}

#screen-service-intro .message {
    font-size: 1.5rem;
    font-weight: 500;
    max-width: 600px;
    margin-bottom: 2rem;
}

/* Screen 4: Black & White → Color demo */
.demo-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 2rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-strong);
}

.demo-photo {
    width: 100%;
    aspect-ratio: 4/3;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    user-select: none;
}

#bw-color-demo {
    background-image: url('../assets/images/bw-photo.png');
    background-size: cover;
    background-position: center;
}

.color-reveal-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/color-photo.png');
    background-size: cover;
    background-position: center;
    clip-path: inset(0 0 0 100%);
    transition: none;
}

.color-reveal-mask.animating {
    animation: colorRevealAnimation 4s ease-in-out;
}

@keyframes colorRevealAnimation {
    0% {
        clip-path: inset(0 0 0 100%);
    }
    35% {
        clip-path: inset(0 0 0 0);
    }
    65% {
        clip-path: inset(0 0 0 0);
    }
    100% {
        clip-path: inset(0 0 0 100%);
    }
}

.comparison-slider {
    position: absolute;
    top: 0;
    left: 50%;
    height: 100%;
    transform: translateX(-50%);
    z-index: 10;
    cursor: ew-resize;
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.comparison-slider.active {
    opacity: 1;
}

.slider-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 100%;
    background: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    cursor: ew-resize;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    transition: transform var(--transition-fast);
}

.slider-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.comparison-slider.dragging .slider-button {
    transform: translate(-50%, -50%) scale(0.9);
}

.comparison-slider.dragging .slider-line {
    background: var(--accent-glow);
}

.comparison-labels {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    opacity: 0;
    transition: opacity var(--transition-medium);
    pointer-events: none;
}

.comparison-labels.visible {
    opacity: 1;
}

.label-before,
.label-after {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* Mobile adjustments for comparison slider */
@media (max-width: 768px) {
    .comparison-labels {
        padding: 0 10px;
    }
    
    .label-before,
    .label-after {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

.microcopy {
    font-size: 0.875rem;
    color: var(--muted-text);
    margin-top: 0.5rem;
}

.slider-instruction {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: var(--accent-glow);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity var(--transition-medium);
    pointer-events: none;
    animation: pulseInstruction 2s ease-in-out infinite;
}

.comparison-slider.active ~ .slider-instruction {
    opacity: 1;
    animation-delay: 0.5s;
}

.comparison-slider.dragging ~ .slider-instruction {
    opacity: 0;
}

@keyframes pulseInstruction {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

/* Touch feedback for mobile */
@media (hover: none) {
    .slider-button:active {
        transform: translate(-50%, -50%) scale(0.95);
    }
}

/* Screen 5: Color → Animation demo */
#animation-demo {
    background: none;
    position: relative;
}

.demo-photo.animated {
    position: relative;
}

.animation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity var(--transition-medium);
}

#screen-animation-demo[data-active="true"] .animation-overlay {
    opacity: 1;
}

@keyframes subtle-movement {
    0% { transform: scale(1) translate(0, 0); }
    50% { transform: scale(1.02) translate(-2px, -1px); }
    100% { transform: scale(1.01) translate(1px, 2px); }
}

/* Screen 6: Animation → Sound demo */
#sound-demo {
    position: relative;
    overflow: visible;
    width: 100%;
    height: 100%;
    /* Removed background image that was pushing content down */
}

.sound-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity var(--transition-medium);
    overflow: hidden;
    background-color: transparent;
    z-index: 2;
}

.demo-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.sound-wave-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#screen-sound-demo[data-active="true"] .sound-wave {
    opacity: 0.8;
}

.sound-toggle, .caption-toggle {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 3;
    transition: background-color var(--transition-fast);
}

.sound-toggle {
    bottom: 16px;
    right: 16px;
}

.caption-toggle {
    bottom: 16px;
    right: 64px;
}

.sound-toggle:hover, .caption-toggle:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.sound-toggle svg, .caption-toggle svg {
    width: 20px;
    height: 20px;
}

.caption-text {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    margin-top: 1rem;
    max-width: 600px;
}

/* Screen 7: Upload */
#screen-upload .headline {
    margin-bottom: 0.5rem;
}

#screen-upload .subline {
    margin-bottom: 2rem;
    color: var(--muted-text);
}

.upload-container {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 16/9;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem auto 2rem;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
    cursor: pointer;
}

.upload-container:hover, .upload-container.drag-over {
    border-color: var(--accent-glow);
    background-color: rgba(54, 224, 193, 0.05);
}

.upload-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    width: 100%;
    height: 100%;
}

.icon-upload {
    width: 40px;
    height: 40px;
    color: var(--accent-glow);
    margin-bottom: 0.75rem;
}

.upload-formats, .upload-size {
    font-size: 0.75rem;
    color: var(--muted-text);
    margin-top: 0.25rem;
}

.privacy-note {
    font-size: 0.875rem;
    color: var(--muted-text);
    max-width: 600px;
    text-align: center;
    margin: 0 auto;
}

/* iPhone-specific adjustments */
@media screen and (max-width: 428px) { /* iPhone 13 Pro Max width */
    .upload-container {
        aspect-ratio: auto;
        height: 180px;
        margin: 0.5rem auto 1.5rem;
    }
    
    .upload-inner {
        padding: 1rem;
    }
    
    .upload-inner p {
        margin-bottom: 0.25rem;
    }
}

/* Screen 8: Processing */
#screen-processing {
    background: linear-gradient(135deg, #0b0f14, #0f172a);
}

#screen-processing .screen-content {
    padding-top: 180px; /* Further increased padding to avoid overlap with header */
}

.processing-animation {
    width: 100%;
    height: 200px;
    position: relative;
    margin: 2rem 0;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.flowing-light {
    position: absolute;
    top: 0;
    left: -100%;
    width: 300%;
    height: 100%;
    background: linear-gradient(90deg, 
        rgba(54, 224, 193, 0) 0%,
        rgba(54, 224, 193, 0.1) 20%,
        rgba(54, 224, 193, 0.2) 40%,
        rgba(54, 224, 193, 0.1) 60%,
        rgba(54, 224, 193, 0) 100%
    );
    animation: flow-animation 3s infinite linear;
}

@keyframes flow-animation {
    0% { transform: translateX(0); }
    100% { transform: translateX(33.33%); }
}

.processing-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.step {
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0.5;
    transition: opacity var(--transition-medium);
}

.step[data-active="true"] {
    opacity: 1;
}

.step-icon {
    font-size: 1.5rem;
}

.progress-container {
    width: 100%;
    max-width: 400px;
    margin-bottom: 1rem;
    margin-left: auto;
    margin-right: auto;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress {
    height: 100%;
    background-color: var(--accent-glow);
    border-radius: 3px;
    transition: width var(--transition-medium);
}

.progress-text {
    font-size: 0.875rem;
    color: var(--muted-text);
}

.processing-message {
    font-size: 0.875rem;
    color: var(--muted-text);
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    margin-top: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Screen 9: Preview + Paywall */
#screen-preview {
    background: linear-gradient(135deg, #0b0f14, #0f172a);
}

#screen-preview .screen-content {
    max-width: 600px;
}

.feature-thumbnails {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
    width: 100%;
}

@media (min-width: 480px) {
    .feature-thumbnails {
        grid-template-columns: repeat(4, 1fr);
    }
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 1rem;
    transition: background-color var(--transition-fast);
}

.feature-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.feature-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.feature-name {
    font-size: 0.875rem;
    color: var(--muted-text);
}

/* Post-purchase / Delivery Screen */
.memory-player {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16/9;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    margin: 2rem 0;
    overflow: hidden;
}

.delivery-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-medium), visibility var(--transition-medium);
}

.modal[data-active="true"] {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--panel-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-strong);
}

.modal-content h3 {
    margin-bottom: 1rem;
}

.payment-options {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .screen-content {
        padding: 2rem;
    }
    
    .panel-semi-opaque,
    .paywall-overlay {
        padding: 3rem;
    }
}
