/* ============================================================================
   LAYOUT AND BODY
   ============================================================================ */
body {
    margin: 0;
    padding: 0;
    background-color: #ffffff;
    font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* ============================================================================
   SWISS DESIGN HEADER
   Clean, minimal, grid-based header with mathematical precision
   ============================================================================ */
.swiss-header {
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #000000;
    padding: 0;
    margin: 0;
}

.swiss-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px 30px 20px;
}

.swiss-title {
    font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
    font-size: 72px;
    font-weight: 300;
    letter-spacing: -2px;
    line-height: 1;
    margin: 0;
    padding: 0;
    color: #000000;
    text-transform: uppercase;
}

.swiss-tagline {
    font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 0.5px;
    line-height: 1.4;
    margin: 12px 0 0 0;
    padding: 0;
    color: #000000;
    text-transform: none;
}

/* ============================================================================
   TV CONTAINER AND SCREEN
   ============================================================================ */
.tv-container {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 50px rgba(0,0,0,0.9);
    margin: 20px auto;
    width: 95%;
    max-width: 1400px;
}

.screen {
    background: linear-gradient(180deg, #1e2a5e 0%, #0d1633 50%, #1a1e4a 100%);
    border: 15px solid #0a0a15;
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    min-height: 900px;
    height: auto;
    position: relative;
    box-shadow: inset 0 0 60px rgba(0,0,0,0.8), 0 0 20px rgba(50,100,255,0.3);
}

/* ============================================================================
   VISUAL EFFECTS
   ============================================================================ */
.scanlines {
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255,255,255,0.03) 0px,
        rgba(255,255,255,0.03) 2px,
        rgba(0,0,0,0) 2px,
        rgba(0,0,0,0) 4px
    );
    z-index: 5;
}

/* ============================================================================
   CLOCK AND DATE
   ============================================================================ */
.clock {
    color: #ffd700;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255,215,0,0.8), 2px 2px 4px rgba(0,0,0,0.8);
    background: rgba(0,0,50,0.6);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,215,0,0.3);
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    margin-left: 10px;
}

/* ============================================================================
   FULLSCREEN BUTTON
   ============================================================================ */
.fullscreen-btn {
    color: #ffd700;
    font-size: 20px;
    font-weight: bold;
    background: rgba(0,0,50,0.6);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,215,0,0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.fullscreen-btn:hover {
    background: rgba(61,90,254,0.8);
    border-color: #3d5afe;
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(61,90,254,0.6);
}

.fullscreen-btn:active {
    transform: scale(0.95);
}

.fullscreen-icon {
    display: inline-block;
    text-shadow: 0 0 10px rgba(255,215,0,0.8), 2px 2px 4px rgba(0,0,0,0.8);
}

/* Fullscreen mode adjustments */
.tv-container:fullscreen,
.tv-container:-webkit-full-screen,
.tv-container:-moz-full-screen,
.tv-container:-ms-fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    border-radius: 0;
    padding: 0;
}

.tv-container:fullscreen .screen,
.tv-container:-webkit-full-screen .screen,
.tv-container:-moz-full-screen .screen,
.tv-container:-ms-fullscreen .screen {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
}

.tv-container:fullscreen .guide-container,
.tv-container:-webkit-full-screen .guide-container,
.tv-container:-moz-full-screen .guide-container,
.tv-container:-ms-fullscreen .guide-container {
    height: calc(100vh - 200px); /* Adjust for header sections */
}

/* Hide channel filters when in fullscreen */
.tv-container:fullscreen ~ .controls,
.tv-container:-webkit-full-screen ~ .controls,
.tv-container:-moz-full-screen ~ .controls,
.tv-container:-ms-fullscreen ~ .controls {
    display: none;
}

/* ============================================================================
   AD BANNER / STATUS SECTION
   ============================================================================ */
.ad-section {
    color: #ffffff;
    text-align: center;
    padding: 12px;
    font-size: 16px;
    font-weight: bold;
    background: linear-gradient(90deg, #2d3e8f 0%, #3d5afe 50%, #2d3e8f 100%);
    border-bottom: 3px solid #1a237e;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    letter-spacing: 0.5px;
}

.loading {
    color: #ccc;
    text-align: center;
    padding: 20px;
}

/* ============================================================================
   CLICKABLE ADS CONTAINER
   ============================================================================ */
.ads-container {
    padding: 15px;
    background: linear-gradient(90deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    border-bottom: 2px solid #3d5afe;
    display: none; /* Hidden by default, shown when ads are loaded */
}

.ads-container.has-ads {
    display: block;
}

.ads-carousel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 5px;
    position: relative;
    min-height: 180px;
}

.ads-carousel::-webkit-scrollbar {
    height: 8px;
}

.ads-carousel::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}

.ads-carousel::-webkit-scrollbar-thumb {
    background: #2d3e8f;
    border-radius: 4px;
}

.ads-carousel::-webkit-scrollbar-thumb:hover {
    background: #3d5afe;
}

.ad-item {
    flex-shrink: 0;
    width: 280px;
    text-decoration: none;
    display: block;
    transition: opacity 0.8s ease-in-out, transform 0.3s ease;
    cursor: pointer;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.ad-item:hover {
    transform: translateX(-50%) scale(1.05);
}

.ad-item img {
    width: 100%;
    height: 157px;
    object-fit: cover;
    border: 3px solid #ffd700;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(255,215,0,0.3);
    transition: all 0.3s ease;
}

.ad-item:hover img {
    border-color: #3d5afe;
    box-shadow: 0 6px 20px rgba(61,90,254,0.6);
}

.ad-item-title {
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    margin-top: 8px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.ad-item:hover .ad-item-title {
    color: #3d5afe;
    text-shadow: 0 0 8px rgba(61,90,254,0.8);
}

/* ============================================================================
   MEDIA CONTROLS BAR
   Date, time, fullscreen, and speed controls in one row
   ============================================================================ */
.media-controls-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 15px;
    background: linear-gradient(90deg, #1a237e 0%, #283593 50%, #1a237e 100%);
    border-bottom: 2px solid #0d1633;
}

.media-controls-bar .clock {
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255,215,0,0.8);
    background: rgba(0,0,50,0.6);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,215,0,0.3);
}

.media-controls-bar .fullscreen-btn {
    color: #ffd700;
    font-size: 18px;
    font-weight: bold;
    background: rgba(0,0,50,0.6);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,215,0,0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.media-controls-bar .fullscreen-btn:hover {
    background: rgba(61,90,254,0.8);
    border-color: #3d5afe;
    color: #ffffff;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-size: 14px;
}

.speed-control label {
    color: #ffd700;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255,215,0,0.8);
}

.speed-control input[type="range"] {
    width: 100px;
    height: 6px;
    background: rgba(0,0,50,0.6);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #ffd700;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255,215,0,0.8);
}

.speed-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #ffd700;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255,215,0,0.8);
    border: none;
}

.speed-control #speedValue {
    color: #ffd700;
    font-weight: bold;
    min-width: 35px;
    text-shadow: 0 0 10px rgba(255,215,0,0.8);
}

/* ============================================================================
   MEDIA LAYOUT - Playlist (50%) + Future Container (50%)
   ============================================================================ */
.media-layout {
    display: none; /* Hidden until videos load */
    width: 100%;
    border-bottom: 2px solid #1a237e;
}

.videos-container {
    width: 50%;
    padding: 0;
    background: transparent;
    display: none; /* Hidden by default, shown when videos are loaded via JS */
    flex-direction: column;
}

.future-container {
    width: 50%;
    background: linear-gradient(180deg, #0d1633 0%, #1a1a2e 50%, #0d1633 100%);
    border-left: 2px solid #1a237e;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
    font-size: 14px;
}

.movie-screen {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.screen-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #000000;
}

.screen-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.screen-label {
    color: #ffd700;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    text-shadow:
        0 0 10px rgba(255,215,0,0.8),
        0 0 20px rgba(61,90,254,0.4),
        2px 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 10px 20px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,215,0,0.1) 50%, transparent 100%);
    border-radius: 8px;
    animation: cinema-glow 3s ease-in-out infinite;
}

@keyframes cinema-glow {
    0%, 100% {
        text-shadow:
            0 0 10px rgba(255,215,0,0.8),
            0 0 20px rgba(61,90,254,0.4),
            2px 2px 4px rgba(0,0,0,0.8);
    }
    50% {
        text-shadow:
            0 0 20px rgba(255,215,0,1),
            0 0 40px rgba(61,90,254,0.6),
            2px 2px 4px rgba(0,0,0,0.8);
    }
}

/* ============================================================================
   GUIDE HEADER (Channel Spacer & Time Slots)
   ============================================================================ */
.guide-header {
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, #2d3e8f 0%, #1e2a6e 100%);
    color: #fff;
    border-bottom: 3px solid #0d1633;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    padding: 5px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.channel-spacer {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    flex-shrink: 0;
    background: linear-gradient(90deg, #1a237e 0%, #283593 100%);
    border-right: 3px solid #0a0a15;
    height: 100%;
    box-shadow: inset -5px 0 10px rgba(0,0,0,0.3);
}

.time-slots-container {
    overflow: hidden;
    flex: 1;
}

.time-slots {
    display: flex;
    white-space: nowrap;
}

.time-slot {
    width: 140px;
    text-align: center;
    color: #ffffff;
    font-size: 15px;
    font-weight: bold;
    border-left: 2px solid #1a237e;
    padding: 6px 0;
    background: rgba(0,0,0,0.2);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.time-slot:first-child {
    border-left: none;
}

/* ============================================================================
   GUIDE CONTAINER (Scrollable area with auto-scroll & drag)
   ============================================================================ */
.guide-container {
    height: 770px;
    overflow-y: scroll;
    background: #0d1633;
    cursor: grab;
    user-select: none;
}

.guide-container.dragging {
    cursor: grabbing;
}

/* Scrollbar styling for guide container */
.guide-container::-webkit-scrollbar {
    width: 12px;
}

.guide-container::-webkit-scrollbar-track {
    background: rgba(10,10,21,0.8);
    border-left: 2px solid #1a237e;
}

.guide-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #2d3e8f 0%, #1e2a6e 100%);
    border-radius: 6px;
    border: 2px solid #1a237e;
    box-shadow: inset 0 0 6px rgba(61,90,254,0.5);
}

.guide-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #3d5afe 0%, #2d3e8f 100%);
    box-shadow: inset 0 0 8px rgba(61,90,254,0.8);
}

.guide-container::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #5d7afe 0%, #3d5afe 100%);
}

.guide-scroll {
    padding-bottom: 200px;
}

/* ============================================================================
   CHANNEL ROWS
   ============================================================================ */
.channel-row {
    display: flex;
    border-bottom: 2px solid #0a0a15;
    transition: all 0.2s ease;
}

.channel-row:nth-child(even) {
    background: rgba(30,42,94,0.3);
}

.channel-row:nth-child(odd) {
    background: rgba(20,30,70,0.4);
}

.channel-row:hover {
    background: rgba(50,70,150,0.4);
    box-shadow: inset 0 0 20px rgba(100,150,255,0.2);
}

.channel-row[data-source="xml"] {
    border-left: 3px solid #ffd700;
}

.channel-row[data-source="xml"] .channel-number {
    background: linear-gradient(90deg, #2d4a00 0%, #3d6a00 100%);
}

.channel-number {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    color: #ffd700;
    font-weight: bold;
    font-size: 16px;
    padding: 12px 4px;
    background: linear-gradient(90deg, #1a237e 0%, #283593 100%);
    text-align: center;
    border-right: 3px solid #0a0a15;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    box-shadow: inset -5px 0 10px rgba(0,0,0,0.3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
    position: relative;
}

.channel-number:hover::after {
    content: attr(data-channel-name);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #1a237e 0%, #0d1633 100%);
    color: #ffffff;
    padding: 8px 12px;
    border: 2px solid #3d5afe;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 9999;
    margin-left: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8), 0 0 30px rgba(61,90,254,0.4);
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    pointer-events: none;
}

/* ============================================================================
   SHOW BLOCKS (Individual TV programs)
   ============================================================================ */
.shows-container {
    display: flex;
    flex: 1;
}

.show-block {
    min-height: 50px;
    border-right: 2px solid #0a0a15;
    background: linear-gradient(180deg, #2d4a8f 0%, #1e3670 100%);
    color: #ffffff;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 500;
    position: relative;
    overflow: visible;
    white-space: normal;
    display: flex;
    align-items: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    line-height: 1.3;
    transition: all 0.2s ease;
}

.show-block:hover {
    background: linear-gradient(180deg, #3d5afe 0%, #2d4a8f 100%);
    transform: scale(1.02);
    z-index: 10;
    box-shadow: 0 4px 15px rgba(61,90,254,0.5);
}

.show-block:hover::after {
    content: attr(data-description);
    position: absolute;
    bottom: 100%;
    left: 0;
    background: linear-gradient(135deg, #1a237e 0%, #0d1633 100%);
    color: #ffffff;
    padding: 12px;
    border: 2px solid #3d5afe;
    border-radius: 8px;
    width: 260px;
    max-width: 300px;
    z-index: 9999;
    white-space: normal;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8), 0 0 30px rgba(61,90,254,0.4);
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* ============================================================================
   CHANNEL FILTERS CONTROL PANEL (Swiss Design)
   ============================================================================ */
.controls {
    position: relative;
    width: 95%;
    max-width: 1400px;
    background: #ffffff;
    color: #000000;
    padding: 20px;
    border: 1px solid #000000;
    box-shadow: none;
    margin: 20px auto;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0 0 12px 0;
    background: transparent;
    border-bottom: 1px solid #000000;
    transition: all 0.2s ease;
}

.controls-header:hover {
    opacity: 0.7;
}

.controls-header h3 {
    margin: 0;
    font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
    font-size: 24px;
    font-weight: 400;
    color: #000000;
    text-shadow: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.controls-header h3 span:first-child {
    display: none; /* Hide emoji in Swiss design */
}

.toggle-arrow {
    font-size: 16px;
    color: #000000;
}

.channel-filters {
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.channel-filters::-webkit-scrollbar {
    width: 1px;
}

.channel-filters::-webkit-scrollbar-track {
    background: #ffffff;
}

.channel-filters::-webkit-scrollbar-thumb {
    background: #000000;
}

.channel-filters::-webkit-scrollbar-thumb:hover {
    background: #333333;
}

.filter-item {
    font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
    font-size: 14px;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-radius: 0;
    transition: all 0.2s ease;
}

.filter-item:hover {
    opacity: 0.7;
}

.filter-item input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #000000;
}

.filter-item label {
    cursor: pointer;
    color: #000000;
    text-shadow: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */
.hidden {
    display: none;
}

.collapsed .channel-filters {
    display: none;
}

.collapsed .toggle-arrow {
    transform: rotate(-90deg);
}

/* ============================================================================
   PAGE FOOTER (Swiss Design)
   ============================================================================ */
.page-footer {
    width: 100%;
    padding: 30px 20px;
    text-align: left;
    background: #ffffff;
    border-top: 1px solid #000000;
    margin-top: 40px;
}

.page-footer p {
    max-width: 1400px;
    margin: 0 auto 8px auto;
    color: #000000;
    font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
    font-size: 14px;
    font-weight: 400;
    text-shadow: none;
}

.page-footer a {
    color: #000000;
    text-decoration: underline;
    font-weight: 400;
    transition: all 0.2s ease;
    text-shadow: none;
}

.page-footer a:hover {
    opacity: 0.7;
}

.visitor-count {
    margin-top: 0 !important;
    color: #000000;
    font-size: 14px;
}

.visitor-count #visitorCount {
    font-weight: 400;
    color: #000000;
    text-shadow: none;
}

/* ============================================================================
   MOBILE LANDSCAPE OPTIMIZATIONS
   ============================================================================ */
@media screen and (max-width: 1024px) and (orientation: landscape) {
    body {
        padding: 0;
        margin: 0;
    }

    .swiss-container {
        padding: 20px 15px;
    }

    .swiss-title {
        font-size: 48px;
        letter-spacing: -1px;
    }

    .swiss-tagline {
        font-size: 14px;
        margin-top: 8px;
    }

    .tv-container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 10px;
        border-radius: 8px;
    }

    .screen {
        height: calc(100vh - 140px);
        border-width: 8px;
    }

    /* Hide or collapse channel filters on mobile landscape */
    .controls {
        width: 100%;
        margin: 10px 0;
        padding: 8px;
    }

    .controls.collapsed .channel-filters {
        display: none;
    }

    .channel-filters {
        max-height: 150px;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 6px;
    }

    /* Adjust guide header for mobile */
    .guide-header {
        padding: 3px 0;
    }

    .fullscreen-btn {
        font-size: 16px;
        padding: 4px 8px;
        margin-right: 5px;
    }

    .clock {
        font-size: 12px;
        padding: 4px 8px;
        margin-left: 5px;
    }

    .channel-spacer {
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }

    .channel-number {
        width: 60px;
        min-width: 60px;
        max-width: 60px;
        font-size: 14px;
        padding: 8px 2px;
    }

    .time-slot {
        width: 110px;
        font-size: 12px;
        padding: 4px 0;
    }

    /* Adjust guide container height for mobile landscape */
    .guide-container {
        height: calc(100vh - 240px);
    }

    .show-block {
        min-height: 40px;
        font-size: 11px;
        padding: 6px 8px;
    }

    /* Adjust show block width for mobile */
    .show-block {
        min-width: 90px !important;
    }

    /* Hide tooltips on mobile to improve performance */
    .show-block:hover::after {
        display: none;
    }

    /* Adjust ads container for mobile */
    .ads-container {
        padding: 10px;
    }

    .ad-item {
        width: 200px;
    }

    .ad-item img {
        height: 112px;
    }

    /* Adjust movie screen for mobile landscape */
    .videos-container {
        padding: 15px 10px;
    }

    .movie-screen {
        max-width: 100%;
    }

    .screen-wrapper {
        padding-bottom: 50%; /* Closer to 16:9 on mobile */
        border-width: 3px;
    }

    .screen-label {
        font-size: 14px;
        letter-spacing: 2px;
        padding: 8px 15px;
    }

    /* Reduce footer padding */
    .page-footer {
        padding: 10px;
        margin-top: 10px;
    }

    .page-footer p {
        font-size: 12px;
    }
}

/* Extra small mobile landscape */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .swiss-container {
        padding: 15px 10px;
    }

    .swiss-title {
        font-size: 36px;
        letter-spacing: -1px;
    }

    .swiss-tagline {
        font-size: 12px;
        margin-top: 6px;
    }

    .screen {
        height: calc(100vh - 100px);
        border-width: 5px;
    }

    .tv-container {
        padding: 5px;
    }

    .ad-section {
        padding: 8px;
        font-size: 12px;
    }

    .ads-container {
        padding: 8px;
    }

    .videos-container {
        padding: 10px 8px;
    }

    .screen-wrapper {
        padding-bottom: 56.25%; /* 16:9 on small screens */
        border-width: 2px;
    }

    .screen-label {
        font-size: 12px;
        letter-spacing: 1px;
        padding: 6px 12px;
    }

    .channel-spacer {
        width: 50px;
        min-width: 50px;
        max-width: 50px;
    }

    .channel-number {
        width: 50px;
        min-width: 50px;
        max-width: 50px;
        font-size: 12px;
        padding: 6px 2px;
    }

    .time-slot {
        width: 90px;
        font-size: 11px;
    }

    .show-block {
        min-height: 35px;
        font-size: 10px;
        padding: 4px 6px;
        min-width: 75px !important;
    }

    .guide-container {
        height: calc(100vh - 200px);
    }

    .fullscreen-btn {
        font-size: 14px;
        padding: 3px 6px;
    }

    .clock {
        font-size: 10px;
        padding: 3px 6px;
    }

    /* Auto-collapse channel filters on small screens */
    .controls {
        margin: 5px 0;
    }

    .channel-filters {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .filter-item {
        font-size: 11px;
        padding: 4px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .guide-container {
        cursor: default;
        -webkit-overflow-scrolling: touch;
    }

    .guide-container.dragging {
        cursor: default;
    }

    /* Larger touch targets */
    .fullscreen-btn {
        padding: 8px 14px;
        font-size: 18px;
    }

    .filter-item input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    /* Disable hover effects on touch devices */
    .show-block:hover {
        transform: none;
        background: linear-gradient(180deg, #2d4a8f 0%, #1e3670 100%);
    }

    .fullscreen-btn:hover {
        transform: none;
    }
}

/* General mobile responsive styles */
@media screen and (max-width: 768px) {
    .swiss-container {
        padding: 25px 15px;
    }

    .swiss-title {
        font-size: 42px;
        letter-spacing: -1px;
    }

    .swiss-tagline {
        font-size: 14px;
        margin-top: 8px;
    }

    .controls {
        width: 90%;
        padding: 15px;
    }

    .controls-header h3 {
        font-size: 20px;
    }

    .channel-filters {
        grid-template-columns: 1fr;
    }

    .videos-container {
        padding: 15px 10px;
    }

    .screen-wrapper {
        padding-bottom: 56.25%; /* 16:9 for mobile portrait */
        border-width: 3px;
    }

    .screen-label {
        font-size: 16px;
        letter-spacing: 2px;
    }
}