.up-next {
    background: #fff;
    border-radius: 12px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    max-height: calc(65vh - 2rem);
    height: calc(65vh - 2rem);
    overflow: hidden; /* Contain the scrolling child */
}

/* Mobile height */
@media (max-width: 768px) {
    .up-next {
        height: 200px;
        max-height: 200px;
        min-height: 200px;
    }
}

/* Desktop height */
@media (min-width: 769px) {
    .up-next {
        height: calc(65vh - 2rem);
        min-height: 400px;
        max-height: calc(65vh - 2rem);
    }
}

.up-next h2 {
    color: #dc3545;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    letter-spacing: -0.5px;
    text-align: left;
    padding-left: 0.5rem;
    flex-shrink: 0;
}

.upcoming-songs {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
    overflow-y: scroll;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    max-height: 100%;
    padding: 1rem 0.25rem;
    scroll-padding: 1rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    position: relative;
    margin-right: -0.25rem;
    padding-right: 0.5rem;
    will-change: transform; /* Optimize scrolling performance */
}

.load-more-button {
    width: 100%;
    padding: 0.75rem;
    text-align: center;
    color: #dc3545;
    font-weight: 500;
    background: #fff;
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: 8px;
    margin: 0.25rem 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-more-button:hover {
    background: #fff5f6;
    border-color: rgba(220, 53, 69, 0.3);
}

.load-more-button:active {
    transform: translateY(1px);
}

.load-more-button.loading {
    animation: pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0.5rem;
    text-align: center;
    color: #dc3545;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
    background: none;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.upcoming-song {
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

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

/* Mobile layout */
@media (max-width: 768px) {
    .upcoming-song {
        display: grid;
        grid-template-columns: 2rem 1fr;
        align-items: center;
        gap: 0.25rem;
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
        background: #f8f9fa;
        transition: all 0.2s ease;
    }

    .upcoming-song .position {
        font-size: 0.875rem;
        font-weight: 600;
        color: #dc3545;
        opacity: 0.9;
    }

    .upcoming-song .title {
        font-size: 0.8125rem;
        font-weight: 500;
        color: #212529;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .upcoming-song .artist {
        font-size: 0.75rem;
        color: #495057;
        font-weight: 400;
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Desktop layout */
@media (min-width: 769px) {
    .upcoming-song {
        display: grid;
        grid-template-columns: 3rem 1fr auto;
        align-items: center;
        gap: 0.75rem;
        padding: 1rem 1.25rem;
        border-radius: 12px;
        background: #f8f9fa;
        transition: all 0.2s ease;
    }

    .upcoming-song .position {
        font-size: 1rem;
        font-weight: 600;
        color: #dc3545;
        opacity: 0.9;
    }

    .upcoming-song .title {
        font-size: 0.95rem;
        font-weight: 500;
        color: #212529;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .upcoming-song .artist {
        font-size: 0.95rem;
        color: #495057;
        font-weight: 400;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Common hover effect */
.upcoming-song:hover {
    background: #f1f3f5;
    transform: translateX(4px);
}

/* Mobile artist separator */
@media (max-width: 768px) {
    .upcoming-song .artist::before {
        content: '- ';
        color: #6c757d;
    }
}

/* Desktop artist separator */
@media (min-width: 769px) {
    .upcoming-song .artist::before {
        content: '- ';
        color: #6c757d;
        margin: 0 0.5rem;
    }
}

.upcoming-song.current {
    background: #fff;
    border: 2px solid #dc3545;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.1);
}

/* Time slot entry styling */
.time-slot-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    margin: 0.5rem 0;
    background: #fff;
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: 8px;
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

.time-slot-entry .time {
    font-size: 0.95rem;
    font-weight: 600;
    color: #dc3545;
}

.time-slot-entry .day {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Mobile time slot layout */
@media (max-width: 768px) {
    .time-slot-entry {
        padding: 0.5rem 0.75rem;
        margin: 0.25rem 0;
    }

    .time-slot-entry .time {
        font-size: 0.875rem;
    }

    .time-slot-entry .day {
        font-size: 0.75rem;
    }
}

@media (min-width: 1920px) {
    .upcoming-song {
        padding: 1.25rem;
    }

    .upcoming-song .title {
        font-size: 1.1rem;
    }

    .upcoming-song .artist {
        font-size: 1rem;
    }
}
