@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-pattern: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
                  radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
                  radial-gradient(circle at 40% 80%, rgba(120, 119, 198, 0.2) 0%, transparent 50%),
                  linear-gradient(135deg, #2d1b69 0%, #11101d 100%);
    --card-bg: white;
    --text-color: #333;
    --text-light: #666;
    --border-color: #ddd;
    --shadow: rgba(0,0,0,0.1);
    --shadow-hover: rgba(0,0,0,0.2);
}

[data-theme="dark"] {
    --bg-pattern: radial-gradient(circle at 20% 50%, rgba(219, 112, 147, 0.15) 0%, transparent 50%),
                  radial-gradient(circle at 80% 20%, rgba(186, 85, 211, 0.15) 0%, transparent 50%),
                  radial-gradient(circle at 40% 80%, rgba(219, 112, 147, 0.1) 0%, transparent 50%),
                  linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
    --card-bg: #16213e;
    --text-color: #e8e8e8;
    --text-light: #a8a8a8;
    --border-color: #2c3e50;
    --shadow: rgba(0,0,0,0.5);
    --shadow-hover: rgba(0,0,0,0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-pattern);
    min-height: 100vh;
    color: var(--text-color);
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeInPage 1.2s ease-in-out forwards;
}

/* Page fade-in animation */
@keyframes fadeInPage {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Movie card scroll animations */
@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(90deg, 
        #ffffff 0%, 
        #ffffff 40%, 
        #667eea 50%, 
        #764ba2 55%, 
        #ffffff 60%, 
        #ffffff 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
    animation: textSlide 3s ease-in-out infinite;
}

header h1::before {
    display: none;
}

@keyframes textSlide {
    0% {
        background-position: -200% 0%;
    }
    50% {
        background-position: 200% 0%;
    }
    100% {
        background-position: -200% 0%;
    }
}

@keyframes textSlide {
    0% {
        background-position: -200% 0%;
    }
    50% {
        background-position: 200% 0%;
    }
    100% {
        background-position: -200% 0%;
    }
}

@keyframes slide {
    0% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.controls {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow);
    margin-bottom: 30px;
    transition: all 0.3s ease;
    position: relative;
}

/* Watch Later Button - Top right of controls */
#watchLaterBtn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 16px 16px;
    font-size: 0.9rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
    z-index: 10;
}

#watchLaterBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

#watchLaterBtn:active {
    transform: translateY(0);
}

.control-group {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.control-group:last-child {
    margin-bottom: 0;
}

label {
    font-weight: 600;
    color: var(--text-light);
    min-width: 120px;
}

input {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    flex: 1;
    max-width: 300px;
    background: var(--card-bg);
    color: var(--text-color);
}

input:focus {
    outline: none;
    border-color: #667eea;
}

/* Input Button Group Styles */
.input-button-group {
    display: flex;
    gap: 20px;
    align-items: center;
    flex: 1;
}

.input-button-group input {
    flex: 1;
}

.input-button-group button {
    flex-shrink: 0;
}

/* Runtime Slider Styles */
.slider-container {
    flex: 1;
    max-width: 300px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--text-light);
}

#runtimeValue {
    font-weight: 600;
    color: #667eea;
}

#runtimeSlider {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: var(--border-color);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    margin: 10px 0 5px 0;
}

#runtimeSlider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

#runtimeSlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#runtimeSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

button {
    padding: 10px 20px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

button:active {
    transform: translateY(0);
}

/* Dark Mode Toggle - Fixed to top right */
#darkModeToggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    padding: 12px 16px;
    border-radius: 50px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
    
#darkModeToggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.stats {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    color: var(--text-light);
    box-shadow: 0 4px 15px var(--shadow);
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.movie-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px var(--shadow);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out, background 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
}

/* Watch Later Button */
.watch-later-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10;
}

.watch-later-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.watch-later-btn.in-watch-later {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.watch-later-btn.in-watch-later:hover {
    background: linear-gradient(45deg, #5a6fd8, #6a4190);
}

/* Dark theme adjustments for watch later button */
[data-theme="dark"] .watch-later-btn {
    background: rgba(22, 33, 62, 0.9);
    color: #e8e8e8;
}

[data-theme="dark"] .watch-later-btn:hover {
    background: rgba(22, 33, 62, 1);
}

/* Visible state for scroll-triggered animations */
.movie-card.visible {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
}

.movie-card:hover {
    transform: translateY(-5px) scale(1.02) !important;
    box-shadow: 0 15px 40px var(--shadow-hover);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease !important;
}

.movie-card:hover .movie-title {
    color: white;
}

.movie-card:hover .movie-description {
    color: rgba(255, 255, 255, 0.9);
}

.movie-card:hover .movie-year {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.movie-card:hover .movie-runtime {
    color: rgba(255, 255, 255, 0.8);
}

.movie-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(45deg, #667eea, #764ba2);
}

.movie-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 10px;
    line-height: 1.3;
}

.movie-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.movie-year {
    background: var(--border-color);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
}

.movie-rating {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

.movie-runtime {
    color: var(--text-light);
    font-size: 0.9rem;
}

.movie-description {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 0.95rem;
}

.loading {
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: white;
}

.no-results {
    text-align: center !important;
    padding: 50px;
    color: white;
    font-size: 1.1rem;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto;
    max-width: 100%;
    box-sizing: border-box;
    grid-column: 1 / -1;
}

.footer {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    margin-top: 50px;
    padding: 30px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    color: white;
    padding: 0 20px;
}

.footer-content p {
    margin-bottom: 8px;
    font-weight: 400;
}

.footer-content p:first-child {
    font-weight: 600;
    font-size: 1rem;
}

.footer-content p:last-child {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    /* Controls adjustments for mobile */
    .controls {
        padding: 20px 20px 25px 20px;
        position: relative;
    }
    
    /* Watch Later Button - Mobile adjustments */
    #watchLaterBtn {
        position: static;
        display: block;
        width: 100%;
        margin-bottom: 20px;
        padding: 12px 16px;
        font-size: 0.9rem;
        border-radius: 10px;
        text-align: center;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group label {
        min-width: auto;
        margin-bottom: 5px;
    }
    
    /* First control group special arrangement (rating + filter) */
    .control-group:first-child {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group:first-child .input-button-group {
        display: flex;
        gap: 20px;
        align-items: center;
    }
    
    .control-group:first-child input {
        flex: 1;
        max-width: none;
    }
    
    .control-group:first-child button {
        flex-shrink: 0;
        min-width: 80px;
    }
    
    .movies-grid {
        grid-template-columns: 1fr;
    }
    
    /* Dark Mode Button - Mobile adjustments */
    #darkModeToggle {
        top: 15px;
        right: 15px;
        padding: 8px;
        font-size: 1.2rem;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Hide text on mobile, show only emoji */
    #darkModeToggle::before {
        content: attr(data-emoji);
    }
    
    #darkModeToggle {
        font-size: 0; /* Hide text */
    }
    
    #darkModeToggle::before {
        font-size: 1.2rem;
    }
    
    /* Button grid - Mobile responsive */
    .control-group:last-child {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .control-group:last-child button {
        font-size: 0.9rem;
        padding: 12px 10px;
    }
    
    /* Runtime slider mobile adjustments */
    .slider-container {
        max-width: 100%;
        position: relative;
    }
    
    /* Show only min-max on mobile */
    .slider-labels {
        display: flex;
        justify-content: space-between;
        margin-top: 5px;
        font-size: 0.65rem;
        color: var(--text-light);
    }
    
    .slider-labels span:first-child,
    .slider-labels span:last-child {
        display: block;
    }
    
    /* Place middle value above slider */
    #runtimeValue {
        position: absolute;
        top: -25px;
        left: 50%;
        transform: translateX(-50%);
        font-weight: 600;
        color: #667eea;
        font-size: 0.8rem;
        background: var(--card-bg);
        padding: 2px 8px;
        border-radius: 12px;
        border: 1px solid #667eea;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    /* Hide middle label */
    .slider-labels span:nth-child(2) {
        display: none;
    }
}

/* Custom Scrollbar - Simple and effective */
::-webkit-scrollbar {
    width: 24px;
}

::-webkit-scrollbar-track {
    background: #2d1b69;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 8px;
    min-height: 50px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #5a6fd8, #6a4190);
}

::-webkit-scrollbar-corner {
    background: #2d1b69;
}

/* Firefox scrollbar */
html {
    scrollbar-width: auto;
    scrollbar-color: #667eea #2d1b69;
}
