/* Top 50 Page Styling */
.top50-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 1rem 2rem; /* Added padding-top to account for the fixed header */
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, #fff, var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.page-header .subtitle {
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

/* Tabs */
.top50-container .tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.top50-container .tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.top50-container .tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.top50-container .tab-btn.active {
    background: rgba(var(--color-primary-rgb, 0, 240, 255), 0.2);
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(var(--color-primary-rgb, 0, 240, 255), 0.3);
}

/* Controls */
.top50-container .controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: rgba(20, 20, 30, 0.6);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    position: relative;
    z-index: 100;
}

.top50-container .search-wrapper {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.top50-container #movie-search {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.top50-container #movie-search::placeholder {
    color: rgba(255,255,255,0.5);
}

.top50-container #movie-search:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(var(--color-primary-rgb, 0, 240, 255), 0.3);
    background: rgba(0, 0, 0, 0.9);
}

.top50-container .action-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.top50-container .btn-primary, .top50-container .btn-secondary {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: 'Inter', sans-serif;
    text-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.top50-container .btn-primary {
    background: #00f0ff !important; /* Force bright cyan */
    color: #000000 !important; /* Force black text */
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.top50-container .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
    background: #ffffff !important;
}

.top50-container .btn-secondary {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.top50-container .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* Search Results */
.top50-container .search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: rgba(15, 15, 25, 0.98);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 999;
    box-shadow: 0 15px 35px rgba(0,0,0,0.9);
}

.top50-container .search-results.hidden {
    display: none;
}

.top50-container .search-item {
    display: flex;
    align-items: center;
    padding: 0.8rem;
    gap: 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top50-container .search-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.top50-container .search-item img {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    pointer-events: none;
}

.top50-container .search-item-info {
    flex: 1;
}

.top50-container .search-item-title {
    font-weight: 600;
    margin: 0;
    color: #ffffff;
}

.top50-container .search-item-year {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    margin: 0;
}

/* Movie Grid */
.top50-container .movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.top50-container .movie-slot {
    background: rgba(20, 20, 30, 0.8);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 2/3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    user-select: none;
}

.top50-container .movie-slot.empty {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

.top50-container .movie-slot.empty:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
}

.top50-container .movie-slot.filled {
    cursor: grab;
    touch-action: none; /* Fix for mobile dragging */
}

.top50-container .movie-slot.filled:active {
    cursor: grabbing;
}

.top50-container .movie-slot.filled:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.top50-container .slot-rank {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.85);
    color: var(--color-primary);
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
    border: 2px solid var(--color-primary);
    box-shadow: 0 0 10px rgba(var(--color-primary-rgb, 0, 240, 255), 0.5);
}

.top50-container .slot-placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-size: 3rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
}

.top50-container .movie-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none; /* Critical: Prevent browser from trying to drag the image file */
    user-select: none;
    -webkit-user-drag: none;
}

.top50-container .movie-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.95));
    padding: 1.5rem 1rem 1rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    pointer-events: none; /* Let drag pass through to the slot container */
}

.top50-container .movie-slot.filled:hover .movie-overlay {
    transform: translateY(0);
}

.top50-container .movie-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.top50-container .remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: 2px solid white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.2s ease;
}

.top50-container .movie-slot.filled:hover .remove-btn {
    display: flex;
}

.top50-container .remove-btn:hover {
    background: red;
    transform: scale(1.1);
}

/* View Only Banner */
.top50-container .banner {
    background: rgba(var(--color-secondary-rgb, 112, 0, 255), 0.2);
    border: 1px solid var(--color-secondary);
    padding: 1rem;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.top50-container .banner a {
    color: var(--color-primary);
    font-weight: bold;
    text-decoration: none;
}

.top50-container .banner a:hover {
    text-decoration: underline;
}

/* Loading */
.top50-container #loading-indicator {
    text-align: center;
    padding: 3rem;
}

.top50-container .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--color-primary);
    border-radius: 50%;
    animation: top50-spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes top50-spin {
    100% { transform: rotate(360deg); }
}

.top50-container .hidden {
    display: none !important;
}

/* Modal */
.top50-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.top50-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.top50-modal-content {
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    padding: 2rem;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    transform: translateY(0);
    transition: transform 0.3s ease;
    color: white;
}

.top50-modal.hidden .top50-modal-content {
    transform: translateY(20px);
}

.top50-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.2s ease;
}

.top50-modal-close:hover {
    color: white;
}

.top50-modal-body {
    display: flex;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .top50-modal-body {
        flex-direction: column;
    }
}

.top50-modal-poster {
    width: 150px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.top50-modal-info h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
}

.top50-modal-info p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.top50-modal-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Responsive */
@media (max-width: 768px) {
    .top50-container .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
    .top50-container .slot-rank {
        width: 25px;
        height: 25px;
        font-size: 0.9rem;
    }
}
