*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html{
    width: 100%;
    height: 100%;
    background-color: black;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}
body{
    overflow: hidden;
}
/*video tag settings*/
video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
/*Header video container*/
.header-container{
    position: absolute;
    top:0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    color:white;
    opacity: 0;
    transition: opacity 150ms ease-in-out;
    padding: env(safe-area-inset-bottom) env(safe-area-inset-right) env(safe-area-inset-top) env(safe-area-inset-left);
    padding-top: 5px;
    display: flex;
    justify-content: space-between; /* Pushes items to the edges */
    align-items: center; /* Vertically centers items */
}
.header-container::before{
    content: "";
    position: absolute;
    top: 0;
    background: linear-gradient(to bottom, rgba(0,0,0, .85), transparent);
    width: 100%;
    aspect-ratio: 16 / 1;
    z-index: -1;
}
.video-title {
    flex-grow: 1; /* Allows the title to take up remaining space */
    text-align: center; /* Centers the text horizontally */
}

/*body of video container*/
.video-container {
    background-color: black;
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    max-height: 100dvh;
    width: 100dvw;
    max-width: 100dvw;
}
.video-controls-container::before{
    content: "";
    position: absolute;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0, .85), transparent);
    width: 100%;
    aspect-ratio: 16 / 1;
    z-index: -1;
}
.video-controls-container{
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: white;
    z-index: 100; /*avanti a tutto*/
    opacity: 0;
    transition: opacity 150ms ease-in-out;
    padding: env(safe-area-inset-bottom) env(safe-area-inset-right) env(safe-area-inset-top) env(safe-area-inset-left);
}
.video-container .video-controls-container.active,
.video-container .header-container.active{
    opacity: 1;
}

.video-controls-container .controls{
    display: flex;
    gap: .5rem;
    padding: .25rem;
    align-items: center;
}

.video-controls-container .controls button{
    background-color: transparent;
    border: none;
    color: inherit; 
    padding: 0;
    width: clamp(24px, 10dvw, 38px);
    height: clamp(24px, 10dvw, 38px);
    font-size: 1.1rem;
    cursor: pointer;
    opacity: .85;
    transition: opacity 150ms ease-in-out;
}
.video-controls-container .controls button:hover{
    opacity: 1;
}

.video-container.paused .pause-icon{
    display: none;
}
.video-container:not(.paused) .play-icon{
    display: none;
}

.video-container.fforward-icon, .video-container.frewind-icon{
    max-width: 80%;
    max-height: 80%;
}

/*fullscreen style*/
.video-container.fullscreen {
    background-color: black;
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    max-height: 100dvh;
    width: 100dvw;
    max-width: 100dvw;
    padding: 0;
}

.video-container.fullscreen .full-enable{
    display: none;
}
.video-container:not(.fullscreen) .full-exit{
    display: none;
}


/*volume style*/
.volume-high-icon,
.volume-low-icon,
.volume-muted-icon{
    display: none;
    max-width: 90%;
    max-height: 90%;
}

.video-container[data-volume-level="high"] .volume-high-icon{
    display: block;
}
.video-container[data-volume-level="low"] .volume-low-icon{
    display: block;
}
.video-container[data-volume-level="muted"] .volume-muted-icon{
    display: block;
}

.volume-container {
    display: flex;
    align-items: center;
}

.volume-slider{
    width: 0;
    transform-origin: left;
    transform: scaleX(0);
    transition: width 150ms ease-in-out, transform 150ms ease-in-out;
}

.volume-container:hover .volume-slider,
.volume-slider:focus-within {
    transform: scaleX(1);
    width: 100%;
}

/*duration time style*/
.duration-container{
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-grow: 1;
}

/* timeline */
.timeline-container{
    height: 7px;
    margin-inline: .8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    touch-action: none;
}
.video-container.scrubbinng .timeline,
.timeline-container:hover .timeline{
    height: 100%;
}

.timeline{
    background-color: rgba(100,100,100, .5);
    height: 3px;
    width: 100%;
    position:relative;
}
.timeline::after{
    content:"";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: calc(100% - var(--progress-pos) *100%);
    background-color: red;
    z-index: 2;
}
.timeline .thumb-indicator{
    --scale: 0;
    position: absolute;
    transform: translateX(-50%) scale(var(--scale));
    height: 200%;
    top: -50%;
    left: calc(var(--progress-pos) * 100%);
    background-color: red;
    border-radius: 50%;
    transition: transform 150ms ease-in-out;
    aspect-ratio: 1/1;
    z-index: inherit;
}
.video-container.scrubbinng .thumb-indicator,
.timeline-container:hover .thumb-indicator{
    --scale: 1;
}

.loading-spinner {
    display: none; /* Hidden by default */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  
  @keyframes spin {
    0% {
      transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
      transform: translate(-50%, -50%) rotate(360deg);
    }
  }