:root {
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --text-main: #f5f5f7;
    --text-muted: #86868b;
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --accent: #2997ff;
    --danger: #ff3b30;
    --success: #34c759;
    --border-color: #424245;
    --modal-overlay: rgba(0, 0, 0, 0.4);
    --modal-bg: rgba(28, 28, 30, 0.85);
    --radius: 18px;
    --btn-radius: 980px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
    --transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

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

.hidden {
    display: none !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-y: scroll;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    width: 100%;
    max-width: 100%;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px 40px;
    width: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
    box-sizing: border-box;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 90;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 40px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-left: -40px;
    margin-right: -40px;
    padding-left: 40px;
    padding-right: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
}

.logo svg {
    color: var(--text-main);
}

.logo h1 {
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

nav {
    display: flex;
    background: #1c1c1e;
    padding: 4px;
    border-radius: var(--btn-radius);
}

#desktop-nav {
    display: flex;
}

/* Mobile menu hidden on desktop - will be shown on mobile via media query */
#main-nav {
    display: none;
}

.mobile-menu-toggle {
    display: none;
}

nav button {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 20px;
    border-radius: var(--btn-radius);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

nav button:hover {
    color: var(--text-main);
}

nav button.active {
    background: #3a3a3c;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.user-dropdown {
    position: relative;
}

.user-name-btn {
    background: none;
    border: none;
    color: var(--text-main);
    padding: 0;
    cursor: pointer;
    display: inline-block;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.user-name-btn:hover {
    color: var(--accent);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000; /* Higher z-index to ensure it's above everything */
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    box-sizing: border-box;
    /* Ensure full border visibility - no pseudo-elements covering it */
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-main);
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    transition: var(--transition);
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.dropdown-item span {
    flex: 1;
}

#user-display-name-text {
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
}

#logout-btn {
    display: none; /* Hide mobile logout button on desktop */
}

/* Hide mobile logout button in nav on desktop */
nav .mobile-logout {
    display: none;
}

/* Controls Row */
.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

#filter-bar {
    display: flex;
    gap: 16px;
    flex: 1;
    max-width: 600px;
}

/* Search Inputs & Selects */
input, select, textarea {
    background: #1c1c1e;
    border: 1px solid transparent;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    background: #2c2c2e;
    border-color: var(--primary);
}

/* Search Wrapper with Icon */
.search-wrapper-main {
    position: relative;
    flex: 1;
}

.search-wrapper-main input {
    width: 100%;
    padding-left: 42px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-wrapper {
    position: relative;
}

.search-icon-small {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

#imdb-search {
    padding-left: 36px;
}

/* Select Dropdown */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%2386868b%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px; 
    cursor: pointer;
    min-width: 150px;
    transition: background-color 0.4s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.4s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

select:hover {
    background-color: #2c2c2e;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--btn-radius);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(0, 113, 227, 0.4);
}

.btn-secondary {
    background-color: rgba(255,255,255,0.1);
    color: var(--text-main);
    border: none;
    padding: 12px 24px;
    border-radius: var(--btn-radius);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Modal Common */
.modal {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--modal-bg);
    width: 90%;
    max-width: 900px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255,255,255,0.1);
}

.modal-content-small {
    max-width: 600px;
    flex-direction: column;
    display: flex;
}

.modal:not(.hidden) .modal-content {
    transform: scale(1) translateY(0);
}

.close-modal {
    background: rgba(60, 60, 67, 0.6);
    border: none;
    color: #ebebf5;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.close-modal:hover {
    background: rgba(60, 60, 67, 0.9);
    transform: scale(1.1);
}

/* Add Movie Modal Specifics */
.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-body-form {
    padding: 32px;
    padding-bottom: 40px;
    overflow-y: auto;
    max-height: 80vh;
}

#add-movie-form.hidden {
    display: none;
}

.manual-entry-link {
    color: var(--accent);
    cursor: pointer;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 15px;
    font-weight: 500;
}

.manual-entry-link:hover {
    text-decoration: underline;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

input, textarea {
    width: 100%;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 30px;
}

.error-message {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.2);
    color: var(--danger);
    padding: 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: none;
    text-align: center;
}

.divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 24px 0;
}

/* IMDb Results in Modal */
.imdb-search-container {
    position: relative;
}

.imdb-results {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    margin-top: 8px;
    background: #2c2c2e;
    border: 1px solid #3a3a3c;
    border-radius: 16px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    padding: 8px;
}

.imdb-result-item {
    display: flex;
    gap: 12px;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    align-items: center;
}

.imdb-result-item:hover {
    background: rgba(255,255,255,0.1);
}

.imdb-result-img {
    width: 36px;
    height: 54px;
    object-fit: cover;
    border-radius: 4px;
    background: #1c1c1e;
}

.imdb-result-title {
    font-size: 0.9rem;
    color: white;
}

.imdb-result-year {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Details Modal Specifics */
.close-modal#close-details-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.modal-body {
    display: flex;
    width: 100%;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

.modal-poster {
    width: 38%; /* Slightly smaller to crop edges */
    min-height: 500px;
    background: #000 !important; /* Black background to hide any gaps */
    position: relative;
    display: block;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    overflow: hidden;
    flex-shrink: 0;
}

.modal-poster img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 105% !important; /* Slightly larger to crop edges */
    height: 105% !important; /* Slightly larger to crop edges */
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    transform: translate(-2.5%, -2.5%); /* Center the oversized image */
}

@media (max-width: 850px) {
    .modal-poster {
        border-radius: 24px 24px 0 0; /* Top radius for mobile */
    }
    
    .modal-poster img {
        border-radius: 24px 24px 0 0; /* Top radius for mobile */
    }
}

.modal-info {
    padding: 50px;
    width: 60%;
    display: flex;
    flex-direction: column;
}

.modal-info h2 {
    font-size: 2.5rem;
    margin-bottom: 12px;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.modal-meta {
    display: flex;
    gap: 12px;
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 30px;
    align-items: center;
    font-weight: 500;
    line-height: 1;
    flex-wrap: wrap;
}

.modal-platforms-row {
    margin-bottom: 30px;
}

.modal-platform-badges {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.modal-platform-badges .platform-badge {
    font-size: 0.8rem;
    padding: 0;
    height: auto;
    min-height: 28px;
    margin: 0;
}

.dot {
    font-size: 0.4rem;
    opacity: 0.5;
}

.star-rating {
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
    vertical-align: middle;
}

.star-icon {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    fill: currentColor;
    display: block;
    position: relative;
    top: -1px;
}

#modal-desc {
    color: #f5f5f7;
    margin-bottom: 40px;
    line-height: 1.6;
    font-size: 1.05rem;
    flex: 1;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.btn-trailer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: white;
    color: black;
    text-decoration: none;
    padding: 14px 28px;
    border-radius: var(--btn-radius);
    font-weight: 600;
    text-align: center;
    transition: var(--transition);
    font-size: 1rem;
    cursor: pointer;
}

.btn-trailer:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(255,255,255,0.2);
}

.btn-justwatch {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-status-actions {
    display: flex;
    gap: 16px;
}

.btn-action {
    flex: 1;
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: white;
    border-radius: var(--btn-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-action:hover {
    background: rgba(255,255,255,0.15);
    border-color: white;
}

.delete-btn {
    color: var(--danger);
    border-color: rgba(255, 59, 48, 0.3);
}

.delete-btn:hover {
    background: rgba(255, 59, 48, 0.1);
    border-color: var(--danger);
}

/* Trailer Modal */
.trailer-content {
    width: 90%;
    max-width: 900px;
    background: black;
    padding: 0;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border: none;
}

.trailer-content .close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(0,0,0,0.5);
    z-index: 20;
}

@media (min-width: 900px) {
    .trailer-content .close-modal {
        right: -40px;
        top: 0;
    }
}

.video-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
    row-gap: 50px;
}

/* Movie Card */
.movie-card {
    background: transparent;
    cursor: pointer;
    position: relative;
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    will-change: transform;
    transform: translateZ(0); /* Force GPU acceleration */
}

.card-image {
    height: 330px;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    position: relative;
    transition: var(--transition);
    transform-origin: center bottom;
    margin-bottom: 14px;
    background: transparent;
    padding: 0 !important;
    margin: 0 0 14px 0 !important;
    border: 0 solid transparent !important; /* Explicitly remove border */
    outline: 0 solid transparent !important;
    box-sizing: border-box;
    display: block;
}

.card-image > * {
    border: none !important;
    outline: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.card-image img {
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    transition: transform 0.5s ease, opacity 0.4s ease;
    will-change: transform, opacity;
    transform: translateZ(0); /* Force GPU acceleration */
    content-visibility: auto; /* Improve rendering performance */
    contain-intrinsic-size: 220px 330px; /* Hint for layout */
}

.movie-poster {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    background-color: transparent;
}

.movie-poster.image-loading {
    opacity: 0;
    filter: blur(2px);
    transition: opacity 0.5s ease-in-out, filter 0.5s ease-in-out;
}

.movie-poster.image-loaded {
    opacity: 1;
    filter: blur(0);
}

.movie-poster.image-error {
    opacity: 0;
}

.movie-card {
    background: transparent;
    cursor: pointer;
    position: relative;
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    will-change: transform;
    transform: translateZ(0); /* Force GPU acceleration */
    /* Transition for layout changes (if View Transitions not supported) */
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Shimmer Effect for loading images - merged with main .card-image above */

.card-image::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-20deg) translateX(-150%);
    animation: shimmer 1.5s infinite;
    z-index: 1;
    pointer-events: none;
}

/* Hide shimmer when image is loaded */
.card-image.loaded::before {
    display: none;
}

@keyframes shimmer {
    0% { transform: skewX(-20deg) translateX(-150%); }
    100% { transform: skewX(-20deg) translateX(150%); }
}

.card-image img {
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 solid transparent !important;
    outline: 0 solid transparent !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    background: transparent !important;
}

.platform-badge {
    background: transparent;
    color: white;
    padding: 0;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: auto;
    border: none;
}

.platform-badge img {
    height: 28px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
    vertical-align: middle;
    border-radius: 6px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.modal-platform-badges .platform-badge img {
    height: 32px;
    max-width: 160px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Hover effect removed */

/* Platform-specific border colors */
.platform-badge.platform-netflix img {
    border-color: #E50914 !important; /* Netflix Red */
}

.platform-badge.platform-disneyplus img {
    border-color: #5AA3FF !important; /* Disney+ Light Blue */
}

.platform-badge.platform-skyshowtime img {
    border-color: #ffffff !important; /* SkyShowtime White */
}

.platform-badge.platform-hbomax img {
    border-color: #8B50FF !important; /* HBO Max Purple */
}

.platform-badge.platform-voyo img {
    border-color: #FF6B00 !important; /* Voyo Orange */
}

.platform-badge.platform-unavailable,
a.platform-badge.platform-unavailable {
    background: rgba(100, 100, 100, 0.8) !important;
    border-color: rgba(150, 150, 150, 0.5) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

a.platform-badge.platform-unavailable:hover {
    background: rgba(120, 120, 120, 0.9) !important;
    border-color: rgba(180, 180, 180, 0.7) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    transform: scale(1.05);
}

.movie-card:hover .card-image {
    transform: scale(1.05) translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.no-image-placeholder {
    width: 100%;
    height: 100%;
    background: #1c1c1e;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 20px;
    text-align: center;
    font-weight: 500;
    border: 1px solid #2c2c2e;
}

/* Info under card */
.card-info {
    padding: 0 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.card-title {
    font-weight: 600;
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
    text-align: left;
    flex: 1;
}

.card-year {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.card-genres {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

/* Responsive */
@media (max-width: 850px) {
    .controls-row {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
        margin-bottom: 20px; /* Reduced spacing since button is floating */
        margin-top: 0;
    }
    
    .controls-row #open-add-modal {
        display: none; /* Hide the button in controls row on mobile */
    }
    #filter-bar {
        max-width: 100%;
        flex-direction: column;
    }
    .modal-content {
        flex-direction: column;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
    .modal-body {
        flex-direction: column !important;
    }
    .modal-poster {
        width: 100% !important;
        height: 350px;
        min-height: 350px;
        flex-shrink: 0;
    }
    .modal-info {
        width: 100% !important;
        padding: 24px 20px;
        flex: 1;
        overflow-y: auto;
    }
    .modal-info h2 {
        font-size: 1.75rem;
    }
    .modal-meta {
        font-size: 0.9rem;
    }
    .app-container {
        padding: 0 20px 20px;
        margin: 0;
        max-width: 100%;
    }
    
    /* Prevent unnecessary vertical scrolling on mobile */
    html {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        height: 100%;
    }
    
    body {
        overflow-y: auto;
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        height: auto;
    }
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;
    }
    .card-image {
        height: 240px;
    }
    
    .btn-primary {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .modal-actions {
        gap: 12px;
    }
    
    .btn-trailer {
        padding: 12px 24px;
        font-size: 0.95rem;
    }
    
    .btn-action {
        padding: 12px;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .modal-status-actions {
        flex-wrap: nowrap;
    }
    
    /* Floating Add Movie Button on Mobile */
    #open-add-modal {
        position: fixed;
        bottom: 24px;
        right: 24px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        padding: 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 16px rgba(0, 113, 227, 0.4);
        z-index: 90;
    }
    
    #open-add-modal svg {
        width: 24px;
        height: 24px;
    }
    
    #open-add-modal .btn-text {
        display: none;
    }
    
    /* Header Mobile */
    header {
        padding: 12px 20px;
        margin-left: -20px;
        margin-right: -20px;
        padding-left: 20px;
        padding-right: 20px;
        position: relative;
        margin-bottom: 20px;
    }
    
    .logo h1 {
        display: none;
    }
    
    .logo {
        gap: 0;
    }
    
    #desktop-nav {
        display: none; /* Hide desktop nav on mobile */
    }
    
    #main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 12px 20px;
        margin: 0;
        border-radius: 0;
        display: none;
        flex-direction: column;
        gap: 8px;
        z-index: 100;
    }
    
    #main-nav.mobile-open {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: flex;
        background: transparent;
        border: none;
        color: var(--text-main);
        padding: 8px;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        margin-right: 0;
        transition: var(--transition);
        position: relative;
        right: 0;
    }
    
    .mobile-menu-toggle:hover {
        opacity: 0.7;
    }
    
    .mobile-menu-toggle svg {
        width: 24px;
        height: 24px;
    }
    
    #main-nav button {
        width: 100%;
        padding: 12px;
        text-align: center;
        border-radius: 12px;
    }
    
    #main-nav .mobile-logout {
        margin-top: 4px;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding-top: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    
    #main-nav .mobile-logout svg {
        width: 18px;
        height: 18px;
    }
    
    .user-menu {
        gap: 8px;
    }
    
    /* Fix dropdown menu width on mobile to prevent horizontal overflow */
    .user-dropdown-menu {
        min-width: auto !important;
        max-width: calc(100vw - 40px) !important;
        right: 20px !important;
        left: auto !important;
    }
    
    #user-display-name {
        font-size: 0.85rem;
        display: none; /* Hide username on mobile */
    }
    
    #logout-btn-desktop {
        display: none; /* Hide desktop logout button on mobile */
    }
    
    /* Mobile logout button styling - matches desktop style */
    nav .mobile-logout {
        margin-top: auto;
        padding-top: 20px;
        border-top: 1px solid rgba(255,255,255,0.1);
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: var(--text-main);
        justify-content: flex-start;
    }
    
    nav .mobile-logout:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        transform: scale(1.02);
    }
    
    nav .mobile-logout svg {
        width: 18px;
        height: 18px;
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--modal-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.1);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.warning {
    border-left: 3px solid #ff9500;
}

/* Confirmation Dialog */
#confirm-modal .modal-content-small {
    max-width: 400px;
}

#confirm-modal .modal-body-form {
    padding-bottom: 24px;
}

#confirm-message {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 24px;
    line-height: 1.5;
}

#confirm-modal .form-actions {
    margin-top: 0;
    justify-content: flex-end;
}

@media (max-width: 850px) {
    #toast-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
    }
}