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

body {
    font-family: Arial, sans-serif;
    background-color: #0f0f0f;
    color: white;
    min-height: 100vh;
    margin: 0;
    padding-top: 60px; /* Space for fixed top bar */
    transition: padding-top 0.3s ease;
}

body.top-bar-collapsed {
    padding-top: 25px; /* More space between toggle button and videos when collapsed */
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #1a1a1a;
    border-bottom: 2px solid #333;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.top-bar.collapsed {
    transform: translateY(-100%);
}

.toggle-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    background-color: #333;
    color: white;
    border: 2px solid #444;
    border-radius: 6px;
    width: 40px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.toggle-btn:hover {
    background-color: #555;
}

.top-bar.collapsed .toggle-btn {
    top: -2px;
    background-color: #1a1a1a;
    border: 2px solid #333;
    border-radius: 0 0 8px 8px;
    transform: translateY(62px);
}

.top-bar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 20px;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    align-items: center;
}

.brand {
    text-align: left;
    margin: 0;
}

.brand h1 {
    font-size: 1.3rem;
    color: #ff0000;
    margin: 0 0 2px 0;
}

.brand p {
    color: #aaa;
    font-size: 0.7rem;
    margin: 0;
}

.controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.button-group {
    display: flex;
    gap: 5px;
}

.container {
    max-width: 100%;
    padding: 20px;
    min-height: auto;
}

.url-input {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
    padding: 10px;
    border: 2px solid #333;
    border-radius: 6px;
    background-color: #222;
    color: white;
    font-size: 0.9rem;
}

.url-input:focus {
    outline: none;
    border-color: #ff0000;
}

.add-btn, .clear-btn, .mute-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.add-btn {
    background-color: #ff0000;
    color: white;
}

.add-btn:hover {
    background-color: #cc0000;
}

.clear-btn {
    background-color: #333;
    color: white;
}

.clear-btn:hover {
    background-color: #555;
}

.mute-btn {
    background-color: #444;
    color: white;
}

.mute-btn:hover {
    background-color: #333;
}

.mute-btn.muted {
    opacity: 0.5;
}

.save-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 10px 15px;
    background-color: #444;
    border-radius: 6px;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.save-checkbox:hover {
    background-color: #555;
}

.save-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Auto-complete dropdown styles */
.autocomplete-dropdown {
    background-color: #222;
    border: 2px solid #333;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.autocomplete-item {
    padding: 10px 15px;
    color: white;
    cursor: pointer;
    border-bottom: 1px solid #333;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #ff0000;
    color: white;
}

.autocomplete-item.active {
    background-color: #ff0000;
}

.streams-container {
    display: grid;
    gap: 20px;
    width: 100%;
    height: calc(100vh - 80px);
}

/* Grid layouts for different stream counts */
.streams-container.count-1 {
    grid-template-columns: 1fr;
}

.streams-container.count-2 {
    grid-template-columns: 1fr 1fr;
}

.streams-container.count-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.streams-container.count-3 .stream:first-child {
    grid-column: 1 / -1;
}

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

.streams-container.count-5,
.streams-container.count-6 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.streams-container.count-7,
.streams-container.count-8,
.streams-container.count-9 {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

.streams-container.count-more {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(250px, 1fr);
}

/* Spotlight layouts - horizontal split with main video on top */
.streams-container.has-spotlight {
    grid-template-rows: 1fr 0.4fr;
    grid-template-columns: 1fr;
}

.streams-container.has-spotlight .stream.spotlight {
    grid-row: 1;
    grid-column: 1 / -1;
    border: 3px solid #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

/* Bottom row for other videos */
.streams-container.has-spotlight .stream:not(.spotlight) {
    grid-row: 2;
}

/* Different bottom layouts based on number of other videos */
.streams-container.has-spotlight.others-1 {
    grid-template-rows: 1fr 0.4fr;
    grid-template-columns: 1fr;
}

.streams-container.has-spotlight.others-2 {
    grid-template-rows: 1fr 0.4fr;
    grid-template-columns: 1fr 1fr;
}

.streams-container.has-spotlight.others-3 {
    grid-template-rows: 1fr 0.4fr;
    grid-template-columns: 1fr 1fr 1fr;
}

.streams-container.has-spotlight.others-4 {
    grid-template-rows: 1fr 0.4fr;
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.streams-container.has-spotlight.others-more {
    grid-template-rows: 1fr 0.4fr;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stream {
    position: relative;
    background-color: #111;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #333;
    display: flex;
    flex-direction: column;
}

.stream-header {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
}

.platform-indicator {
    font-size: 0.9rem;
    line-height: 1;
}

.stream-title {
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iframe-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.stream iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.stream .remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.stream .remove-btn:hover {
    background-color: rgba(255, 0, 0, 1);
}

.stream .spotlight-btn {
    position: absolute;
    top: 10px;
    right: 50px;
    background-color: rgba(255, 215, 0, 0.8);
    color: #333;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 14px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.stream .spotlight-btn:hover {
    background-color: rgba(255, 215, 0, 1);
}

.stream .remove-spotlight-btn {
    position: absolute;
    top: 10px;
    right: 50px;
    background-color: rgba(100, 149, 237, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 14px;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.stream .remove-spotlight-btn:hover {
    background-color: rgba(100, 149, 237, 1);
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.2rem;
    text-align: center;
}

/* Mobile responsive */
@media (max-width: 768px) {
    body {
        padding-top: 140px; /* More space for wrapped controls */
    }
    
    body.top-bar-collapsed {
        padding-top: 15px; /* Reduced padding when collapsed on mobile */
    }
    
    .top-bar-content {
        grid-template-columns: 1fr;
        gap: 10px;
        text-align: center;
    }
    
    .brand {
        text-align: center;
    }
    
    .brand h1 {
        font-size: 1.2rem;
    }
    
    .brand p {
        font-size: 0.7rem;
    }
    
    .controls-row {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .url-input {
        min-width: auto;
        max-width: none;
        flex: 1;
        min-width: 200px;
    }
    
    .button-group {
        justify-content: center;
    }
    
    .add-btn, .clear-btn, .mute-btn {
        flex: 1;
        max-width: 90px;
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    
    .save-checkbox {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    
    .save-checkbox input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
    
    /* Mobile toggle button adjustments */
    .toggle-btn {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 25px;
        font-size: 14px;
    }
    
    .top-bar.collapsed .toggle-btn {
        top: -2px;
        transform: translateY(148px); /* Adjust for mobile top bar height */
    }
    
    .streams-container.count-2,
    .streams-container.count-3,
    .streams-container.count-4,
    .streams-container.count-5,
    .streams-container.count-6,
    .streams-container.count-7,
    .streams-container.count-8,
    .streams-container.count-9 {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }
    
    .streams-container.count-3 .stream:first-child {
        grid-column: auto;
    }
    
    .streams-container.count-more {
        grid-template-columns: 1fr;
    }
    
    /* Mobile spotlight layout adjustments */
    .streams-container.has-spotlight {
        grid-template-rows: 1fr 0.5fr;
    }
    
    .streams-container.has-spotlight.others-2,
    .streams-container.has-spotlight.others-3,
    .streams-container.has-spotlight.others-4,
    .streams-container.has-spotlight.others-more {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    
    .streams-container.has-spotlight .stream:not(.spotlight) {
        height: 200px;
        margin-bottom: 10px;
    }
    
    .streams-container {
        height: auto;
    }
    
    .stream {
        height: 250px;
    }
}

/* Vitrine Container Styles */
.vitrine-container {
    padding: 20px;
    max-width: 95%;
    margin: 0 auto;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    position: relative;
    overflow: hidden;
}

.vitrine-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.vitrine-section {
    margin-bottom: 35px;
    position: relative;
}

.vitrine-section:last-child {
    margin-bottom: 0;
}

.vitrine-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px 0;
    border-bottom: 3px solid #333;
    position: relative;
}

.vitrine-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: currentColor;
    border-radius: 2px;
}

.platform-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.platform-emoji {
    font-size: 2.2rem;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.7));
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.platform-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.5px;
}

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

.carousel-nav {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    font-size: 18px;
    backdrop-filter: blur(10px);
    user-select: none;
}

.carousel-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.carousel-nav:active {
    transform: scale(0.95);
}

.carousel-nav.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.vitrine-carousel {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    padding: 5px 0;
}

.vitrine-streams {
    display: flex;
    gap: 20px;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.vitrine-stream {
    position: relative;
    background: linear-gradient(145deg, #2a2a2a, #1f1f1f);
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid #444;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    height: 280px;
    min-width: 400px;
    flex: 0 0 400px;
    cursor: pointer;
}

.vitrine-stream:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border-color: #777;
}

.vitrine-stream::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
    z-index: 1;
    pointer-events: none;
}

.vitrine-stream:hover::before {
    left: 100%;
}

.vitrine-stream-header {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7));
    color: white;
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.vitrine-stream iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 16px;
}

.vitrine-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.vitrine-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.vitrine-dot.active {
    background: #fff;
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.vitrine-dot::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid transparent;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.vitrine-dot.active::before {
    border-color: rgba(255, 255, 255, 0.3);
}

/* Platform-specific styling for single section */
.vitrine-section .vitrine-header {
    border-bottom-color: #ff6600;
}

.vitrine-section .platform-title {
    color: #ff9955;
}

/* Mobile responsive for vitrine */
@media (max-width: 768px) {
    .vitrine-container {
        padding: 15px;
        margin: 10px;
        max-width: 98%;
    }
    
    .vitrine-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px 0;
        margin-bottom: 15px;
    }
    
    .platform-info {
        align-self: stretch;
    }
    
    .carousel-controls {
        align-self: center;
    }
    
    .carousel-nav {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .vitrine-stream {
        height: 220px;
        min-width: 350px;
        flex: 0 0 350px;
    }
    
    .platform-emoji {
        font-size: 1.8rem;
    }
    
    .platform-title {
        font-size: 1.4rem;
    }
    
    .vitrine-dots {
        margin-top: 15px;
    }
    
    .vitrine-dot {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .vitrine-container {
        padding: 12px;
        margin: 5px;
        border-radius: 12px;
        max-width: 99%;
    }
    
    .vitrine-stream {
        height: 200px;
        min-width: 300px;
        flex: 0 0 300px;
    }
    
    .platform-emoji {
        font-size: 1.5rem;
    }
    
    .platform-title {
        font-size: 1.2rem;
    }
    
    .vitrine-section {
        margin-bottom: 25px;
    }
    
    .carousel-nav {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .vitrine-dot {
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 160px; /* Even more space for smaller screens */
    }
    
    .top-bar-content {
        padding: 10px 15px;
    }
    
    .brand {
        margin-bottom: 10px;
    }
    
    .brand h1 {
        font-size: 1.3rem;
    }
    
    .controls-row {
        gap: 10px;
    }
    
    .add-btn, .clear-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}