* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background-color: #2d2d2d;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #404040;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

/* Hide header in fullscreen */
body.fullscreen header {
    transform: translateY(-100%);
}

.fullscreen-btn {
    background-color: #404040;
    color: white;
    border: 1px solid #555555;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    margin-left: 10px;
}

.fullscreen-btn:hover {
    background-color: #555555;
}

.fullscreen-btn:focus {
    outline: none;
    border-color: #00aaff;
}

.header-hover-zone {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    z-index: 499;
    pointer-events: auto;
}

header h1 {
    color: #00aaff;
    font-size: 1.5rem;
    font-weight: 300;
}

.controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.controls label {
    font-weight: 500;
    color: #cccccc;
}

.controls select {
    background-color: #404040;
    color: #ffffff;
    border: 1px solid #555555;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.controls select:focus {
    outline: none;
    border-color: #00aaff;
}

.controls button {
    background-color: #ff4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.controls button:hover {
    background-color: #cc3333;
}

.main-content {
    flex: 1;
    overflow: hidden;
    height: 100vh;
    padding-top: 80px;
    transition: padding-top 0.3s ease;
}

.video-grid-container {
    width: 100%;
    height: calc(100vh - 80px);
    background-color: #000000;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* Fullscreen adjustments */
body.fullscreen .main-content {
    padding-top: 0;
}

body.fullscreen .video-grid-container {
    height: 100vh;
}

body.fullscreen {
    cursor: none;
}

/* Hide all UI elements in fullscreen except videos */
body.fullscreen .channel-button,
body.fullscreen .video-controls,
body.fullscreen .channel-selector {
    display: none !important;
}

.video-grid {
    display: grid;
    gap: 0;
    width: 100%;
    height: 100%;
}

/* Grid layouts */
.grid-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.grid-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.grid-9 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

.grid-16 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr 1fr;
}

.video-slot {
    position: relative;
    background-color: #1a1a1a;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    min-height: 0;
    min-width: 0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.video-slot:hover:not(.has-video) {
    background-color: #2a2a2a;
}

.video-slot.has-video {
    cursor: default;
}

.video-slot.drop-zone {
    border: 2px dashed #00aaff;
    background-color: rgba(0, 170, 255, 0.1);
}

.video-slot.has-video {
    border: none;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.video-slot.has-video .video-js {
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.video-slot .placeholder {
    color: #666666;
    font-size: 14px;
    text-align: center;
    pointer-events: none;
}

.channel-selector {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.95);
    border: 2px solid #00aaff;
    border-radius: 8px;
    padding: 20px;
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.channel-selector.show {
    opacity: 1;
    visibility: visible;
}

.channel-button {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid #00aaff;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    z-index: 100;
    font-weight: bold;
    white-space: nowrap;
}

.video-slot:hover .channel-button {
    opacity: 1;
}

.channel-button:hover {
    background-color: rgba(0, 170, 255, 0.8);
    transform: scale(1.1);
}

.channel-button.active {
    background-color: rgba(0, 170, 255, 0.9);
    opacity: 1;
}

.channel-selector h4 {
    color: #00aaff;
    margin-bottom: 15px;
    font-size: 16px;
    text-align: center;
    position: relative;
}

.channel-filters {
    margin-bottom: 15px;
    border-bottom: 1px solid #555555;
    padding-bottom: 15px;
}

.channel-search {
    width: 100%;
    background-color: rgba(64, 64, 64, 0.8);
    border: 1px solid #555555;
    border-radius: 4px;
    padding: 8px 12px;
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 10px;
}

.channel-search:focus {
    outline: none;
    border-color: #00aaff;
    background-color: rgba(64, 64, 64, 1);
}

.channel-search::placeholder {
    color: #aaaaaa;
}

.country-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.country-filter {
    background-color: rgba(64, 64, 64, 0.8);
    color: #ffffff;
    border: 1px solid #555555;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.country-filter:hover {
    background-color: rgba(0, 170, 255, 0.2);
    border-color: #00aaff;
}

.country-filter.active {
    background-color: rgba(0, 170, 255, 0.3);
    border-color: #00aaff;
    color: #ffffff;
}

.country-filter.all {
    background-color: rgba(85, 85, 85, 0.8);
}

.country-filter.all.active {
    background-color: rgba(0, 170, 255, 0.4);
}

.channel-selector-close {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff4444;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.channel-selector-close:hover {
    background-color: #cc3333;
}

.channel-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.channel-item {
    background-color: rgba(64, 64, 64, 0.8);
    border: 1px solid #555555;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.channel-item:hover {
    background-color: rgba(0, 170, 255, 0.2);
    border-color: #00aaff;
}

.channel-item.active {
    background-color: rgba(0, 170, 255, 0.3);
    border-color: #00aaff;
}

.channel-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.channel-name {
    font-weight: 500;
    color: #ffffff;
    font-size: 14px;
    flex: 1;
}

.channel-country {
    font-weight: 400;
    color: #00aaff;
    font-size: 11px;
    background-color: rgba(0, 170, 255, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
    white-space: nowrap;
}

.video-js {
    width: 100% !important;
    height: 100% !important;
    background-color: #000000;
    position: relative;
}

.video-js .vjs-tech {
    object-fit: contain;
    width: 100% !important;
    height: 100% !important;
}

/* Hide Video.js controls completely */
.video-js .vjs-control-bar,
.video-js .vjs-big-play-button,
.video-js .vjs-loading-spinner,
.video-js .vjs-poster {
    display: none !important;
}

/* Never show the big play button */
.video-js .vjs-big-play-button {
    display: none !important;
    visibility: hidden !important;
}

/* Hide all other Video.js UI elements */
.video-js .vjs-menu-button,
.video-js .vjs-fullscreen-control,
.video-js .vjs-picture-in-picture-control,
.video-js .vjs-volume-panel,
.video-js .vjs-current-time,
.video-js .vjs-time-control,
.video-js .vjs-duration,
.video-js .vjs-progress-control,
.video-js .vjs-play-control,
.video-js .vjs-mute-control {
    display: none !important;
}

.video-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.video-slot:hover .video-controls {
    opacity: 1;
}

.video-controls button {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-controls button:hover {
    background-color: rgba(255, 68, 68, 0.8);
}

.channel-label {
    position: absolute;
    top: 1.5%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.4em 1em;
    border-radius: 0.3em;
    font-size: clamp(10px, 2vw, 16px);
    font-weight: bold;
    z-index: 20;
    pointer-events: none;
    transition: color 0.2s, opacity 0.2s;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-label.muted {
    color: white;
}

.channel-label.unmuted {
    color: #ff4444;
}

.channel-label.hidden {
    display: none;
}

/* Scrollbar styling for channel selector */
.channel-selector::-webkit-scrollbar {
    width: 6px;
}

.channel-selector::-webkit-scrollbar-track {
    background: rgba(45, 45, 45, 0.5);
}

.channel-selector::-webkit-scrollbar-thumb {
    background: #555555;
    border-radius: 3px;
}

.channel-selector::-webkit-scrollbar-thumb:hover {
    background: #666666;
}

/* Responsive design */
@media (max-width: 768px) {
    .channel-selector {
        min-width: 280px;
        max-width: 90vw;
        padding: 15px;
    }
    
    .channel-name {
        font-size: 13px;
    }
    
    .channel-url {
        font-size: 10px;
    }
}
