/**
 * ESCplus Live Multi-Window Control Panel V2.1
 * Simplified with Visual Layout Selector & On-Hover Stream Controls
 * 
 * @version 2.1.0
 * @since October 14, 2025
 */

/* ================================================================
   Control Panel - Compact Bottom Bar
   ================================================================ */

.escplus-control-panel-v2 {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    padding: 12px 20px;
}

.control-panel-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Control Panel Sections */
.control-panel-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.control-panel-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.control-panel-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

/* ================================================================
   Hidden Streams Indicator
   ================================================================ */

.hidden-streams-indicator {
    flex-shrink: 0;
    position: relative; /* For dropdown positioning */
}

.btn-show-hidden {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: rgba(255, 152, 0, 1);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-show-hidden:hover {
    background: rgba(255, 152, 0, 0.25);
    border-color: rgba(255, 152, 0, 0.5);
}

.btn-show-hidden svg {
    width: 16px;
    height: 16px;
}

.hidden-count {
    font-weight: 700;
}

/* Hidden Streams Dropdown */
.hidden-streams-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: rgba(20, 20, 20, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 8px;
    min-width: 280px;
    max-width: 350px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1002;
}

/* Show dropdown when .show class is added (for click functionality) */
.hidden-streams-dropdown.show {
    opacity: 1 !important;
    pointer-events: all !important;
    transform: translateY(0) !important;
}

/* Mobile-specific positioning for hidden streams indicator */
@media (max-width: 768px) {
    .hidden-streams-indicator.mobile-visible {
        position: fixed;
        bottom: 30px;
        left: 20px;
        z-index: 1001;
        margin: 0;
        transform: scale(1.1);
    }
    
    .hidden-streams-indicator.mobile-visible .hidden-streams-dropdown {
        position: absolute;
        bottom: 100%;
        left: 0;
        margin-bottom: 8px;
    }
}

.hidden-streams-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 152, 0, 0.2);
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 152, 0, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hidden-streams-list {
    padding: 4px;
    max-height: 400px;
    overflow-y: auto;
}

/* Custom scrollbar for dropdown */
.hidden-streams-list::-webkit-scrollbar {
    width: 6px;
}

.hidden-streams-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.hidden-streams-list::-webkit-scrollbar-thumb {
    background: rgba(255, 152, 0, 0.3);
    border-radius: 3px;
}

.hidden-streams-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 152, 0, 0.5);
}

/* Hidden Stream Item */
.hidden-stream-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.hidden-stream-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 152, 0, 0.3);
    transform: translateX(2px);
}

.hidden-stream-item:last-child {
    margin-bottom: 0;
}

.hidden-stream-flag {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

.hidden-stream-info {
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

.hidden-stream-title {
    font-size: 13px;
    font-weight: 500;
    color: white;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hidden-stream-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hidden-stream-action {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: rgba(255, 152, 0, 0.8);
    font-weight: 500;
}

.hidden-stream-action svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
}

.hidden-stream-item:hover .hidden-stream-action {
    color: rgba(255, 152, 0, 1);
}

/* Dropdown footer with Show All button */
.hidden-streams-dropdown-footer {
    padding: 8px;
    border-top: 1px solid rgba(255, 152, 0, 0.2);
}

.btn-show-all-hidden {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: rgba(255, 152, 0, 1);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-show-all-hidden:hover {
    background: rgba(255, 152, 0, 0.25);
    border-color: rgba(255, 152, 0, 0.5);
    transform: translateY(-1px);
}

.btn-show-all-hidden svg {
    flex-shrink: 0;
}

/* Empty state */
.hidden-streams-list-empty {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

/* Play/Pause Button Icon States */
#btn-sync-play .play-icon {
    display: none; /* Initially hide play icon since videos autoplay */
}

#btn-sync-play .pause-bar {
    display: block; /* Initially show pause bars since videos autoplay */
}

#btn-sync-play.playing .play-icon {
    display: none;
}

#btn-sync-play.playing .pause-bar {
    display: block;
}

#btn-sync-play.paused .play-icon {
    display: block;
}

#btn-sync-play.paused .pause-bar {
    display: none;
}

/* ================================================================
   Stream Controls Dropdown (Replaces Modal)
   ================================================================ */

.stream-controls-container {
    position: relative;
    flex-shrink: 0;
    height: 40px;
}

.stream-controls-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 150px;
    transform: translateX(-50%) translateY(8px);
    background: rgba(20, 20, 20, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    min-width: 300px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1002;
}

/* Show dropdown when .show class is added */
.stream-controls-dropdown.show {
    opacity: 1;
    pointer-events: all;
    transform: translateX(-50%) translateY(0);
}

.stream-controls-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(76, 175, 80, 0.2);
    font-size: 13px;
    font-weight: 600;
    color: rgba(76, 175, 80, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-close-stream-controls {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-close-stream-controls:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.btn-close-stream-controls svg {
    stroke-width: 2;
}

.stream-controls-list {
    padding: 8px;
    max-height: 500px;
    overflow-y: auto;
}

/* Custom scrollbar for dropdown */
.stream-controls-list::-webkit-scrollbar {
    width: 6px;
}

.stream-controls-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.stream-controls-list::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, 0.3);
    border-radius: 3px;
}

.stream-controls-list::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, 0.5);
}

/* Stream Control Item */
.stream-control-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.stream-control-item:last-child {
    margin-bottom: 0;
}

.stream-control-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(76, 175, 80, 0.2);
}

.stream-control-item.stream-hidden {
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.02);
}

.stream-control-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.stream-control-flag {
    width: 28px;
    height: 19px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

.stream-control-info {
    flex: 1;
    min-width: 0;
}

.stream-control-title {
    font-size: 13px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-control-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-control-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stream-control-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.stream-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.stream-control-btn svg {
    width: 12px;
    height: 12px;
    stroke-width: 2;
}

.stream-control-btn.active {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
    color: rgba(76, 175, 80, 1);
}

/* ================================================================
   Visual Layout Selector
   ================================================================ */

.layout-selector-visual {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-visual {
    width: 50px;
    height: 40px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.btn-visual svg {
    width: 100%;
    height: 100%;
    stroke: white; /* Changed to white for better visibility */
    stroke-width: 1.5;
    opacity: 0.6; /* Use opacity for dimming instead of color */
}

.btn-visual:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-visual:hover svg {
    opacity: 0.9; /* More visible on hover */
}

.btn-visual.active {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.6);
}

.btn-visual.active svg {
    stroke: rgba(76, 175, 80, 1); /* Green for active */
    opacity: 1;
    stroke-width: 2;
}

/* Tooltip */
.btn-visual::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.btn-visual:hover::after {
    opacity: 1;
}

/* ================================================================
   Responsive Design
   ================================================================ */

@media (max-width: 1024px) {
    .layout-selector-visual {
        gap: 6px;
    }
    
    .btn-visual {
        width: 42px;
        height: 34px;
    }
}

@media (max-width: 768px) {
    .control-panel-main {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .layout-selector-visual {
        order: 3;
        width: 100%;
        justify-content: flex-start;
    }
    
    .btn-visual {
        width: 38px;
        height: 30px;
    }
}

/* ================================================================
   Stream Controls Button (Opens Modal)
   ================================================================ */

.btn-open-controls {
    background: rgba(255, 152, 0, 0.15) !important;
    border-color: rgba(255, 152, 0, 0.3) !important;
}

.btn-open-controls:hover {
    background: rgba(255, 152, 0, 0.25) !important;
    border-color: rgba(255, 152, 0, 0.5) !important;
}

.btn-open-controls svg {
    stroke: rgba(255, 152, 0, 1) !important;
    fill: none !important;
    opacity: 1 !important;
    stroke-width: 2 !important;
}

.btn-open-controls:hover svg {
    stroke: rgba(255, 152, 0, 1) !important;
    opacity: 1 !important;
}

/* ================================================================
   @deprecated - Old Modal CSS (No Longer Used - Replaced with Dropdown)
   ================================================================ */

#master-volume-slider {
  border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    background-color: transparent;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    outline: none;
    padding: 0;
    cursor: pointer;
}

#master-volume-slider {background-color: transparent}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: rgba(76, 175, 80, 1);
}

.volume-value {
    font-size: 13px;
    font-weight: 600;
    color: white;
    min-width: 40px;
    text-align: right;
}

/* Global Volume Control */
.global-volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 1;
    pointer-events: all;
    transition: opacity 0.3s ease;
}

/* Mute All Button inside Volume Control */
.global-volume-control .btn-toggle-all-mute {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.9;
}

.global-volume-control .btn-toggle-all-mute:hover {
    transform: scale(1.15);
    opacity: 1;
}

.global-volume-control .btn-toggle-all-mute:active {
    transform: scale(0.95);
}

.global-volume-control .btn-toggle-all-mute svg {
    width: 18px;
    height: 18px;
}

/* Muted state - orange color */
.global-volume-control .btn-toggle-all-mute.muted svg {
    stroke: var(--escplus-accent, rgba(255, 152, 0, 1)) !important;
}

.global-volume-control .btn-toggle-all-mute.muted .volume-waves {
    display: none !important;
}

.global-volume-control .btn-toggle-all-mute.muted .mute-x {
    display: block !important;
}

/* Unmuted state - green color */
.global-volume-control .btn-toggle-all-mute:not(.muted) svg {
    stroke: rgba(76, 175, 80, 1) !important;
}

.global-volume-control .btn-toggle-all-mute:not(.muted) .volume-waves {
    display: block !important;
}

.global-volume-control .btn-toggle-all-mute:not(.muted) .mute-x {
    display: none !important;
}

.global-volume-slider {
    width: 120px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

/* Webkit/Chrome */
.global-volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    border: none;
}

.global-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
    margin-top: -5px; /* Center the thumb on the track */
    border: none;
}

.global-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Firefox */
.global-volume-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    border: none;
}

.global-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.global-volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.global-volume-value {
    color: white;
    font-size: 13px;
    font-weight: 600;
    min-width: 45px;
    text-align: right;
}

/* ================================================================
   @deprecated - Old Stream Controls Dropdown CSS (Duplicate - Removed)
   Use the "Stream Controls Dropdown (Replaces Modal)" section instead
   ================================================================ */

