html, body {
    width: 100vw;
    height: 100vh;
    min-width: 100vw;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: linear-gradient(120deg, #f4f6fb 0%, #e3e9f7 100%);
    overflow-x: hidden;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    /* No z-index here */
}
#live-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0; /* Always behind app content */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.7s;
}
body.movies-bg #live-bg {
    opacity: 1;
}
.container {
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    border-radius: 18px;
    background: rgba(255,255,255,0.85);
    padding: 24px 16px;
    margin: 24px auto;
    max-width: 1200px;
}
header {
    padding: 32px 0 0 0;
    gap: 24px;
}
.search-controls {
    gap: 16px;
}
#search-input {
    border-radius: 8px;
    border: 1.5px solid #bfc9d9;
    padding: 10px 16px;
    font-size: 1.1rem;
    width: 280px;
}
#search-type, #sort-select, #filter-type, #filter-author {
    border-radius: 8px;
    border: 1.5px solid #bfc9d9;
    padding: 10px 16px;
    font-size: 1.1rem;
}
#search-btn {
    background: #0078d7;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
#search-btn:hover {
    background: #005fa3;
}
main {
    display: flex;
    gap: 30px;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    padding: 0 24px 24px 24px;
    background: transparent;
    position: relative;
    z-index: 2; /* Above .container and #live-bg */
}
#results-section {
    flex: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}
#results-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 28px;
    margin-top: 24px;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    overflow-x: visible;
}
#load-more-btn {
    margin: 20px auto 0 auto;
    display: block;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 5px;
    border: none;
    background: #0078d7;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}
#load-more-btn:hover {
    background: #005fa3;
}
#favorites-section {
    flex: 1;
    background: #f9f9f9;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 24px 12px;
    min-width: 220px;
    max-width: 300px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2; /* Above .container and #live-bg */
}
#favorites-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

/* Result Card Enhancements */
.result-card {
    min-width: 200px;
    min-height: 340px;
    background: #f8fafd;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.09);
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.18s cubic-bezier(.4,1.4,.6,1), box-shadow 0.18s;
    cursor: pointer;
    position: relative;
    padding-bottom: 10px;
    animation: fadeInCard 0.4s cubic-bezier(.4,1.4,.6,1);
}
.result-card:hover {
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 8px 24px rgba(0,0,0,0.16);
    background: #eaf3fb;
}
.result-card .cover {
    width: 150px;
    height: 220px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    flex-shrink: 0;
}
.result-card .info {
    padding: 0 10px;
    text-align: center;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
}
.result-card h3 {
    margin: 8px 0 4px 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a2a3a;
}
.result-card p {
    margin: 2px 0;
    font-size: 1rem;
    color: #4a5a6a;
}
.fav-btn {
    margin-top: 8px;
    padding: 6px 14px;
    border-radius: 5px;
    border: none;
    background: #f0f4fa;
    color: #0078d7;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    display: block;
    width: 100%;
    max-width: 160px;
    align-self: center;
}
.fav-btn.active, .fav-btn:hover {
    background: #0078d7;
    color: #fff;
}

/* Favorites Card Enhancements */
.fav-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    padding: 10px 12px;
    margin-bottom: 8px;
    transition: box-shadow 0.18s;
    position: relative;
}
.fav-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.13);
    background: #f0f7ff;
}
.fav-cover {
    width: 50px;
    height: 70px;
    object-fit: cover;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.fav-info h4 {
    margin: 0 0 2px 0;
    font-size: 1rem;
    color: #1a2a3a;
}
.fav-info p {
    margin: 0 0 2px 0;
    font-size: 0.93rem;
    color: #4a5a6a;
}
.remove-fav-btn {
    margin-top: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    border: none;
    background: #fbeaea;
    color: #d7263d;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.remove-fav-btn:hover {
    background: #d7263d;
    color: #fff;
}

/* Modal Overlay (for details, to be implemented in JS) */
#modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    /* Use flex to center content */
    display: flex;
}
#modal-content {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    padding: 30px 24px;
    max-width: 400px;
    width: 90vw;
    position: relative;
    animation: modalIn 0.22s cubic-bezier(.4,1.4,.6,1) both, fadeInModal 0.3s cubic-bezier(.4,1.4,.6,1);
    margin: 0 auto;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Remove any vertical alignment issues */
}
@keyframes modalIn {
    from { transform: translateY(40px) scale(0.95); opacity: 0; }
    to { transform: none; opacity: 1; }
}
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}
#modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #888;
    cursor: pointer;
    transition: color 0.18s;
}
#modal-close:hover {
    color: #d7263d;
}

body.dark-mode {
    background: #181c24;
    color: #e3e6ee;
    transition: background 0.3s, color 0.3s;
}
.dark-mode .container {
    background: #232837;
    box-shadow: 0 2px 12px rgba(0,0,0,0.22);
}
.dark-mode header,
.dark-mode .search-controls {
    background: none;
}
.dark-mode #results-section {
    background: none;
}
.dark-mode #favorites-section {
    background: #232837;
    box-shadow: 0 1px 8px rgba(0,0,0,0.18);
}
.dark-mode .result-card {
    background: #232837;
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.dark-mode .result-card:hover {
    background: #2d3347;
}
.dark-mode .result-card h3,
.dark-mode .fav-info h4 {
    color: #e3e6ee;
}
.dark-mode .result-card p,
.dark-mode .fav-info p {
    color: #b6b9c7;
}
.dark-mode .fav-card {
    background: #232837;
    box-shadow: 0 1px 8px rgba(0,0,0,0.18);
}
.dark-mode .fav-card:hover {
    background: #2d3347;
}
.dark-mode .fav-btn {
    background: #232837;
    color: #7db7ff;
    border: 1px solid #2d3347;
}
.dark-mode .fav-btn.active, .dark-mode .fav-btn:hover {
    background: #0078d7;
    color: #fff;
}
.dark-mode .remove-fav-btn {
    background: #2d3347;
    color: #ff7d7d;
}
.dark-mode .remove-fav-btn:hover {
    background: #d7263d;
    color: #fff;
}
.dark-mode #modal-content {
    background: #232837;
    color: #e3e6ee;
}
.dark-mode #modal-close {
    color: #b6b9c7;
}
.dark-mode #modal-close:hover {
    color: #ff7d7d;
}
.dark-mode select,
.dark-mode input[type="text"] {
    background: #232837;
    color: #e3e6ee;
    border: 1px solid #2d3347;
}
.dark-mode #sort-filter-bar label {
    color: #b6b9c7;
}

/* Improved empty state messages */
.no-results, .no-favs {
    text-align: center;
    color: #b6b9c7;
    font-size: 1.1rem;
    margin: 30px 0 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.no-results:before {
    content: "🔍";
    font-size: 2.2rem;
    display: block;
}
.no-favs:before {
    content: "⭐";
    font-size: 2.2rem;
    display: block;
}

/* Responsive sort/filter bar */
#sort-filter-bar {
    flex-wrap: wrap;
    row-gap: 8px;
}
#sort-filter-bar > * {
    margin-bottom: 4px;
}

/* Consistent button styles */
button, .fav-btn, .remove-fav-btn {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    background: #0078d7;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}
button:hover, .fav-btn:hover, .remove-fav-btn:hover {
    background: #005fa3;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
}
button:focus, .fav-btn:focus, .remove-fav-btn:focus {
    box-shadow: 0 0 0 2px #0078d7aa;
}
#dark-mode-toggle {
    background: #22223b;
    color: #fff;
}
#dark-mode-toggle:hover {
    background: #4a4e69;
}

/* Highlight active filter controls */
#sort-filter-bar select:focus, #sort-filter-bar input:focus {
    border: 1.5px solid #0078d7;
    background: #f0f7ff;
}
.dark-mode #sort-filter-bar select:focus, .dark-mode #sort-filter-bar input:focus {
    border: 1.5px solid #7db7ff;
    background: #232837;
}

/* Live animated background for movies */
#live-bg .gradient {
    position: absolute;
    width: 200vw;
    height: 200vh;
    left: -50vw;
    top: -50vh;
    background: radial-gradient(circle at 30% 40%, #1e3c72cc 0%, #2a5298bb 60%, transparent 100%),
                radial-gradient(circle at 70% 60%, #ee9ca7bb 0%, #ffdde1aa 60%, transparent 100%);
    animation: bgMove 18s linear infinite alternate;
    filter: blur(60px) saturate(1.2);
}
@keyframes bgMove {
    0% { transform: scale(1) translate(0,0); }
    100% { transform: scale(1.1) translate(60px, 40px); }
}
#live-bg .particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.18;
    background: #fff;
    pointer-events: none;
    animation: floatParticle 12s linear infinite;
}
@keyframes floatParticle {
    0% { transform: translateY(0) scale(1); opacity: 0.18; }
    50% { opacity: 0.32; }
    100% { transform: translateY(-120vh) scale(1.2); opacity: 0; }
}

/* Glassmorphism for cards */
.result-card, .fav-card, #modal-content {
    background: rgba(255,255,255,0.82);
    box-shadow: 0 4px 32px 0 rgba(30,40,60,0.10), 0 1.5px 8px 0 rgba(30,40,60,0.08);
    backdrop-filter: blur(8px) saturate(1.2);
    border: 1.5px solid rgba(200,210,255,0.13);
}
.dark-mode .result-card, .dark-mode .fav-card, .dark-mode #modal-content {
    background: rgba(35,40,55,0.88);
    box-shadow: 0 4px 32px 0 rgba(10,20,40,0.22), 0 1.5px 8px 0 rgba(10,20,40,0.13);
    border: 1.5px solid rgba(80,120,200,0.13);
}

/* Elevate header and main above background */
.container, header, main, #modal-overlay {
    position: relative;
    z-index: 1;
}

/* Modern Loading Spinner */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 120px;
}
.loading::after {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    border: 5px solid #bfc9d9;
    border-top: 5px solid #0078d7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button Click Animation */
button:active, .fav-btn:active, .remove-fav-btn:active {
    transform: scale(0.96);
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* Card Hover Animation */
.result-card {
    transition: transform 0.18s cubic-bezier(.4,1.4,.6,1), box-shadow 0.18s;
}
.result-card:hover {
    transform: translateY(-6px) scale(1.04);
    box-shadow: 0 8px 24px rgba(0,0,0,0.16);
    background: #eaf3fb;
}

/* Focus Styles for Accessibility */
button:focus, .fav-btn:focus, .remove-fav-btn:focus, input:focus, select:focus {
    outline: 2.5px solid #0078d7;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #0078d7aa;
}

/* Modal Overlay Blur and Centering */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100vw;
}
.modal-blur-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 34, 54, 0.13); /* was 0.32, now lighter */
    box-shadow: 0 0 0 100vw rgba(30,34,54,0.07) inset; /* was 0.18, now lighter */
    backdrop-filter: blur(4px) saturate(1.1); /* was 7px, now softer */
    -webkit-backdrop-filter: blur(4px) saturate(1.1);
    transition: opacity 0.25s cubic-bezier(.4,1.4,.6,1), backdrop-filter 0.25s cubic-bezier(.4,1.4,.6,1);
}
#modal-overlay[aria-modal="true"] {
    opacity: 0;
    pointer-events: none;
}
#modal-overlay[aria-modal="true"].active {
    opacity: 1;
    pointer-events: auto;
}
#modal-content {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    padding: 32px 28px 24px 28px;
    max-width: 420px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    z-index: 10001;
    transform: translateY(40px) scale(0.98);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(.4,1.4,.6,1), opacity 0.25s cubic-bezier(.4,1.4,.6,1);
    animation: modalZoomIn 0.32s cubic-bezier(.4,1.4,.6,1);
}
@keyframes modalZoomIn {
    0% { transform: scale(0.92) translateY(60px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}
#modal-overlay.active #modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}
#modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #222;
    cursor: pointer;
    z-index: 10002;
    transition: color 0.18s;
}
#modal-close:hover, #modal-close:focus {
    color: #0078d7;
}
@keyframes modalPulse {
    0% { box-shadow: 0 0 0 0 #0078d7; }
    70% { box-shadow: 0 0 0 8px #0078d766; }
    100% { box-shadow: 0 0 0 0 #0078d7; }
}
@media (max-width: 600px) {
    #modal-content {
        padding: 18px 6vw 16px 6vw;
        max-width: 98vw;
    }
}

/* Theme Picker Styles */
#theme-picker {
    border-radius: 8px;
    border: 1.5px solid #bfc9d9;
    padding: 10px 16px;
    font-size: 1.1rem;
    background: #f9f9f9;
    color: #1a2a3a;
    margin-left: 8px;
    cursor: pointer;
    transition: border 0.2s;
}
#theme-picker:focus {
    border: 1.5px solid #0078d7;
}

/* Blue Theme */
.theme-blue body {
    background: linear-gradient(120deg, #e0f0ff 0%, #b3d8f7 100%);
}
.theme-blue .container {
    background: rgba(230, 245, 255, 0.92);
    box-shadow: 0 4px 24px rgba(0, 120, 215, 0.08);
}
.theme-blue header,
.theme-blue #results-section,
.theme-blue #favorites-section {
    background: transparent;
}
.theme-blue .result-card {
    background: #e6f5ff;
    box-shadow: 0 4px 16px rgba(0,120,215,0.09);
}
.theme-blue .result-card:hover {
    background: #d0eaff;
}
.theme-blue .fav-card {
    background: #f0f8ff;
}
.theme-blue button, .theme-blue .fav-btn, .theme-blue .remove-fav-btn {
    background: #2196f3;
    color: #fff;
}
.theme-blue button:hover, .theme-blue .fav-btn:hover, .theme-blue .remove-fav-btn:hover {
    background: #1769aa;
}
.theme-blue #dark-mode-toggle {
    background: #1769aa;
}
.theme-blue #dark-mode-toggle:hover {
    background: #2196f3;
}

/* Light Theme (default) */
.theme-light body {
    background: linear-gradient(120deg, #f4f6fb 0%, #e3e9f7 100%);
}
.theme-light .container {
    background: rgba(255,255,255,0.85);
}

/* Dark Theme (existing) */
.theme-dark body {
    background: linear-gradient(120deg, #232946 0%, #1a1a2e 100%);
}
.theme-dark .container {
    background: rgba(34,34,59,0.92);
}
.theme-dark header,
.theme-dark #results-section,
.theme-dark #favorites-section {
    background: transparent;
}

@media (max-width: 900px) {
    .container {
        max-width: 98vw;
        padding: 8px 2vw;
    }
    main {
        flex-direction: column;
        gap: 16px;
        padding: 0 2vw 2vw 2vw;
    }
    #favorites-section {
        max-width: 100%;
        min-width: 0;
        margin-top: 18px;
    }
}
@media (max-width: 600px) {
    header {
        padding: 18px 0 0 0;
        gap: 12px;
    }
    .search-controls {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    #search-input {
        width: 100%;
        min-width: 0;
    }
    .container {
        padding: 4px 0;
    }
} 

/* Skip to Content Link */
.skip-link {
    position: absolute;
    left: -999px;
    top: 10px;
    background: #0078d7;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    z-index: 1000;
    font-size: 1.1rem;
    transition: left 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13);
}
.skip-link:focus {
    left: 16px;
    outline: 2.5px solid #fff;
    box-shadow: 0 4px 16px #0078d7cc;
}

/* Animated Background */
body {
    animation: bgMove 16s linear infinite alternate;
    background-size: 200% 200%;
}
@keyframes bgMove {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* Result Card Animation */
.result-card {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    animation: fadeInCard 0.6s cubic-bezier(.4,1.4,.6,1) forwards;
}
@keyframes fadeInCard {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
} 

#modal-overlay, .modal-blur-bg {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto;
}
#modal-content {
    position: relative !important;
    margin: 0 auto !important;
    top: unset !important;
    left: unset !important;
    right: unset !important;
    bottom: unset !important;
    transform: none;
} 

.gutenberg-download-btn {
    display: inline-block;
    padding: 10px 20px;
    margin: 6px 10px 0 0;
    border-radius: 8px;
    background: #2196f3;
    color: #fff !important;
    font-weight: 600;
    font-size: 1.05rem;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(33,150,243,0.08);
    transition: background 0.18s, box-shadow 0.18s, color 0.18s;
    border: none;
    cursor: pointer;
    outline: none;
    vertical-align: middle;
    position: relative;
}
.gutenberg-download-btn:hover, .gutenberg-download-btn:focus {
    background: #1769aa;
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(33,150,243,0.16);
    text-decoration: none;
}
.gutenberg-download-btn::before {
    content: "\1F4E5 "; /* 📥 */
    font-size: 1.1em;
    margin-right: 6px;
    vertical-align: middle;
} 