/* ==========================================================
   GLOBAL
   ========================================================== */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;

    width: 100%;
    height: 100%;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background: #0f0f0f;
    color: #ffffff;
}

body {
    overflow-x: hidden;
}


/* ==========================================================
   HEADER
   ========================================================== */

.header {
    position: sticky;
    top: 0;

    z-index: 100;

    height: 64px;

    display: flex;
    align-items: center;

    padding: 0 20px;

    background: #0f0f0f;

    border-bottom: 1px solid #272727;
}


/* LEFT */

.header-left {
    display: flex;
    align-items: center;

    min-width: 220px;
}

.logo {
    display: flex;
    align-items: center;

    gap: 9px;

    font-size: 18px;
    font-weight: 600;

    white-space: nowrap;
}

.logo-icon {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 30px;
    height: 22px;

    border-radius: 6px;

    background: #ff0033;

    color: white;

    font-size: 13px;
}


/* HEADER BUTTONS */

.icon-button,
.header-button {
    border: none;

    background: transparent;

    color: white;

    cursor: pointer;

    font-size: 22px;

    width: 40px;
    height: 40px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        background 0.15s ease;
}

.icon-button:hover,
.header-button:hover {
    background: #272727;
}


/* SEARCH */

.header-search {
    flex: 1;

    max-width: 650px;

    margin: 0 auto;

    display: flex;

    height: 40px;
}

.header-search input {
    flex: 1;

    min-width: 0;

    padding: 0 18px;

    border: 1px solid #303030;
    border-right: none;

    border-radius: 22px 0 0 22px;

    outline: none;

    background: #121212;

    color: white;

    font-size: 15px;
}

.header-search input:focus {
    border-color: #3ea6ff;
}

.header-search input::placeholder {
    color: #888;
}

.search-button {
    width: 55px;

    border: 1px solid #303030;

    border-radius: 0 22px 22px 0;

    background: #222222;

    color: white;

    cursor: pointer;

    font-size: 16px;
}

.search-button:hover {
    background: #303030;
}


/* RIGHT */

.header-right {
    min-width: 80px;

    display: flex;
    justify-content: flex-end;
}


/* ==========================================================
   MAIN
   ========================================================== */

.main-container {
    display: grid;

    grid-template-columns: minmax(0, 1fr) 390px;

    gap: 20px;

    max-width: 1800px;

    margin: 0 auto;

    padding: 24px;
}


/* ==========================================================
   PLAYER
   ========================================================== */

.player-section {
    min-width: 0;
}

.video-wrapper {
    position: relative;

    width: 100%;

    aspect-ratio: 16 / 9;

    background: #000;

    border-radius: 10px;

    overflow: hidden;
}

.video-wrapper video {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    background: #000;
}


/* ==========================================================
   LOADING
   ========================================================== */

.video-loading {
    position: absolute;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    background: rgba(0, 0, 0, 0.35);
}

.video-loading.hidden {
    display: none;
}

.spinner {
    width: 45px;
    height: 45px;

    border: 4px solid rgba(255, 255, 255, 0.25);

    border-top-color: white;

    border-radius: 50%;

    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* ==========================================================
   VIDEO INFORMATION
   ========================================================== */

.video-information {
    padding-top: 16px;
}

.video-information h1 {
    margin: 0;

    font-size: 20px;

    font-weight: 600;

    line-height: 1.4;

    word-break: break-word;
}

.video-meta {
    margin-top: 8px;

    color: #aaaaaa;

    font-size: 14px;
}


/* ==========================================================
   NAVIGATION
   ========================================================== */

.player-navigation {
    display: flex;

    justify-content: space-between;

    margin-top: 16px;
}

.navigation-button {
    display: flex;

    align-items: center;

    gap: 8px;

    padding: 10px 16px;

    border: 1px solid #333;

    border-radius: 8px;

    background: #181818;

    color: white;

    cursor: pointer;

    font-size: 14px;

    transition:
        background 0.15s ease;
}

.navigation-button:hover {
    background: #303030;
}

.navigation-button:disabled {
    opacity: 0.35;

    cursor: default;
}


/* ==========================================================
   PLAYLIST
   ========================================================== */

.playlist {
    height: calc(100vh - 112px);

    min-height: 400px;

    display: flex;

    flex-direction: column;

    background: #181818;

    border: 1px solid #292929;

    border-radius: 10px;

    overflow: hidden;
}


/* PLAYLIST HEADER */

.playlist-header {
    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 16px;

    border-bottom: 1px solid #303030;
}

.playlist-header h2 {
    margin: 0;

    font-size: 18px;
}

.video-count {
    display: block;

    margin-top: 4px;

    color: #999;

    font-size: 13px;
}

.close-playlist-button {
    display: none;

    width: 36px;
    height: 36px;

    border: none;

    border-radius: 50%;

    background: transparent;

    color: white;

    font-size: 25px;

    cursor: pointer;
}


/* PLAYLIST CONTENT */

.playlist-items {
    flex: 1;

    overflow-y: auto;

    padding: 8px;
}


/* SCROLLBAR */

.playlist-items::-webkit-scrollbar {
    width: 8px;
}

.playlist-items::-webkit-scrollbar-track {
    background: transparent;
}

.playlist-items::-webkit-scrollbar-thumb {
    background: #444;

    border-radius: 10px;
}

.playlist-items::-webkit-scrollbar-thumb:hover {
    background: #555;
}


/* ==========================================================
   PLAYLIST ITEM
   ========================================================== */

.playlist-item {
    display: grid;

    grid-template-columns: 32px minmax(0, 1fr);

    gap: 10px;

    align-items: center;

    width: 100%;

    padding: 10px;

    margin-bottom: 3px;

    border: none;

    border-radius: 7px;

    background: transparent;

    color: white;

    text-align: left;

    cursor: pointer;

    transition:
        background 0.15s ease;
}

.playlist-item:hover {
    background: #303030;
}

.playlist-item.active {
    background: #3a3a3a;
}


/* NUMBER */

.playlist-number {
    color: #999;

    font-size: 13px;

    text-align: center;
}

.playlist-item.active .playlist-number {
    color: #ff0033;
}


/* TITLE */

.playlist-title {
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-size: 14px;

    line-height: 1.4;
}


/* PLAYING INDICATOR */

.playing-icon {
    display: none;
}

.playlist-item.active .playing-icon {
    display: inline;
}


/* ==========================================================
   EMPTY / LOADING MESSAGE
   ========================================================== */

.playlist-message {
    padding: 30px 15px;

    color: #999;

    text-align: center;

    font-size: 14px;

    line-height: 1.5;
}


/* ==========================================================
   MOBILE OVERLAY
   ========================================================== */

.playlist-overlay {
    display: none;

    position: fixed;

    inset: 0;

    z-index: 150;

    background: rgba(0, 0, 0, 0.65);
}


/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 900px) {

    .header {
        padding: 0 12px;
    }

    .header-left {
        min-width: auto;
    }

    .logo span:last-child {
        display: none;
    }

    .header-right {
        min-width: auto;
    }

    .main-container {
        display: block;

        padding: 12px;
    }

    .playlist {
        position: fixed;

        z-index: 200;

        top: 0;
        right: 0;
        bottom: 0;

        width: min(390px, 90vw);

        height: 100vh;

        border-radius: 0;

        border: none;

        transform: translateX(100%);

        transition:
            transform 0.25s ease;
    }

    .playlist.open {
        transform: translateX(0);
    }

    .close-playlist-button {
        display: flex;

        align-items: center;
        justify-content: center;
    }

    .playlist-overlay.open {
        display: block;
    }

    .video-wrapper {
        border-radius: 7px;
    }
}


/* ==========================================================
   SMALL MOBILE
   ========================================================== */

@media (max-width: 600px) {

    .header-search {
        margin-left: 10px;
        margin-right: 10px;
    }

    .header-search input {
        padding-left: 12px;
    }

    .search-button {
        width: 45px;
    }

    .main-container {
        padding: 8px;
    }

    .video-information {
        padding-top: 12px;
    }

    .video-information h1 {
        font-size: 17px;
    }

    .navigation-button {
        padding: 8px 12px;
    }
}