:root {
    --bg-color: white;
    --light-green: rgb(0, 175, 0);
    --dark-green: rgb(0, 100, 0);
    --light-gray: lightgray;
    --dark-gray: darkgray;
    --reddish: rgb(175, 50, 0);
    --light-reddish: rgb(240, 190, 170);
    --flex-gap: 15px;
}
*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
#toggleSidebar{
    display: none;
}
nav{
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--light-gray);
}
nav ul{
    display: flex;
    flex-direction: row;
    list-style: none;
}
nav li{
    display: flex;
}
nav .home-li {
    margin-right: auto;
}
nav a {
    display: flex; /* padding works better with this */
    text-decoration: none;
    color: black;
    padding: 1em 2em;
}
nav a:hover {
    background-color: var(--light-reddish);
}
nav a.active-link {
    border-bottom: 2px solid var(--reddish);
}
#page {
    padding: 0em 1em;
    height: calc(100svh - 3.5em);
}
#page.flexrow {
    display: flex;
    flex-direction: row;
}
#songlist {
    flex: 1;
    max-height: 100%;
    overflow-y: auto;
    min-width: min-content;
    max-width: 20%;
    display: grid;
    row-gap: var(--flex-gap);
    grid-auto-flow: row;
    grid-template-columns: auto 44px;
    align-content: start;
    align-items: center;
    justify-items: start;
}
.header > * {
    margin: 0 0 2px 0;
}
.header {
    position: sticky; 
    top: 0; 
    width: 100%;
    grid-column: 1 / -1;
    background-color: var(--bg-color);
    padding: 1em 0 calc(1em - var(--flex-gap)) 0;
    border-bottom: 1px solid var(--light-gray);

    display: grid;
    grid-auto-flow: row;
    grid-template-columns: auto 44px;
    align-content: start;
    align-items: center;
    justify-items: start;
}
button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
}
#filterBtns{
    grid-column: 1 / -1;
}
#filterBtns button{
    margin-right: 5px;
    padding: 1px;
}
.filterSelect{
    border: 1px solid var(--reddish);
    border-radius: 5px;
}
#share {    
    border: solid #aeaeae 1px;
    background: #edededc2;
    padding: 5px;
    position: absolute;
    bottom: 50%;    
    right: -1rem;
    border-radius: 10px;
}
#user-area {
    max-height: 100%;
    flex: 1 1 auto;
    margin-top: 10px;
    display: flex;
    flex-direction: column-reverse; /* Stacks them vertically */
}
#details {
    position: absolute;
    top: 0;
    bottom: 0;
    padding: 1rem;
    align-self: center;
    width: 70%;
    max-height: 70%;
    overflow-y: auto;
    border: solid black;
    background-color: lightsalmon;
    z-index: 1;
}
p {
    width: fit-content;
    margin-left:auto;
    margin-right:auto;
    margin-block-end: 0;
    white-space: pre-wrap;
}
table {
    min-width: 70%;
    margin: 5px auto 5px auto;
}
tr {
    position: relative;
}
td {
    padding: 5px
}
#queue {
    position: relative;
    flex: 0 1 50%;
    margin-top: auto;
    overflow-y: auto;

    display: grid;
    row-gap: var(--flex-gap);
    grid-auto-flow: row;
    grid-template-columns: auto 44px;
    align-content: start;
    align-items: center;
    justify-items: start;
}
iframe {
    display: block;
    margin: auto;
    aspect-ratio: 16/9;
}

#video{
    flex: 1 1 auto;
}
#player {
    z-index: 8;
    position: sticky;
    flex: 0 0 auto;
    border-top: 1px black dashed;
    bottom: 0;
    background-color: var(--bg-color);

/* Container Base Structure */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
    width: 100%;
}

/* --- TOP ROW --- */
#nowPlaying {
    display: block;
    padding-right: 2.5rem; /* Leaves room so text never collides with the toggle button */
    line-height: 1.4;
    text-align: center;
}

#nowPlaying div {
    display: inline;
}

/* Button pinned to Top Right */
.navbutton {
    position: absolute;
    margin: -0.5rem;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 2
}

@keyframes glow {
    0% {box-shadow: none;}
    33% {box-shadow: 0px 0px 10px 1px var(--dark-green);}
    66% {box-shadow: 0px 0px 10px 1px var(--dark-green);}
    100% {box-shadow: none;}
}

.glow {
    animation: glow 0.75s linear;
}

/* --- MIDDLE CONTROLS LAYER --- */
#controls {
    display: grid;
    grid-template-columns: 1fr 5% 5% 5% 1fr min-content;
    grid-template-areas: 
        "queue . play next . ."
        "seek seek seek seek seek volume";
    align-items: center;
    align-self: center;
    column-gap: 1rem;
    row-gap: 0.75rem;
    width: 75%;
}

/* Map items onto the Grid Template Areas */
#showQueue { grid-area: queue; }
#playPause { grid-area: play; }
#playNext  { grid-area: next; }
#seekbar   { grid-area: seek; }
#dj-pult   { grid-area: volume; }

/* Control Buttons Arrangement */

#playPause, #playNext {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Seekbar Layout (Time - Progress Input - Time) */
#seekbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

#progress {
    flex-grow: 1;
    width: 100%;
    cursor: pointer;

    -webkit-appearance: none;
    appearance: none;

    border-radius: 999px;
    height: 0.25rem;
    cursor: pointer;
    background: linear-gradient(
        to right,
        var(--dark-green) 0%,
        var(--light-green) calc(var(--progress) - 10%),
        var(--light-green) var(--progress),
        var(--light-gray) var(--progress),
        var(--light-gray) 100%
    );
}

#progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0.25rem;
  height: 0.25rem;
  background: var(--light-green);
  border-radius: 50%;
  cursor: pointer;
}
#progress::-moz-range-thumb {
  width: 0.25rem;
  height: 0.25rem;
  background: var(--light-green);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

/* Volume Layout (Icon - Volume Input) */

#dj-pult {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
/* Give the button a fixed, known footprint */
#togglemute {
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#volume {
    -webkit-appearance: none;
    appearance: none;
    writing-mode: vertical-lr;
    direction: rtl;              /* min at bottom, max at top */

    position: absolute;
    left: 0;                    /* same edge as the button, since #togglemute is flex-start */
    bottom: 90%;

    border-radius: 999px;
    width: 0.75rem;                 /* matches #togglemute width → centers automatically */
    background: var(--light-gray);
    opacity: 0.8;
    cursor: pointer;
}
#volume:hover {
    opacity: 1;
}
#volume.over {
    animation: popin 0.1s ease-out 0.05s both;
}
#volume.out {
    animation: popout 0.1s ease-out 0.05s both;
}
#volume.out::-moz-range-thumb {
    opacity: 0;
    transition: opacity 0.1s ease-out;
}

@keyframes popin {
    from { height: 0rem;
        visibility: hidden }
    to { height: 6rem;
        visibility: visible }
}
@keyframes popout {
    from { height: 6rem;
        visibility: visible }
    to { height: 0rem ;
        visibility: hidden}
}

/* thumb styling stays the same */
#volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--reddish);
  border-radius: 50%;
  cursor: pointer;
}
#volume::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  background: var(--reddish);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

/* --- BOTTOM LYRICS LAYER --- */
#szoveg {
    width: 100%;
}

#szoveg p {
    margin: 0;
    white-space: pre-line;
}

#albumBtns{
    margin: 0em -1em;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
}
button.album{
    width: 20rem;
    border: 1px solid var(--light-gray);
    border-radius: 5%;
    padding: 1rem;
    margin: 1rem;
    display: grid;
    justify-items: center;
    align-content: start;
}
.album img {
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0.5rem 0rem;
}

.album .cim {
    position: relative;
    top: 0;
    justify-self: center;
    text-wrap: nowrap;
}
#listWrapper {
    flex: 1;
    overflow-y: auto;
}
#vidBtns {
    display: flex;
    justify-self: center;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem; /* Easy spacing between buttons */
    list-style: none;
    padding: 0;
    width: 45%;
}
.vidBtn {
    background-color: salmon;
    border: 1px solid var(--light-gray);
    border-radius: 10px;
    padding: 0.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
}
#vidBtns li{
    width: 67%;
    transition: width 0.1s ease-out; 
}
#vidBtns li.active{
    width: 100%
}
.vidBtn iframe{
    flex: 1;
    width: 100%;
}

@media screen and (max-width: 500px){
    body {
        flex-direction: column;
    }
    #page{
        height: 100svh;
        flex-direction: column !important;
    }
    #toggleSidebar{
        display: block;
        z-index: 10;
    }
    nav{
        position: fixed;
        top: 0;
        right: -100%;
        height: 100%;
        padding-top: 2rem;
        width: min(14em, 100%);
        z-index: 9;
        border-left: 1px solid var(--light-gray);
        transition: right 0.2s ease-out;
    }
    nav.show {
        right: 0;
    }
    nav ul{
        flex-direction: column;
    }
    nav li{
        padding-left: 1em;
    }
    nav li:has(a.active-link) {
        background-color: var(--light-reddish);
        border: 2px solid var(--reddish);
    }
    nav .home-li {
        margin-right: unset;
    }
    nav a.active-link {
        border-bottom: none;
        width: 100%;
    }
    #songlist {
        flex: 1;
        min-height: 30%;
        max-width: 100%;
    }
    #user-area {
        border-top: 3px black double;
        flex: 0 0 auto;
        max-height: 70%;
        overflow-y: auto;
    }
    #details {
        width: 80%;
        right: 10%;
    }
    #queue {
        flex: 0 0 auto;
    }
    #player {
        padding: 1rem 0;
    }
    #controls {
        width: 100%;
    }
    #video {
        position: sticky;
        top: 0;
    }
    #vidBtns{
        width: 100%;
    }
    iframe {
        width: 100%;
        height: auto;
    }
}
.hidden {
    display: none !important;
}