/* Film Wrapped - Clean, Modern, Minimalist Design */

/* Override body background when in wrapped view */
body:has(.slide.active) {
    background: #000000 !important;
}

.container:has(.slide.active) {
    background: #000000;
}

/* Base slide styles - Full screen carousel */
.slide {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: opacity 0.5s ease, visibility 0.5s ease, transform 0.5s ease;
    z-index: 1;
    overflow: hidden;
    background: #000000;
}

.slide.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    z-index: 2;
}

/* Slide content container */
.slide-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    padding-bottom: clamp(120px, 20vw, 140px); /* Space for navigation on mobile */
    max-width: 90vw;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Typography - Clean, high-contrast sans-serif */
.slide-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    color: #ffffff;
}

.data-label {
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: clamp(1.5rem, 4vw, 3rem);
}

.data-title {
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    color: #ffffff;
    margin: 0;
    margin-bottom: clamp(1rem, 3vw, 2rem);
}

.data-count {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.5rem;
}

.film-title {
    font-size: clamp(1.75rem, 5vw, 3rem);
    font-weight: 600;
    line-height: 1.2;
    color: #ffffff;
    margin: 0;
    margin-top: clamp(1.5rem, 4vw, 2.5rem);
}

/* Slide 1: Intro/Summary - Total Films & Hours */
#slide-1 .intro-stats {
    display: flex;
    flex-direction: column;
    gap: clamp(3rem, 8vw, 5rem);
    width: 100%;
    max-width: 600px;
}

.stat-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.stat-number {
    font-size: clamp(4rem, 12vw, 8rem);
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Slide 2: Top Genre */
#slide-2 .genre-films-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: clamp(1.5rem, 4vw, 2.5rem);
    max-width: 500px;
    width: 100%;
}

.genre-film-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    text-align: left;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.genre-film-item:last-child {
    border-bottom: none;
}

.genre-film-rating {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    font-variant-numeric: tabular-nums;
}

/* Slide 4: Top Actors List */
.actors-list {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-top: clamp(2rem, 5vw, 3rem);
    max-width: 600px;
    width: 100%;
}

.actor-item {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 1.5rem);
    padding: clamp(0.75rem, 2vw, 1rem);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.actor-item-image {
    width: clamp(50px, 10vw, 70px);
    height: clamp(50px, 10vw, 70px);
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.actor-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.actor-placeholder-small {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: rgba(255, 255, 255, 0.3);
}

.actor-item-name {
    flex: 1;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.actor-item-count {
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    font-variant-numeric: tabular-nums;
}

/* Slide 5: Longest Film */
#slide-5 {
    position: relative;
}

.slide-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.15;
    background-size: cover;
    background-position: center;
    filter: blur(40px) brightness(0.3);
}

#slide-5 .slide-content {
    position: relative;
    z-index: 2;
}

.runtime-display {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 1rem;
    font-variant-numeric: tabular-nums;
}

/* Slide 6: Rating Distribution */
#slide-6 .rating-main {
    margin-bottom: clamp(2rem, 5vw, 3rem);
}

.avg-rating-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.avg-rating-number {
    font-size: clamp(4rem, 10vw, 6rem);
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.avg-rating-label {
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.rating-distribution {
    display: flex;
    flex-direction: column;
    gap: clamp(0.3rem, 1vh, 0.5rem);
    margin-top: clamp(1rem, 3vh, 2rem);
    max-width: min(90vw, 600px);
    width: 100%;
    padding: 0 clamp(0.5rem, 2vw, 1rem);
    box-sizing: border-box;
    max-height: clamp(200px, 40vh, 350px);
    overflow-y: auto;
}

.rating-bar-container {
    display: flex;
    align-items: center;
    gap: clamp(0.4rem, 1.5vw, 0.75rem);
    min-height: clamp(16px, 3vh, 24px);
    flex-shrink: 0;
}

.rating-bar-label {
    width: clamp(1.25rem, 3.5vw, 1.75rem);
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-align: right;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.rating-bar {
    flex: 1;
    height: clamp(16px, 2.5vh, 24px);
    min-height: 16px;
    max-height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 100%;
}

.rating-bar-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 2px;
}

/* Slide 7: Rewatch Dedication */
.rewatch-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1.5rem, 4vw, 2.5rem);
}

.rewatch-poster {
    position: relative;
    width: clamp(200px, 40vw, 300px);
    height: clamp(300px, 60vw, 450px);
    border-radius: 8px;
    overflow: visible;
    background: rgba(255, 255, 255, 0.1);
}

.rewatch-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.poster-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(4rem, 10vw, 6rem);
    color: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}

.rewatch-overlay {
    position: absolute;
    top: -0.75rem;
    right: -0.75rem;
    font-size: clamp(1.25rem, 3.5vw, 2rem);
    font-weight: 700;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.85);
    padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(0.75rem, 2vw, 1rem);
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
    min-width: 3rem;
    text-align: center;
}

/* Slide 8: Share Card */
.share-card-content {
    background: #000000;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: clamp(2rem, 5vw, 4rem);
    max-width: 700px;
    width: 100%;
}

.share-card-header {
    margin-bottom: clamp(2rem, 5vw, 3rem);
    text-align: center;
}

.share-card-title {
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    margin: 0;
    margin-bottom: 0.5rem;
}

.share-card-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.share-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: clamp(2rem, 5vw, 3rem);
}

.share-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: clamp(1rem, 3vw, 1.5rem);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.share-stat-number {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

.share-stat-text {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 500;
    line-height: 1.2;
    color: #ffffff;
    text-align: center;
}

.share-stat-label {
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.share-button {
    width: 100%;
    padding: clamp(1rem, 3vw, 1.25rem) clamp(1.5rem, 4vw, 2rem);
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 600;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.share-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.share-button:active {
    transform: scale(0.98);
}

/* Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-number,
.avg-rating-number {
    animation: countUp 0.6s ease-out;
}

/* Responsive Design - Mobile First */
/* Mobile Portrait (default) */
@media (max-width: 640px) {
    .slide-content {
        padding: 1.5rem;
        padding-bottom: 140px; /* Extra space for nav buttons on mobile */
    }
    
    #slide-1 .intro-stats {
        gap: 3rem;
    }
    
    .share-stats-grid {
        gap: 1rem;
    }
    
    .share-stat {
        padding: 1rem;
    }
    
    .rating-distribution {
        gap: 0.3rem;
        padding: 0 0.5rem;
        max-height: min(35vh, 250px);
        margin-top: 1rem;
    }
    
    .rating-bar-container {
        gap: 0.4rem;
        min-height: 16px;
    }
    
    .rating-bar {
        height: 16px;
        min-height: 16px;
        max-height: 18px;
    }
    
    .rating-bar-label {
        width: 1.25rem;
        font-size: 0.7rem;
    }
    
    .actors-list {
        gap: 0.75rem;
    }
    
    .actor-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }
}

/* Small mobile devices */
@media (max-width: 480px) and (max-height: 700px) {
    .rating-distribution {
        gap: 0.25rem;
        max-height: min(30vh, 200px);
        margin-top: 0.75rem;
    }
    
    .rating-bar-container {
        min-height: 14px;
    }
    
    .rating-bar {
        height: 14px;
        min-height: 14px;
        max-height: 16px;
    }
    
    .rating-bar-label {
        width: 1.1rem;
        font-size: 0.65rem;
    }
}

/* Mobile Landscape */
@media (max-width: 896px) and (orientation: landscape) {
    .slide-content {
        padding: 2rem;
        padding-bottom: 100px; /* Less space needed in landscape */
    }
    
    #slide-1 .intro-stats {
        flex-direction: row;
        gap: 3rem;
    }
    
    .stat-number {
        font-size: clamp(3rem, 8vw, 5rem);
    }
    
    .rating-distribution {
        gap: 0.4rem;
        max-width: min(85vw, 500px);
        max-height: min(50vh, 300px);
    }
    
    .rating-bar {
        height: clamp(18px, 2vh, 22px);
    }
}

/* Tablet Portrait */
@media (min-width: 641px) and (max-width: 1024px) {
    .slide-content {
        padding: 2.5rem;
    }
    
    .share-card-content {
        padding: 3rem;
    }
    
    .rating-distribution {
        max-width: min(80vw, 550px);
    }
    
    .rating-bar {
        height: 24px;
    }
}

/* Tablet Landscape & Desktop */
@media (min-width: 1025px) {
    .slide-content {
        padding: 3rem;
        max-width: 1200px;
    }
    
    .share-card-content {
        padding: 4rem;
    }
}

/* Large Desktop */
@media (min-width: 1440px) {
    .slide-content {
        max-width: 1400px;
    }
}

/* Touch Gesture Improvements */
@media (hover: none) and (pointer: coarse) {
    .share-button {
        min-height: 48px; /* Better touch target */
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .person-image,
    .rewatch-poster {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}
