:root {
    --bg-color: #101010;

    --surface-color: #181818;
    --card-bg: #222;
    --primary-color: #ff6600;
    --third-color: #0076bb;
    --text-color: #f0f0f0;
    --text-muted: #aaa;
    --border-color: #333;
    --tile-bg-color: #1f1f1f;
    --tile-bg-hover-color: #3b3b3b;
}

/* --- Grund-Layout & Helfer --- */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    overflow-x: hidden;

    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
}

.hidden {
    display: none !important;
}

/* Smart TV / Fire TV: Bestimmte Menüpunkte und Funktionen ausblenden */
.is-tv .hide-on-tv {
    display: none !important;
}

.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.continue-watching-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: stretch;
    height: 48px;
}

a#continue-watching-btn {
    padding: 2px 20px;
    line-height: 1.3;
    height: auto;
    border-radius: 5px 0px 0px 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

button#tv-continue-btn {
    padding: 2px 15px;
    height: auto;
    border-radius: 0;
    border-left: 2px solid rgba(255, 255, 255, 1.0);
    display: flex;
    align-items: center;
    justify-content: center;
}

button#remove-from-history-btn {
    padding: 2px 15px;
    height: auto;
    border-radius: 0px 5px 5px 0px;
    border-left: 2px solid rgba(255, 255, 255, 1.0);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* General form and button styles */
.btn,
button,
input,
select {
    font-family: inherit;
    padding: 10px 15px;

    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    transition: background-color 0.2s, border-color 0.2s;
}


/* Styles specific to buttons and links styled as buttons */
.btn,
button {
    cursor: pointer;
    background-color: var(--primary-color);

    color: white;
    border-color: var(--primary-color);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    line-height: normal;
    /* Ensure consistent line height */
}

.btn:hover:not(:disabled),
button:hover:not(:disabled) {
    background-color: #ff8533;
}

.btn:disabled,
button:disabled {
    background-color: #555;
    border-color: #444;
    color: #888;
    cursor: not-allowed;
}

select:hover,
input:hover {
    border-color: var(--primary-color);
}


/* --- Header & Navigation --- */
.main-header {
    background-color: var(--surface-color);

    border-bottom: 1px solid var(--border-color);
    padding: 0 10px;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding-top: 15px;
    padding-bottom: 15px;
    gap: 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 15px;
    flex-grow: 1;
}

.main-nav a {
    color: var(--text-muted);

    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.main-nav a:hover {
    color: var(--text-color);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-icon-btn {
    background: none;
    border: none;

    color: var(--text-muted);
    padding: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon-btn:hover {
    color: var(--text-color);
}

.nav-icon-btn svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.profile-menu {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background-color: var(--surface-color);

    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 0;
    min-width: 200px;
    z-index: 1001;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.profile-menu.active .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;

    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.dropdown-menu a:hover {
    background-color: var(--primary-color);
    color: white;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 10px 0;
}

.admin-link {
    color: var(--primary-color) !important;
}

.admin-link:hover {
    color: white !important;
}

.language-switcher {
    display: flex;
    align-items: center;
}

.language-switcher a {
    color: #fff;
    text-decoration: none;
    padding: 5px 8px;
    border-radius: 4px;
    font-weight: 500;

    transition: background-color 0.2s ease-in-out;
    margin: 0 2px;
}

.language-switcher a.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 700;
}

.language-switcher a:not(.active):hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- Footer --- */
.main-footer {
    text-align: center;
    padding: 5px;
    color: var(--text-muted);
    font-size: 0.9rem;

    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* --- Formulare (Login/Register) --- */
.auth-form {
    max-width: 400px;
}

.notice {
    background-color: rgba(255, 102, 0, 0.1);
    border-left: 3px solid var(--primary-color);
    padding: 10px;
    border-radius: 5px;
}

.error {
    background-color: rgba(255, 0, 0, 0.1);
    border-left: 3px solid red;
    padding: 10px;
    border-radius: 5px;
}

.success {
    background-color: rgba(0, 255, 0, 0.1);
    border-left: 3px solid green;
    padding: 10px;
    border-radius: 5px;
}

/* --- Dashboard & Page Headers --- */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    color: var(--text-muted);

    max-width: 60ch;
}

/* --- Suche --- */
#search-section {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

#search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    align-items: flex-end;
}

.form-group {
    display: flex;

    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.range-group {
    display: flex;
    gap: 0.5rem;

    align-items: center;
}

.range-group input {
    width: 100%;
}

.full-width-search {
    grid-column: 1 / -1;
}

@media (min-width: 680px) {
    .full-width-search {
        grid-column: span 2;
    }
}

/* --- Galerie / Kacheln --- */
#results-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1210px) {
    #results-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    #results-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    #results-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

.tile {
    min-width: 0;
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;

    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
}

.tile:hover,
.tile:focus {
    transform: translateY(-5px);
    z-index: 10;
}

.tile img {
    width: 100%;
    display: block;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    background-color: var(--surface-color);
}

.tile-info {
    padding: 1rem;
}

.tile-info h3 {
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rating {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #f1c40f;
    /* Yellow for rating */
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rating-badge {
    background-color: #f1c40f;
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    margin-right: 10px;
}

.rating.loading {
    color: transparent;
    position: relative;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.1);
}

.rating.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: rating-shimmer 1.5s infinite;
}

@keyframes rating-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.loader,
#scroll-loader {
    text-align: center;

    font-size: 1.5rem;
    padding: 50px;
    grid-column: 1 / -1;
}

#api-counter {
    position: fixed;
    top: 15px;
    right: 20px;

    background-color: rgba(0, 0, 0, 0.7);
    color: var(--primary-color);
    padding: 8px 12px;
    border-radius: 5px;
    z-index: 1001;
}

/* --- Player --- */
#player-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background-color: #000;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#video-player {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

#player-placeholder {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;

    justify-content: flex-end;
    align-items: center;
    padding-bottom: 100px;
    pointer-events: none;
}

.player-loader {
    color: var(--primary-color);
    font-size: 1.5rem;
    text-align: center;

    pointer-events: auto;
}

#resume-dialog {
    background: rgba(30, 30, 30, 0.9);
    padding: 15px 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;

    pointer-events: auto;
}

#resume-dialog button {
    margin: 0 5px;
}

.player-controls {
    position: absolute;
    left: 0;
    right: 0;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 10;
    pointer-events: none;
}

#player-view.controls-active .player-controls {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#player-video-title {
    font-size: 1.2rem;

    font-weight: 500;
    margin-right: 50px;
    padding: 0 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    flex-grow: 0;
}

#player-top-controls {
    top: 0;
    display: block;
    justify-content: flex-start;
    align-items: left;
    gap: 0.5rem;
    padding: 1rem;

    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
    flex-wrap: nowrap;
    flex-direction: row;
}

#player-bottom-controls {
    bottom: 0;

    padding: 0 20px 10px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    flex-direction: column;
}

.timeline-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.timeline-container .time-display {
    font-size: 0.9em;

    color: var(--text-muted);
    width: 60px;
    text-align: center;
}

/* FIX 4: VERHINDERT KONFLIKT MIT SHAKA PLAYER SLIDERS */
/* Vorher war dies 'input[type="range"]' (Global) was den Shaka-Player massiv gestört und für die doppelte Ansicht gesorgt hat. */
.custom-range-slider {
    -webkit-appearance: none;
    background: transparent;
    width: 100%;
    height: 15px;
    cursor: pointer;
}

.custom-range-slider::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.3);
    height: 5px;
    border-radius: 5px;
}

.custom-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 15px;
    width: 15px;
    background: var(--primary-color);
    border-radius: 50%;

    margin-top: -5px;
}

.custom-range-slider:focus {
    outline: none;
}

.buttons-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls-left,
.controls-right {
    display: flex;

    align-items: center;
    gap: 10px;
}

.volume-container {
    position: relative;
    display: flex;
    align-items: center;
}

.volume-slider {
    position: absolute;

    bottom: 36px;
    left: 45%;
    transform: translateX(-50%);
    writing-mode: vertical-lr;
    direction: rtl;
    width: 35px !important;
    height: 120px !important;
    background: var(--surface-color) !important;

    padding: 10px 5px;
    border-radius: 5px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

.volume-container:hover .volume-slider {
    opacity: 1;
    visibility: visible;
}

.icon-button {
    background: transparent;
    border: none;
    padding: 5px;
    color: var(--text-color);
}

.icon-button svg {
    fill: currentColor;
    stroke: currentColor;
    width: 24px;

    height: 24px;
}

.icon-button.large svg {
    width: 32px;
    height: 32px;
}

/* --- Einstellungs-Overlay --- */
#player-settings-overlay {
    position: absolute;

    bottom: 0;
    left: 0;
    width: 100%;
    transform: translateY(100%);
    background-color: rgba(22, 22, 22, 0.95);
    padding: 2.5rem 1rem 2rem 1rem;
    opacity: 0;
    visibility: hidden;

    transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    z-index: 2147483647 !important;
    border-top: 1px solid var(--border-color);
}

#player-settings-overlay.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

#settings-close-btn {
    position: absolute;
    top: 8px;

    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0px 0px !important;
    font-size: 1.5rem;
    line-height: 0px !important;
    text-align: center;
    background: transparent;

    border: none;
    color: var(--text-muted);
}

.settings-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;

    max-height: 85vh;
    overflow-y: visible;
}

.settings-block {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    font-size: 0.9rem;

    color: var(--text-muted);
}

.skip-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface-color);
    padding: 10px;
    border-radius: 5px;
}

.skip-group input[type="number"] {
    width: 60px;
    padding: 5px;
}

.skip-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

@media (min-width: 768px) {
    .settings-container {
        flex-direction: row;
        align-items: flex-start;
    }

    .settings-block {
        padding: 0 1rem;
    }

    .settings-block+.settings-block {
        border-left: 1px solid var(--border-color);
    }
}

/* --- Watchlist Checkbox auf Kacheln --- */
.watchlist-checkbox-label {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;

    height: 30px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

.watchlist-checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    font-size: 1.2rem;
    color: white;
}

.watchlist-checkbox-label input:checked~.checkmark {
    color: var(--primary-color);
}

.watchlist-checkbox-label .checkmark::after {
    content: '+';
}

.watchlist-checkbox-label input:checked~.checkmark::after {
    content: '✓';
}

/* --- Fokus-Styling für TV --- */
:focus {
    outline: none !important;
}

.focused {
    outline: none !important;
    box-shadow: 0 0 0 3px var(--primary-color), 0 0 15px var(--primary-color) !important;
}


/* --- Responsive Anpassungen --- */
.mobile-nav-toggle {
    display: none;
    background: none;

    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    position: relative;
    width: 45px;
    height: 45px;
}

.hamburger {
    width: 25px;
    height: 25px;
    fill: var(--text-color);
    transition: fill 0.2s ease-in-out;
}

/* Kachel-Grid */
@media (max-width: 576px) {
    #results-container {
        grid-template-columns: repeat(2, 1fr);

        gap: 1rem;
    }
}

@media (max-width: 992px) and (orientation: landscape) {
    #results-container {
        grid-template-columns: repeat(6, 1fr);

        gap: 1rem;
    }
}

/* Mobile Navigation (Tablet & kleiner) */
@media (max-width: 768px) {
    .main-nav {
        display: none;

        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(5px);
        justify-content: center;
        align-items: center;

        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }

    .main-nav.active {
        display: flex;

        transform: translateX(0);
    }

    .main-nav a {
        font-size: 1.5rem;
    }

    .mobile-nav-toggle {
        display: block;
    }

    .mobile-nav-toggle.active .hamburger {
        fill: var(--primary-color);
    }

    body.mobile-nav-active {
        overflow: hidden;
    }
}

/* --- Custom Dropdown --- */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select {
    position: relative;
    cursor: pointer;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 10px 15px;

    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-select-trigger {
    white-space: nowrap;
    overflow: hidden;

    text-overflow: ellipsis;
    flex-grow: 1;
}

.truncate {
    width: 100%;
    /* Deine gewünschte Breite */
    display: -webkit-box;
    -webkit-box-orient: vertical;

    -webkit-line-clamp: 3;
    /* Die Anzahl der Zeilen, die angezeigt werden sollen */
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-select-trigger::after {
    content: '▲';
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s;
    transform-origin: center;
    display: inline-block;
    margin-left: 10px;
}

.custom-select.open .custom-select-trigger::after {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    bottom: calc(100% - 1px);

    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    z-index: 10;

    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.custom-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;

    border-bottom: 1px solid var(--border-color);
}

.custom-option:last-child {
    border-bottom: none;
}

.custom-option:hover {
    background-color: var(--primary-color);
}

.custom-option.selected {
    background-color: var(--primary-color);
    font-weight: bold;
}

.custom-option.focused {
    background-color: #ff8533 !important;
    outline: none;
}

/* --- Landing Page --- */
body.landing-page-active {
    overflow: hidden;
}

.landing-page {
    display: flex;

    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    flex-grow: 1;
    /* Allow it to take up space */
}

.landing-content {
    padding: 20px;
    max-width: 650px;
    width: 100%;
}

.landing-box {
    background: var(--surface-color);
    padding: 40px 50px;
    border-radius: 15px;
    border: 1px solid var(--border-color);

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.landing-box h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.landing-box p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: var(--text-muted);
    line-height: 1.5;
}

.landing-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.landing-buttons .btn {
    text-decoration: none;

    display: inline-block;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.landing-buttons .btn:hover {
    transform: translateY(-3px);

    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.btn.btn-lg {
    padding: 15px 35px;
    font-size: 1.1rem;
    border-radius: 8px;
    font-weight: bold;
}

/* --- Episoden-Panel --- */
#episode-list-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    max-width: 80vw;

    height: 80vh;
    background-color: rgba(22, 22, 22, 0.98);
    backdrop-filter: blur(5px);
    z-index: 2147483647 !important;
    display: none;
    overflow-y: auto;
    padding: 20px;

    border-left: 1px solid var(--border-color);
}

#episode-list-panel.visible {
    display: block;
}

#episode-list-panel h3 {
    margin-top: 0;

    color: var(--primary-color);
}

#episode-list-panel h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.episode-list-item {
    padding: 10px 5px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;

    text-overflow: ellipsis;
}

.episode-list-item:hover {
    background-color: var(--surface-color);
}

.episode-list-item.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}


/* --- Dashboard (Startseite eingeloggt) --- */
.dashboard-container {
    width: 100%;
    padding: 0 20px;
    /* Add horizontal padding */
}

#dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.content-row {
    width: 100%;
}

.content-row h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.5rem;
}

/* --- Hero Slider --- */
.hero-slider {
    grid-column: 1 / -1;
    position: relative;
    width: 100%;
    height: 50vh;

    min-height: 350px;
    max-height: 500px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.hero-slider .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;

    transition: opacity 1s ease-in-out;
    background-size: cover;
    background-position: center;
}

.hero-slider .slide.active {
    opacity: 1;
}

.hero-slider .slide-content {
    position: absolute;
    top: 50%;
    /* Vertikal mittig positionieren */
    transform: translateY(-50%);
    /* Eigene Höhe berücksichtigen */
    left: 0;
    right: 0;
    color: #fff;
    text-decoration: none;
}

.hero-slider .slide-title {
    font-size: 2.2rem;
    font-weight: bold;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.hero-slider .slide-type {
    font-size: 1rem;
    font-weight: bold;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    display: block;
}

.hero-slider .slider-nav {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 0.5rem;
}

.hero-slider .nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color 0.3s;
}

.hero-slider .nav-dot.active {
    background-color: #fff;
}

.hero-slider-container {
    width: 100%;
    position: relative;
    margin-bottom: 2rem;
}

.hero-slider {
    width: 100%;
    height: 70vh;
    /* Same height as detail hero */
    position: relative;

    overflow: hidden;
}

.hero-slider .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;

    transition: opacity 0.8s ease-in-out;
    z-index: 1;
}

.hero-slider .slide.active {
    opacity: 1;
    z-index: 2;
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 1rem;

    cursor: pointer;
    z-index: 10;
    font-size: 1.5rem;
    transition: background-color 0.3s;
}

.slider-arrow:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.slider-arrow.prev {
    left: 10px;
}

.slider-arrow.next {
    right: 10px;
}

.slider-nav {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;

    gap: 10px;
    z-index: 10;
}

.slider-nav .nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;

    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background-color 0.3s;
}

.slider-nav .nav-dot.active {
    background-color: white;
}

@media (max-width: 768px) {
    .hero-slider {
        grid-column: 1 / -1;

        position: relative;
        width: 100%;
        height: calc(100vh - 195px);
        min-height: 350px;
        max-height: 800px;
        border-radius: 0px;
        overflow: hidden;
        margin-bottom: 2rem;

        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }

    .hero-slider .slide {
        position: absolute;

        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transition: opacity 1s ease-in-out;
        background-size: cover;
        background-position: center;
    }

    .hero-slider .slide.active {
        opacity: 1;
    }

    .hero-slider .slide-content {
        position: absolute;
        top: 50%;
        /* Vertikal mittig positionieren */
        transform: translateY(-50%);
        /* Eigene Höhe berücksichtigen */
        left: 0;
        right: 0;
        color: #fff;
        text-decoration: none;
    }

    .hero-slider .slide-title {
        font-size: 2.2rem;
        font-weight: bold;
        margin: 0;

        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    }

    .hero-slider .slide-type {
        font-size: 1rem;

        font-weight: bold;
        color: var(--primary-color);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 0.5rem;
        display: block;
    }

    .hero-slider .slider-nav {
        position: absolute;
        bottom: 1rem;
        left: 50%;

        transform: translateX(-50%);
        z-index: 10;
        display: flex;
        gap: 0.5rem;
    }

    .hero-slider .nav-dot {
        width: 12px;

        height: 12px;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.5);
        cursor: pointer;
        transition: background-color 0.3s;
    }

    .hero-slider .nav-dot.active {
        background-color: #fff;
    }

    .hero-slider-container {
        width: 100%;
        height: calc(100vh - 136px);

        position: relative;
        margin-bottom: 2rem;
    }

    .hero-slider .slide {
        position: absolute;

        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transition: opacity 0.8s ease-in-out;
        z-index: 1;
    }

    .hero-slider .slide.active {
        opacity: 1;
        z-index: 2;
    }

    .slider-arrow {
        position: absolute;
        top: 100%;
        transform: translateY(-100%);

        background-color: rgba(0, 0, 0, 0.5);
        color: white;
        border: none;
        padding: 0.5rem;
        cursor: pointer;
        z-index: 10;
        font-size: 1.5rem;
        transition: background-color 0.3s;
    }

    .slider-arrow:hover {
        background-color: rgba(0, 0, 0, 0.8);
    }

    .slider-arrow.prev {
        left: 10px;
    }

    .slider-arrow.next {
        right: 10px;
    }

    .slider-nav {
        position: absolute;
        bottom: 20px;
        left: 50%;

        transform: translateX(-50%);
        display: flex;
        gap: 10px;
        z-index: 10;
    }

    .slider-nav .nav-dot {
        width: 12px;

        height: 12px;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.4);
        cursor: pointer;
        transition: background-color 0.3s;
    }

    .slider-nav .nav-dot.active {
        background-color: white;
    }
}

.tile-row.horizontal-scroll {
    display: flex;
    padding-bottom: 1rem;
    gap: 1rem;
    flex-direction: row;
    flex-wrap: wrap;
}

.tile-row.horizontal-scroll .tile {
    flex: 0 0 auto;
    width: 180px;
}

.tile-row {
    /* display: contents;
*/
    /* This was causing issues */
}

.tile-row .tile {
    width: auto;
    /* Let the grid control the tile size */
}

.hero-banner {
    position: relative;
    height: 400px;

    background: url('https://source.unsplash.com/random/1920x1080/?movie,cinema') no-repeat center center/cover;
    color: #fff;
    display: flex;
    align-items: flex-end;
    padding: 40px;
    margin-bottom: 30px;
    grid-column: 1 / -1;
    /* Make hero span full width of the grid */
}

.hero-banner::after {
    content: '';
    position: absolute;
    top: 0;

    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-color);
}

/* --- TV Optimizations --- */
/* Hide elements on TV, but keep the rule for clarity */
body.is-tv .nav-right {
    display: none;
}

body.is-tv #open-episode-panel-btn {
    display: none;
}

/* --- Admin Panel Responsive --- */
@media (max-width: 768px) {

    .tile-row.horizontal-scroll .tile,
    .tiles-container.horizontal-scroll .tile {
        flex: 0 0 auto;

        width: calc(50% - 8px) !important;
    }

    .admin-section {
        padding: 1rem;
    }

    .stats-container,
    .stats-actions {
        flex-direction: column;
    }

    .user-table,
    .user-table tbody,
    .user-table tr,
    .user-table td {
        display: block;

        width: 100% !important;
    }

    .user-table thead {
        display: none;
    }

    .user-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);

        border-radius: 8px;
        padding: 1rem;
    }

    .user-table td {
        display: flex;

        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
        border: none;
        border-bottom: 1px solid var(--border-color);
    }

    .user-table td:last-child {
        border-bottom: none;
    }

    .user-table td::before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 1rem;
    }

    .user-table .actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .user-table .actions button {
        width: 100%;
    }

    .form-control-small {
        width: 100%;
    }
}

.btn.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.btn-secondary {
    background-color: transparent;
    border: 2px solid white;
    color: white;
}

.btn.btn-third {
    background-color: var(--third-color);
    border: 2px solid var(--third-color);
    color: white;
}

.btn.btn-third:hover {
    background-color: #ff8533;
    border: 2px solid #ff8533;
    color: white;
}

/* TV-specific styles from Jules */
body.is-tv #open-episode-panel-btn {
    display: none;
}

/* --- Detail Page & Hero Styles --- */
.hero-meta {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.hero-meta .separator {
    margin: 0 0.5rem;
}

.hero-actors {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.hero-actors strong {
    color: var(--text-color);
}

.detail-page-main {
    width: 100%;
}

.detail-hero {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 70px);
    background-size: cover;
    background-position: center;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 2rem;
}

.hero-overlay {
    position: absolute;

    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, var(--bg-color) 0%, rgba(0, 0, 0, 0.4) 100%);
}

.hero-content {
    position: relative;

    z-index: 2;
    display: flex;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-poster img {
    width: 200px;
    height: auto;

    border-radius: 8px;
}

.hero-info {
    flex: 1;
}

.hero-info h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-info p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;

    max-width: 80%;
}

.hero-info p a#read-more-btn {
    color: var(--text-muted);
    text-decoration: underline;
    font-weight: normal;
    cursor: pointer;
    margin-left: 5px;
}

.hero-info p a#read-more-btn:hover {
    color: var(--primary-color);
}

.hero-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

@media (min-width: 768px) {

    /* --- Detail Page & Hero Styles --- */
    .hero-meta {
        margin-bottom: 1rem;

        color: var(--text-muted);
    }

    .hero-meta .separator {
        margin: 0 0.5rem;
    }

    .hero-actors {
        margin-bottom: 1.5rem;

        color: var(--text-muted);
        font-size: 0.9rem;
    }

    .hero-actors strong {
        color: var(--text-color);
    }

    .detail-page-main {
        width: 100%;
    }

    .detail-hero {
        position: relative;
        width: 100%;
        min-height: calc(100vh - 70px);
        background-size: cover;
        background-position: 0 30%;
        color: #fff;
        display: flex;
        align-items: center;
        padding: 2rem;
    }

    .hero-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;

        background: linear-gradient(to top, var(--bg-color) 0%, rgba(0, 0, 0, 0.4) 100%);
    }

    .hero-content {
        position: relative;
        z-index: 2;
        display: flex;

        gap: 2rem;
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
    }

    .hero-poster img {
        width: 200px;
        height: auto;

        border-radius: 8px;
    }

    .hero-info {
        flex: 1;
    }

    .hero-info h1 {
        font-size: 2.5rem;

        margin-bottom: 1rem;
    }

    .hero-info p {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
        max-width: 80%;
    }

    .hero-info p a#read-more-btn {
        color: var(--text-muted);
        text-decoration: underline;
        font-weight: normal;
        cursor: pointer;
        margin-left: 5px;
    }

    .hero-info p a#read-more-btn:hover {
        color: var(--primary-color);
    }

    .hero-actions {
        display: flex;
        gap: 1rem;

        align-items: center;
    }
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

.detail-content {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.seasons-episodes h2 {
    margin-bottom: 1.5rem;
}

.season {
    margin-bottom: 2rem;
    margin-top: 2rem;
}

.season h3 {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.episode-list {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

@media (max-width: 1200px) {
    .episode-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .episode-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .episode-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

.episode-item-wrapper {
    min-width: 0;
    /* Ensures grid items can shrink and respect columns */
    height: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--tile-bg-color);
    border-radius: 5px;
    padding-right: 15px;
    transition: background-color 0.3s;
}

.episode-item-wrapper:hover {
    background-color: var(--tile-bg-hover-color);
}

a.episode-item {
    text-decoration: none;
}

.episode-item-wrapper .episode-item {
    background-color: transparent;
    flex-grow: 1;
    min-width: 0;
    text-align: left;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
}

.episode-item-wrapper .episode-item:hover {
    background-color: transparent;
}

.episode-item-wrapper .episode-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
    font-size: 0.9rem;
    color: #ccc;
}

.episode-item-wrapper .episode-number {
    font-weight: 800;
    color: #888;
    margin-bottom: 0.3rem;
    font-size: 1.2rem;
}

.episode-item-wrapper .episode-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.episode-item-wrapper .episode-actions label {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.episode-item-wrapper .episode-actions input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
}

/* .episode-item styles are consolidated above under .episode-item-wrapper .episode-item */
.episode-item.from-player {
    background-color: var(--tile-bg-color);
    padding: 1rem;
    border-radius: 5px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.3s;
    display: flex;
    flex-direction: column;
}

border: none;
font-family: inherit;
font-size: inherit;
text-align: left;
}

.movie-item {
    background-color: #ff6600;

    padding: 0.5rem;
    border-radius: 5px;
    text-decoration: none;
    color: #000;
    transition: background-color 0.3s;
    display: flex;
    flex-direction: column;
    border: none;
    font-family: inherit;

    font-size: inherit;
    text-align: left;
}

.episode-list.movie {
    grid-template-columns: 100%;
}

.movie-number {
    text-align: center;
    font-weight: 800;
    color: #fff;
    font-size: 1.4em;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.episode-item:hover {
    background-color: var(--tile-bg-hover-color);
}

.episode-number {
    font-weight: 800;
    color: var(--primary-color);

    margin-bottom: 0.5rem;
    font-size: 1.4em;
}

.similar-section {
    margin-top: 2rem;
}

.tiles-container.horizontal-scroll {
    display: flex;
    padding-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
    flex-direction: row;
}

.tiles-container.horizontal-scroll .tile {
    flex: 0 0 auto;
    width: 180px;
}

.horizontal-scroll::-webkit-scrollbar {
    height: 8px;
}

.horizontal-scroll::-webkit-scrollbar-track {
    background: var(--surface-color);
}

.horizontal-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);

    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 8px;
    max-width: 800px;

    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;

    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
}

.remote-tabs {
    display: flex;
    border-bottom: 1px solid #444;
    margin-bottom: 1rem;
}

.tab-link {
    background: none;

    border: none;
    color: var(--text-muted);
    padding: 1rem;
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-link.active {
    color: var(--text-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

#remote-episode-list .episode-item.active {
    background-color: var(--primary-color);
    color: #fff;
}

#connection-status-indicator {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    position: absolute;
    top: 0;

    left: 0;
}

#connection-status-indicator.connected {
    background-color: #28a745;
    color: white;
}

#connection-status-indicator.disconnected {
    background-color: #dc3545;
    color: white;
}

@media (max-width: 768px) {
    .detail-hero {
        min-height: auto;
        height: auto;
        padding: 1.5rem;
    }

    .hero-content {
        flex-direction: column;
        align-items: center;
        gap: 0rem;
        text-align: center;
    }

    .hero-poster img {
        width: 150px;
    }

    .hero-info p {
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .continue-watching-row {
        display: flex;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-info h1 {
        font-size: 1.8rem;
    }

    .hero-info p {
        font-size: 1rem;
    }

    .episode-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* --- TV Manager Styles --- */
.tv-manager-container {
    display: flex;
    gap: 2rem;
}

.tv-manager-sidebar {
    flex: 0 0 350px;
}

.tv-manager-main {
    flex-grow: 1;
}

.manager-list {
    list-style: none;
    padding: 0;
}

.manager-list li {
    background-color: var(--surface-color);
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.manager-list li:hover {
    background-color: #333;
}

.manager-list li.active {
    background-color: var(--primary-color);
    color: white;
}

.manager-list li .actions {
    display: none;
    margin-left: auto;
    padding-left: 1rem;
}

.manager-list li:hover .actions,
.manager-list li.active .actions {
    display: flex;
    gap: 0.5rem;
}

.manager-list li .actions button {
    padding: 2px 6px;
    font-size: 0.8rem;
    border-radius: 3px;
    line-height: 1;
}

.schedule-list,
.playlist-item-list {
    list-style: none;
    padding: 0;
    min-height: 200px;
}

.schedule-item,
.playlist-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.schedule-item-header,
.playlist-item-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.schedule-item-header {
    cursor: grab;
}

.playlist-item {
    cursor: grab;
}

.schedule-item-header:active,
.playlist-item:active {
    cursor: grabbing;
}

.schedule-item-header h4 {
    margin: 0;
}

.schedule-item-content,
.playlist-item-content {
    padding: 1rem;
    font-size: 0.9rem;
}

.schedule-item-content ul,
.playlist-item-list {
    list-style: none;
    padding: 0;
}

.schedule-item-content li,
.playlist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 4px;
    background: var(--surface-color);
}

.schedule-item-content img,
.playlist-item img {
    width: 25px;
    height: auto;
    border-radius: 3px;
}

.schedule-item-content li .time {
    font-size: 0.8em;
    color: var(--text-muted-color);
    min-width: 110px;
}

.schedule-item-content li .title {
    flex-grow: 1;
}

.schedule-item-content li .actions {
    margin-left: auto;
}

.playlist-item .actions {
    margin-left: auto;
}

.ghost {
    opacity: 0.4;
    background: #333;
}

.form-group-inline {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

#main-view-title {
    margin-top: 0;
}

/* Styles for the new Schedule Edit Modal */
#schedule-edit-modal .modal-content {
    max-width: 800px;
}

.schedule-edit-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.schedule-edit-list {
    background-color: var(--surface-color);
    padding: 1rem;
    border-radius: 5px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.schedule-edit-list h4 {
    margin-top: 0;
}

.schedule-edit-list ul {
    list-style: none;
    padding: 0;
    min-height: 250px;
}

.schedule-edit-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 4px;
    background: var(--card-bg);
    margin-bottom: 8px;
    cursor: grab;
}

.schedule-edit-list li:active {
    cursor: grabbing;
}

.schedule-edit-list li img {
    width: 25px;
    height: auto;
    border-radius: 3px;
}

.schedule-edit-list li .title {
    flex-grow: 1;
    font-size: 0.9em;
}

.schedule-edit-list li .duration {
    font-size: 0.8em;
    color: var(--text-muted-color);
}

/* --- Streaming TV EPG Styles --- */
#epg-container {
    display: grid;
    grid-template-columns: 150px 1fr;
    /* Channel names and timeline */
    overflow-x: auto;
    background-color: var(--surface-color);
    border-radius: 8px;
}

.epg-channels {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: var(--surface-color);
}

.epg-channel-header,
.epg-timeline-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--surface-color);
    z-index: 3;
}

.epg-channel-cell {
    height: 80px;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.epg-channel-cell:hover {
    background-color: #2a2a2a;
}

.epg-timeline {
    position: relative;
}

.epg-timeline-header {
    display: grid;
    grid-template-columns: repeat(12, 10fr);
    /* 12 hours view */
}

.epg-timeline-hour {
    text-align: center;
    color: var(--text-muted);
}

.epg-channel-row {
    height: 80px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.epg-program {
    position: absolute;
    height: 100%;
    background-color: var(--card-bg);
    border-left: 3px solid var(--primary-color);
    padding: 8px;
    border-radius: 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    /* cursor: pointer; */
    /* No longer clickable */
    transition: background-color 0.2s;
    font-size: 0.9rem;
    pointer-events: none;
    /* Make sure it doesn't intercept clicks meant for the row/cell */
}

.epg-program:hover {
    background-color: #444;
    /* This won't trigger anymore due to pointer-events: none, which is fine */
}

.epg-program-title {
    font-weight: bold;
}

.epg-program-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

#epg-container::-webkit-scrollbar {
    height: 12px;
}

#epg-container::-webkit-scrollbar-track {
    background: var(--surface-color);
    border-radius: 10px;
}

#epg-container::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
    border: 3px solid var(--surface-color);
}

.epg-time-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #cc3333;
    z-index: 4;
    pointer-events: none;
}

/* --- TV Layout & Navigation --- */
body.is-tv .main-nav a[href*="streaming_tv.php"],
body.is-tv .main-nav a[href*="download_manager.php"],
body.is-tv .main-nav a[href*="tv_manager.php"],
body.is-tv .main-nav .admin-link,
body.is-tv .dropdown-menu {
    display: none !important;
}

body.is-tv #results-container {
    grid-template-columns: repeat(4, 1fr) !important;
}

body.is-tv .tile-row {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.5rem;
    overflow-x: visible !important;
}

body.is-tv .horizontal-scroll {
    overflow-x: visible !important;
    white-space: normal !important;
}

body.is-tv .tile {
    display: block !important;
    width: 100% !important;
    margin-right: 0 !important;
}


/* --- Player Focus Enhancements --- */
.shaka-video-container .shaka-controls-container button:focus,
.shaka-video-container .ep-nav-btn:focus {
    outline: none !important;
    border: 3px solid #fff !important;
    box-shadow: 0 0 15px #fff !important;
    transform: scale(1.1);
    z-index: 1000 !important;
    position: relative;
}

/* Seekbar/volume range inputs get a separate, non-destructive focus style.
   transform/border/position changes break the coordinate mapping of range inputs,
   causing the cursor to jump to wrong positions in the timeline. */
.shaka-video-container .shaka-controls-container input[type="range"]:focus {
    outline: none !important;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5) !important;
}

/* --- Offline Mode List View --- */
body.is-offline .media-tile {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 10px !important;
    background: var(--surface-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
    margin-bottom: 5px !important;
    height: auto !important;
    width: 100% !important;
}

body.is-offline .media-tile .media-poster,
body.is-offline .media-tile img {
    display: none !important;
    /* Hide images in offline mode */
}

body.is-offline .media-tile .media-info {
    margin: 0 !important;
    padding: 0 10px !important;
    width: 100% !important;
    text-align: left !important;
}

body.is-offline .media-tile .media-title {
    font-size: 1.1rem !important;
    margin-bottom: 0 !important;
    color: var(--text-color) !important;
}

body.is-offline .media-grid {
    display: block !important;
    /* Normal block list instead of grid */
}

/* --- Player Episode Nav & Overlay --- */
.shaka-slplayer-button {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 48px;
    transition: transform 0.2s;
}

.shaka-slplayer-button:hover {
    transform: scale(1.1);
}

.shaka-slplayer-button svg {
    width: 28px;
    height: 28px;
}

.ep-overlay {
    position: absolute;
    top: 30px;
    left: 40px;
    color: #fff;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.5s ease;
    text-align: left;
}

.ep-series-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-color, #ff6600);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.9);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ep-meta {
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

/* Fade out with Shaka controls */
.shaka-controls-container[shown="false"] .ep-overlay {
    opacity: 0;
}

/* --- Autoplay Countdown --- */
.autoplay-countdown {
    position: absolute;
    bottom: 100px;
    right: 40px;
    z-index: 2000;
}

.autoplay-box {
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* --- Immer sichtbarer Lautstärkeregler --- */
.shaka-volume-bar-container-allow-hiding,
.shaka-volume-bar-container {
    width: 100px !important;
    opacity: 1 !important;
}

.autoplay-box p {
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 500;
}

.autoplay-box .btn {
    background: #444;
    border: none;
    color: #fff;
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.autoplay-box .btn:hover {
    background: #666;
}