@import url('https://fonts.googleapis.com/css2?family=Onest:wght@100..900&display=swap');

:root {
    --background-color: #000000;
    --border-radius: 15px;
    --card-background: #1a1a1a;
    --glass-bg: rgba(25, 25, 25, 0.5);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --text-color: #ffffff;
    --text-secondary: #b3b3b3;
    --theme-color: #ffffff;
    --error-color: #ff3b30;
    --input-bg: rgba(255, 255, 255, 0.05);
}

body {
    -ms-overflow-style: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Onest', sans-serif;
    margin: 0;
    padding-top: 60px; 
    scrollbar-width: none;
    user-select: none;
}

body.no-scroll { overflow: hidden; }
body::-webkit-scrollbar { display: none; }

a, button, input, select {
    color: inherit;
    position: relative;
    text-decoration: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Onest', sans-serif;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

header {
    align-items: center;
    backdrop-filter: none;
    background: transparent;
    display: flex;
    height: 60px;
    justify-content: space-between;
    left: 0;
    padding: 0 20px;
    position: fixed;
    right: 0;
    top: 0;
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
    z-index: 1000;
}

header.scrolled {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background: var(--glass-bg);
    border-bottom: var(--glass-border);
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-color);
}

.header-right { display: flex; gap: 10px; }

.icon-link {
    align-items: center;
    border-radius: 50%;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    padding: 8px;
    transition: background 0.2s;
    width: 40px;
    height: 40px;
    -webkit-touch-callout: none;
    user-select: none;
}

.icon-link:hover { background: rgba(255,255,255,0.1); border: var(--glass-border); }

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 992px) {
    main {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: calc(100vh - 110px); 
        box-sizing: border-box;
        width: 100%;
        padding: 0 0 20px;
    }
    
    .container {
        max-width: 1300px;
        width: 100%;
        margin: 0 20px;
        padding: 0 20px;
    }
    
    .grid-container {
        display: grid;
        grid-template-columns: 1fr 400px;
        gap: 20px;
        align-items: flex-start;
        width: 100%;
    }

    .video-aspect-box {
        width: 100%;
        padding-top: 56.25%;
        position: relative;
        height: 0;
        background-color: #000;
        overflow: hidden;
    }

    #video-container, 
    .shaka-video-container,
    #video {
        position: absolute !important;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        border: none;
        margin: 0;
    }

    video {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .site-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        padding: 10px 0;
        z-index: 100;
        margin: 0;
    }
    
    .site-footer p {
        margin: 0;
    }
}

.player-wrapper {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    border: var(--glass-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.video-aspect-box {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    position: relative;
}

#video-container, #video {
    width: 100%;
    height: 100%;
}

.channel-details-footer {
    padding: 15px 20px;
    background-color: var(--card-background);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px; 
}

.channel-details-footer h2 {
    font-size: 0.9rem;
    line-height: 1.4; 
    font-weight: 600;
    margin: 0;
    color: var(--text-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.control-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 25px;
    border: var(--glass-border);
}

h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-color);
}

.input-group { margin-bottom: 20px; }

.input-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
}

input[type="text"] {
    font-family: monospace;
    width: 100%;
    background: var(--input-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px; 
    color: white;
    font-size: 0.9rem;
    padding: 12px 20px;
    box-sizing: border-box;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
}

.select-row {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.select-row select {
    flex-grow: 1;
    width: 0; 
    background: var(--input-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: white;
    font-size: 0.9rem;
    padding: 12px 20px;
    appearance: none; 
    outline: none;
    pointer-events: none;
    cursor: default;    
    transition: background 0.3s;
}

select option { background-color: #000; color: #fff; }

.select-row select:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.dropdown-circle-btn {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--text-color);
    transition: background 0.2s;
    user-select: none;
    -webkit-touch-callout: none;
}

.dropdown-circle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.dropdown-circle-btn .material-symbols-rounded {
    font-size: 20px;
    pointer-events: none;
}

.m3u-input-container { display: flex; gap: 10px; }

#upload-m3u-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border-radius: 50%;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    -webkit-touch-callout: none; 
    user-select: none;
}

#upload-m3u-button:hover { background: rgba(255, 255, 255, 0.2); }

.action-btn {
    background-color: var(--theme-color);
    color: #000;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 14px 0;
    width: 100%;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.2s, opacity 0.2s;
    margin-top: 10px;
    -webkit-touch-callout: none;
}

.action-btn:active { transform: scale(0.98); }
.action-btn:hover { opacity: 0.9; }

.input-mode-switcher {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50px;
    border: var(--glass-border);
    padding: 5px;
    display: flex;
    position: relative;
    margin-bottom: 25px;
}

.input-mode-switcher button {
    flex: 1;
    padding: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    z-index: 2;
    transition: color 0.3s;
    -webkit-touch-callout: none;
    user-select: none;
}

.input-mode-switcher button.active { color: #000; }

.input-mode-switcher::before {
    content: '';
    position: absolute;
    top: 5px;
    left: var(--slide-pos, 5px);
    width: calc(50% - 5px);
    height: calc(100% - 10px);
    background-color: var(--theme-color);
    border-radius: 40px;
    transition: left 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1;
}

.floating-menu {
    backdrop-filter: blur(20px);
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    opacity: 0;
    padding: 10px;
    position: fixed;
    right: 20px;
    top: 65px;
    transform: translateY(-10px);
    transition: all 0.3s;
    visibility: hidden;
    width: 160px;
    z-index: 1001;
}

.floating-menu.active {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.floating-menu ul { list-style: none; margin: 0; padding: 0; }

.floating-menu li {
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 10px;
    -webkit-touch-callout: none;
    user-select: none;
}

.floating-menu li:hover { background-color: rgba(255, 255, 255, 0.1); border: var(--glass-border); }

.floating-menu li a {
    align-items: center;
    display: flex;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    -webkit-touch-callout: none; 
}

.site-footer {
    color: #666;
    padding: 20px;
    text-align: center;
}
.site-footer p { font-size: 0.6rem; margin: 5px 0; }

hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 25px 0;
}

#error-display {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid var(--error-color);
    color: #ff3b30;
    font-size: 0.8rem;
    padding: 15px;
    border-radius: 12px;
    margin-top: 20px;
    display: none;
}

.shaka-video-container,
.shaka-settings-menu,
.shaka-overflow-menu {
    font-family: 'Onest', sans-serif !important;
    font-weight: 700;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overflow-y: auto; 
}

.shaka-overflow-menu::-webkit-scrollbar, 
.shaka-settings-menu::-webkit-scrollbar {
    display: none;
}

.shaka-controls-container button,
.shaka-controls-container span,
.shaka-text-container, {
    font-family: 'Onest', sans-serif !important;
}

.shaka-current-time,
.shaka-duration {
    font-weight: 700;
}

.shaka-controls-button-panel .material-icons-round {
    color: var(--theme-color) !important;
}

.shaka-range-element {
    color: var(--theme-color) !important;
}

.shaka-text-container span {
    font-family: 'Onest', sans-serif !important;
    font-weight: 600 !important;
}

video::cue {
    font-family: 'Onest', sans-serif !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.shaka-text-region {
    font-family: 'Onest', sans-serif !important;
}
