/* misc.css - Styles specific to the misc page */

/* Page colors */
body {
    background-color: #069494;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: 100vh !important;
    margin: 0;
    cursor: none;
}

a, button, .film-card, .top4-card, .artist-card {
    cursor: none;
}

.page-header .home-btn:hover {
    background: #a69b8f;
    border-color: #a69b8f;
    color: #000000;
}

/* Override z-index so content appears above triangles */
#background-animation {
    z-index: 1 !important;
}

.page-container {
    position: relative;
    z-index: 10 !important;
    padding: 20px 50px 20px;
    height: 100vh;
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.page-header {
    margin-bottom: 10px;
    flex-shrink: 0;

    & h1 {
        font-size: 32px;
    }

    @media (max-width: 768px) {
        & .home-btn {
            margin-left: auto;
            margin-right: auto;
        }
    }

    & .home-btn {
        padding: 8px 18px;
        font-size: 16px;
    }
}

.page-content h2 {
    font-size: 24px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.page-content section {
    margin-bottom: 0 !important;
}

/* =============================================================================
   TWO-COLUMN LAYOUT
   ============================================================================= */

.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
    min-height: 600px;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.right-column {
    overflow: visible;
}

.right-column section {
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.right-column .films-row {
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.right-column .film-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
}

.right-column .film-card img {
    flex: 1;
    min-height: 0;
    object-fit: contain;
}

.column section {
    display: flex;
    flex-direction: column;
}

.column section > *:last-child:not(h2) {
    min-height: 0;
}

@media (max-width: 900px) {
    .two-column-layout {
        grid-template-columns: 1fr;
        gap: 30px;
        height: auto;
    }

    .page-container {
        height: auto;
        overflow: auto;
    }
}

/* =============================================================================
   TOP ARTISTS - HORIZONTAL ROW
   ============================================================================= */

.artists-row {
    display: flex;
    gap: 12px;
    overflow: hidden;
    align-items: center;
}

.artist-card {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 10px;
    text-align: center;
}

.artist-card .artist-img {
    width: 90px;
    height: 90px;
    max-width: 100%;
    max-height: 100%;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 6px;
}

.artist-card .rank {
    font-size: 18px;
    font-weight: bold;
    opacity: 0.5;
}

.artist-card .name {
    font-size: 13px;
    margin: 4px 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.artist-card .plays {
    font-size: 10px;
    opacity: 0.7;
}

/* =============================================================================
   NOW PLAYING SECTION
   ============================================================================= */

.now-playing {
    display: flex;
    gap: 14px;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 10px;
}

.album-art {
    width: 70px;
    height: 70px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.track-info {
    flex: 1;
    min-width: 0;
}

.track-name {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.artist-name {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 6px;
}

.progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-bar {
    height: 100%;
    background: white;
    border-radius: 2px;
    width: 0%;
    transition: none;
}

.progress-time {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    opacity: 0.7;
}

.play-status {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
}

/* =============================================================================
   QUEUE SECTION
   ============================================================================= */

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.left-column section:last-child {
    display: flex;
    flex-direction: column;
}

.left-column section:last-child .queue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 10px;
    border-radius: 6px;
}

.queue-item img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
}

.queue-item-info {
    min-width: 0;
}

.queue-track {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-artist {
    font-size: 13px;
    opacity: 0.7;
}

/* =============================================================================
   FILMS - HORIZONTAL ROW OF 4
   ============================================================================= */

.films-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.film-card {
    text-align: center;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.film-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 5px;
    margin: 0 auto 3px;
    display: block;
}

.right-column .film-card img {
    aspect-ratio: unset;
}

.film-card .title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.film-card .rating {
    font-size: 15px;
    color: #ffcc00;
    margin-top: 2px;
}

.film-card .year {
    font-size: 14px;
    opacity: 0.6;
}

/* =============================================================================
   STRAVA PLACEHOLDER
   ============================================================================= */

.right-column section:last-child {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    overflow: visible;
}

.strava-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    opacity: 0.6;
    font-size: 12px;
    min-height: 50px;
}

/* =============================================================================
   TOP 4 FILMS - HOVER FADE ANIMATION
   ============================================================================= */

#top4-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    overflow: visible;
}

/* Ensure parent section allows overflow for animation */
section:has(#top4-grid) {
    overflow: visible !important;
}

.top4-card {
    text-align: center;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    overflow: visible;
}

.top4-poster-wrapper {
    position: relative;
    cursor: none;
    overflow: visible;
}

.top4-image {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 5px;
}

.top4-front-image {
    position: relative;
    z-index: 2;
    display: block;
}

.top4-faders {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0;
    transition: opacity 1500ms;
    pointer-events: none;
}

.top4-card:hover .top4-faders {
    opacity: 1;
}

.top4-fader {
    position: absolute;
    left: 0;
    top: 0;
}

.top4-fader:nth-child(odd) {
    animation: top4-fade-left 3s linear infinite;
}

.top4-fader:nth-child(even) {
    animation: top4-fade-right 3s linear infinite;
}

.top4-fader:nth-child(3),
.top4-fader:nth-child(4) {
    animation-delay: 750ms;
}

.top4-fader:nth-child(5),
.top4-fader:nth-child(6) {
    animation-delay: 1500ms;
}

.top4-fader:nth-child(7),
.top4-fader:nth-child(8) {
    animation-delay: 2250ms;
}

@keyframes top4-fade-left {
    from {
        scale: 1;
        translate: 0%;
        opacity: 1;
    }
    to {
        scale: 0.8;
        translate: -30%;
        opacity: 0;
    }
}

@keyframes top4-fade-right {
    from {
        scale: 1;
        translate: 0%;
        opacity: 1;
    }
    to {
        scale: 0.8;
        translate: 30%;
        opacity: 0;
    }
}

.top4-card .title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}

.top4-card .year {
    font-size: 14px;
    opacity: 0.6;
}

/* Always show animation on touch/mobile devices */
@media (hover: none) {
    .top4-faders {
        opacity: 1;
    }
}

/* =============================================================================
   UTILITIES
   ============================================================================= */

.loading {
    opacity: 0.5;
    font-style: italic;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 600px) {

    body {
        overflow-x: hidden;
    }

    section {
        width: 100%;

        &>* {
            max-width: 100%;
        }

        & h2 {
            text-align: center;
        }
    }

    .column {
        max-width: 100%;
        min-width: 0;
    }

    .queue-list {
            width: 100%;
        }

    .queue-item {
            text-align: left;
        }
    

    .page-container {
        padding: 15px 20px 40px;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .two-column-layout {
        max-width: 100%;
    }


    .page-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .now-playing {
        flex-direction: column;
        text-align: center;
    }

    .album-art {
        width: 100px;
        height: 100px;
    }

    .films-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .film-card {
        min-width: none;
        width: 100%;
    }

    #top4-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
        gap: 30px;
    }

    .top4-card .title {
        white-space: normal;
    }

    .top4-image {
        width: 100%;
        max-width: none;
        min-height: unset;
        height: auto;
        aspect-ratio: 2/3;
        object-fit: cover;
    }

    .artists-row {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .artist-card {
        flex: 0 0 calc(33.33% - 8px);
        min-width: 0;
        max-width: calc(33.33% - 8px);
    }

    .artist-card .artist-img {
        width: 50px;
        height: 50px;
    }
}