/* OTT Media Player Styles - Optimized */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #fff;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Seekbar Styles - Consolidated */
.seekbar-container,
.seekbar {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 10px;
}

.seekbar-container input[type="range"],
.seekbar input[type="range"] {
    flex: 1 1 auto;
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #ccc;
    cursor: pointer;
    outline: none;
    margin: 0 10px;
    box-shadow: none;
    --progress: 0%;
}

.seekbar-container input[type="range"]::-webkit-slider-track,
.seekbar input[type="range"]::-webkit-slider-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, red 0%, red var(--progress, 0%), #fff var(--progress, 0%), #fff 100%);
}

.seekbar-container input[type="range"]::-webkit-slider-thumb,
.seekbar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease;
}

.seekbar-container input[type="range"]:hover::-webkit-slider-thumb,
.seekbar input[type="range"]:hover::-webkit-slider-thumb {
    background: #f0f0f0;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.seekbar-container input[type="range"]:focus::-webkit-slider-thumb,
.seekbar input[type="range"]:focus::-webkit-slider-thumb {
    background: #f0f0f0;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

/* Firefox */
.seekbar-container input[type="range"]::-moz-range-track,
.seekbar input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, red 0%, red var(--progress, 0%), #fff var(--progress, 0%), #fff 100%);
}

.seekbar-container input[type="range"]::-moz-range-thumb,
.seekbar input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    transition: background 0.3s ease;
}

.seekbar-container input[type="range"]:hover::-moz-range-thumb,
.seekbar input[type="range"]:hover::-moz-range-thumb {
    background: #f0f0f0;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.seekbar-container input[type="range"]:focus::-moz-range-thumb,
.seekbar input[type="range"]:focus::-moz-range-thumb {
    background: #f0f0f0;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.seekbar .time-display {
    color: #fff;
    font-family: monospace;
    font-size: 0.9rem;
    width: 60px;
    text-align: center;
}

.tooltip {
    position: absolute;
    top: -30px;
    left: 0;
    padding: 4px 8px;
    background: #fff;
    color: #333;
    font-size: 0.75rem;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Layout Styles */
.container {
    display: flex;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    margin: 0;
    gap: 20px;
    box-sizing: border-box;
    padding: 20px;
    overflow: hidden;
}

#toggle-sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    background: transparent;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 100;
}

.container.left-hidden .left-container {
    display: none;
}

.container.left-hidden .right-container {
    flex: 1 1 100%;
}

.left-container {
    flex: 1 1 20%;
    background-color: #111;
    padding: 20px;
    box-sizing: border-box;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.right-container {
    flex: 3 1 80%;
    background-color: #111;
    padding: 20px;
    box-sizing: border-box;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: hidden;
    overflow-x: hidden;
}

.video-video-controls {
    display: flex;
    flex-direction: column;
    height: 90vh;
    background-color: #222;
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
}

.video-layer {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    height: 90%;
    border-radius: 8px;
    overflow: hidden;
    background-color: black;
}

.video-video-controls video#video {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background-color: black;
    object-fit: contain;
}

.subtitle-layer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
    z-index: 5;
    color: #fff;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.95);
    font-size: clamp(14px, 2vw, 24px);
}

/* Control Buttons */
.control-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    gap: 10px;
}

.control-buttons button,
.control-buttons input[type="range"],
.control-buttons select,
.control-buttons span {
    background: #333;
    border: none;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.control-buttons button:not(:disabled):hover,
.control-buttons input[type="range"]:not(:disabled):hover,
.control-buttons select:not(:disabled):hover,
.control-buttons span:not([aria-disabled="true"]):hover {
    color: #000;
}

.control-buttons button:disabled,
.control-buttons input:disabled,
.control-buttons select:disabled,
.control-buttons span[aria-disabled="true"],
.seekbar input[type="range"]:disabled,
.settings-row select:disabled,
#asset-select:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.control-buttons input[type="range"] {
    width: 120px;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
    outline: none;
    margin: 0 10px;
    box-shadow: none;
}

.control-buttons input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: #ccc;
}

.control-buttons input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 5px rgba(7, 191, 38, 0.7);
    transition: background 0.3s ease;
}

.control-buttons input[type="range"]:not(:disabled):hover::-webkit-slider-thumb {
    background: #fff;
    box-shadow: 0 0 8px rgba(5, 160, 31, 0.9);
}

.control-buttons input[type="range"]:focus::-webkit-slider-thumb {
    background: #fff;
    box-shadow: 0 0 8px rgba(5, 160, 31, 0.9);
}

/* Firefox */
.control-buttons input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: #444;
}

.control-buttons input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #07bf26;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(7, 191, 38, 0.7);
    transition: background 0.3s ease;
}

.control-buttons input[type="range"]:not(:disabled):hover::-moz-range-thumb {
    background: #05a01f;
    box-shadow: 0 0 8px rgba(5, 160, 31, 0.9);
}

.control-buttons input[type="range"]:focus::-moz-range-thumb {
    background: #05a01f;
    box-shadow: 0 0 8px rgba(5, 160, 31, 0.9);
}

.control-buttons select {
    padding: 6px 8px;
}

/* Header Styles */
.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.site-title, .site-subtitle {
    margin: 0;
    font-weight: normal;
    font-size: 1.2rem;
}

.player-container {
    position: relative;
    width: 100%;
    text-align: center;
}

#player-loader {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

#player-loader[hidden] {
    display: none;
}

.player-loader-spinner {
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: player-loader-spin 0.8s linear infinite;
}

@keyframes player-loader-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .player-loader-spinner {
        animation: none;
    }
}

/* Container Styles - Consolidated */
.container-first,
.container-second,
.container-third {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    background: rgba(17, 17, 17, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.container-first:hover,
.container-second:hover,
.container-third:hover {
    transform: translateY(-2px);
}

.site-subtitle {
    background: linear-gradient(135deg, #ff0000 0%, #ff4444 50%, #ff8800 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    margin: 0;
    box-shadow: rgba(255, 0, 0, 0.8) 0px 0px 0px 2px, rgba(255, 69, 0, 1.0) 0px 0px 15px 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.site-subtitle:hover {
    box-shadow: rgba(255, 0, 0, 0.8) 0px 0px 0px 2px, rgba(255, 69, 0, 1.0) 0px 0px 15px 3px;
    transform: scale(1.05);
    background: linear-gradient(135deg, #ff4444 0%, #ff6666 50%, #ffaa44 100%);
}

.container-seven {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    background-color: #222;
    border-radius: 8px;
}

.container-seven h4 {
    margin: 0;
    color: #fff;
    font-size: 1rem;
}

.container-seven p {
    margin: 0;
    color: #ccc;
    font-size: 0.9rem;
}

.container-seven span {
    color: #07bf26;
}

.left-container hr {
    border: none;
    height: 1px;
    background-color: #444;
    margin: 10px 0;
}

/* Form Elements */
#asset-select {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.custom-manifest-form {
    display: grid;
    gap: 8px;
    padding: 12px;
    background: #222;
    border: 1px solid #3b3b3b;
    border-radius: 6px;
}

.custom-manifest-form label {
    color: #ddd;
    font-size: 0.85rem;
}

.custom-manifest-form input {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    background: #111;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
}

.custom-manifest-form input:focus-visible,
.custom-manifest-form button:focus-visible {
    outline: 2px solid #07bf26;
    outline-offset: 2px;
}

.custom-manifest-form button {
    padding: 9px 10px;
    background: #07bf26;
    border: 0;
    border-radius: 4px;
    color: #071109;
    font-weight: 600;
    cursor: pointer;
}

.custom-manifest-form button:hover {
    background: #08d52b;
}

#custom-manifest-error {
    min-height: 1em;
    margin: 0;
    color: #ff8585;
    font-size: 0.8rem;
}

select option {
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    display: block;
}

#asset-select option {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.site-title {
    color: #fff;
    font-weight: bold;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    margin: 0;
}

.site-title i.fa-video-camera {
    color: rgba(255, 69, 0, 1.0);
    transition: color 0.3s ease;
}

.site-title i.fa-video-camera:hover {
    color: rgba(255, 69, 0, 1.0);
}

.site-subtitle {
    font-size: 1.5rem;
    color: #fff;
    font-weight: bold;
    margin: 0;
}

a {
    text-decoration: none;
    color: black;
}

.toggle-icon {
    cursor: pointer;
    transition: color 0.3s ease;
}

.toggle-icon:hover {
    color: #07bf26;
}

.settings-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    align-items: center;
    gap: 10px;
    color: #ccc;
    font-size: 0.9rem;
}

.settings-row label {
    color: #ccc;
}

.settings-row select {
    width: 100%;
    background: #333;
    border: 1px solid #555;
    color: #fff;
    padding: 6px 8px;
    border-radius: 4px;
}

@media (max-width: 860px) {
    body {
        display: block;
        height: auto;
        min-height: 100vh;
        min-height: 100svh;
        overflow-x: hidden;
    }

    .container {
        width: 100%;
        height: auto;
        min-height: 100vh;
        min-height: 100svh;
        flex-direction: column;
        gap: 12px;
        padding: 56px 12px 16px;
        overflow: visible;
    }

    #toggle-sidebar {
        position: fixed;
        top: 8px;
        left: 8px;
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
        background: #222;
        border: 1px solid #444;
    }

    .left-container,
    .right-container {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        padding: 12px;
        overflow: visible;
    }

    .left-container {
        order: 2;
        gap: 12px;
    }

    .right-container {
        order: 1;
    }

    .container.left-hidden .right-container {
        flex: 0 0 auto;
    }

    .video-video-controls {
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 8px;
    }

    .video-layer {
        flex: 0 0 auto;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .control-buttons {
        flex-wrap: wrap;
        gap: 8px;
    }

    .control-buttons button,
    .control-buttons select,
    .control-buttons span {
        min-width: 40px;
        min-height: 40px;
        box-sizing: border-box;
    }

    .control-buttons input[type="range"] {
        width: min(28vw, 120px);
        margin: 0 4px;
    }

    .seekbar,
    .seekbar-container {
        gap: 4px;
    }

    .seekbar .time-display {
        flex: 0 0 48px;
        width: 48px;
        font-size: 0.75rem;
    }

    .settings-row {
        grid-template-columns: minmax(88px, 0.8fr) minmax(0, 1.2fr);
    }

    .container-first,
    .container-second,
    .container-third {
        width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .container {
        gap: 8px;
        padding-right: 8px;
        padding-left: 8px;
    }

    .left-container,
    .right-container {
        padding: 8px;
        border-radius: 6px;
    }

    .control-buttons {
        gap: 6px;
    }

    .control-buttons button,
    .control-buttons select,
    .control-buttons span {
        padding: 6px 8px;
    }

    .settings-row {
        grid-template-columns: minmax(78px, 0.75fr) minmax(0, 1.25fr);
        gap: 8px;
        font-size: 0.85rem;
    }

    .custom-manifest-form {
        padding: 10px;
    }
}

@media (orientation: portrait) and (max-width: 480px) {
    .control-buttons input[type="range"] {
        width: clamp(64px, 18vw, 82px);
        min-width: 64px;
        padding: 0;
        margin: 0 4px;
        flex: 0 0 auto;
    }
}

@media (orientation: landscape) and (max-height: 600px) and (max-width: 1024px) {
    body {
        display: block;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }

    .container {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        flex-direction: row;
        gap: 10px;
        padding: 10px;
        overflow: hidden;
    }

    .left-container {
        order: 1;
        flex: 0 0 clamp(190px, 30vw, 260px);
        width: auto;
        min-height: 0;
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        padding: 48px 10px 10px;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .right-container {
        order: 2;
        flex: 1 1 0;
        width: auto;
        height: 100%;
        min-height: 0;
        padding: 8px;
        overflow: hidden;
    }

    .container.left-hidden .right-container {
        flex: 1 1 0;
    }

    .video-video-controls {
        height: 100%;
        min-height: 0;
        padding: 6px;
    }

    .video-layer {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        aspect-ratio: auto;
    }

    .control-buttons {
        flex: 0 0 auto;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 6px;
    }

    .control-buttons button,
    .control-buttons select,
    .control-buttons span {
        min-height: 40px;
    }

    .control-buttons input[type="range"] {
        width: clamp(56px, 9vw, 76px);
        min-width: 56px;
        padding: 0;
        margin: 0 3px;
    }
}

