/* Dark theme for MultiYoutube */

body {
    background: #121212;
    color: #f1f1f1;
    margin: 2px;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: #2196F3;
    text-decoration: none;
}

a:hover {
    color: #64B5F6;
    text-decoration: underline;
}

#credits {
    margin-top: 20px;
    color: #888;
}

#wrapper {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

#streams {
    text-align: center;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    display: block;
    font-size: 0;
    width: 100%;
    transition: padding 0.2s ease;
}

#streams.resizing .stream-wrapper {
    transition: none !important;
}

#streams.resizing {
    transition: none !important;
}

.stream-wrapper {
    position: relative;
    display: inline-block;
    margin: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.3s ease, width 0.2s ease, height 0.2s ease;
    box-sizing: border-box;
}

.stream-wrapper.dragging {
    opacity: 0.5;
    z-index: 1000;
    cursor: grabbing;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.5);
}

.stream-wrapper.drag-over {
    border: 2px dashed #2196F3;
    background-color: rgba(33, 150, 243, 0.1);
}

.stream-wrapper.move-mode {
    border: 2px solid #2196F3;
    z-index: 100;
}

.stream-wrapper::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    pointer-events: none;
}

.hover-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background-color: transparent;
    pointer-events: auto;
    width: 100%;
    height: 100%;
}

.stream-wrapper:hover {
    transform: scale(1.01);
    z-index: 10;
}

.stream-wrapper:hover .channel-overlay {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate(-50%, 0) !important;
    pointer-events: none;
}

.stream-wrapper:hover .stream-controls {
    opacity: 1;
}

.stream-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 30;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stream {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    pointer-events: auto;
}

.viewer-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.viewer-overlay i {
    font-size: 14px;
    color: #2196F3;
}

.channel-overlay {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translate(-50%, 20px);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 100;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
    pointer-events: none;
}

.channel-overlay.always-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.total-viewers-overlay {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 15px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.total-viewers-overlay i {
    color: #2196F3;
    font-size: 18px;
}

#total-viewers-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 10px 0;
    position: relative;
}

#total-viewers-count {
    color: #64B5F6;
}

/* Estilos para o menu superior */
.top-menu {
    background: rgba(18, 18, 18, 0.95);
    border-bottom: 1px solid #333;
    z-index: 1000;
}

#stream-url {
    background: #2c2c2c;
    color: #fff;
    border: 1px solid #444;
}

#stream-url:focus {
    border-color: #2196F3;
    outline: none;
}

.menu-button {
    background: #2196F3;
    color: white;
}

.menu-button:hover {
    background: #1976D2;
}

.settings-button {
    background: #333;
    color: white;
}

.settings-button:hover {
    background: #444;
}

/* Estilos para os modais */
.modal-content {
    background: #1e1e1e;
    border: 1px solid #333;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    border-bottom: 1px solid #444;
}

.modal-footer {
    border-top: 1px solid #444;
}

.close-modal {
    color: #aaa;
}

.close-modal:hover {
    color: #2196F3;
}

/* Estilos para os controles de stream */
.stream-control-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.stream-control-btn:hover {
    background: rgba(33, 150, 243, 0.8);
}

/* Estilos para os botões de chat com diferentes estados */
.stream-control-btn.toggle-chat.chat-status-unknown {
    color: #aaa;
}

.stream-control-btn.toggle-chat.chat-status-checking {
    color: #FFC107;
}

.stream-control-btn.toggle-chat.chat-available {
    color: #4CAF50;
}

.stream-control-btn.toggle-chat.chat-unavailable {
    color: #F44336;
    cursor: not-allowed;
}

.stream-control-btn.toggle-chat.chat-unavailable:hover {
    background: rgba(0, 0, 0, 0.7);
}

.direction-controls {
    position: absolute;
    bottom: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    z-index: 150;
}

.direction-btn {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.direction-btn:hover {
    background: rgba(33, 150, 243, 0.9);
}

/* Estilos para os layouts salvos */
.saved-layouts {
    background: #1e1e1e;
    border: 1px solid #333;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    color: #fff;
    position: absolute;
    z-index: 2000;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    top: 100%;
    left: 0;
    right: auto;
}

#saved-layouts-dropdown {
    margin-top: 5px;
    padding: 10px;
}

.saved-layout-item {
    border-bottom: 1px solid #333;
    padding: 8px 10px;
}

.saved-layout-item:hover {
    background: #2c2c2c;
}

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

.layout-action-btn {
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.layout-action-btn:hover {
    background: #444;
}

.layout-action-btn.export {
    background: #1976D2;
}

.layout-action-btn.export:hover {
    background: #1565C0;
}

.layout-action-btn.delete {
    background: #d32f2f;
}

.layout-action-btn.delete:hover {
    background: #b71c1c;
}

/* Opção para mostrar sempre o nome do canal */
.option-group {
    margin: 15px 0;
    padding: 15px;
    background: #252525;
    border-radius: 4px;
    border-left: 3px solid #2196F3;
}

.option-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.option-group input[type="checkbox"] {
    margin-right: 10px;
}

.option-group h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2196F3;
    font-size: 16px;
}

.update-interval-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.update-interval-container input {
    flex: 0 0 100px;
    padding: 8px 12px;
    background: #333;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
}

.interval-unit {
    color: #aaa;
}

.interval-display {
    background: #333;
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 10px;
    display: flex;
    align-items: center;
}

.interval-display span:first-child {
    margin-right: 10px;
    font-weight: bold;
    color: #aaa;
}

#current-interval {
    color: #64B5F6;
    font-family: monospace;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2196F3;
}

.settings-info {
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.4;
}

.api-link {
    display: inline-block;
    margin-top: 5px;
    color: #64B5F6;
    text-decoration: none;
    font-weight: bold;
}

.api-link:hover {
    text-decoration: underline;
}

.api-key-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

.api-key-container input {
    flex: 1;
    padding: 8px 12px;
    background: #333;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
}

.api-key-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.api-key-display-container {
    background: #333;
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.api-key-display-container span {
    margin-right: 10px;
    font-weight: bold;
    color: #aaa;
}

#api-key-display {
    font-family: monospace;
    color: #64B5F6;
}

.layout-name-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
}

.layout-name-container input {
    flex: 1;
    padding: 8px 12px;
    background: #333;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
}

.remove-key-btn {
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: bold;
}

.remove-key-btn:hover {
    background: #b71c1c;
}

.export-import-layout {
    background: #252525;
    padding: 10px;
    border-bottom: 1px solid #444;
}

.export-import-container {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.export-import-container .menu-button {
    font-size: 13px;
    padding: 6px 12px;
}

.layout-actions {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

/* Estilos para o sistema de abas colapsáveis */
.chat-tabs.expanded {
    opacity: 1;
    max-width: 100%;
    overflow-x: auto;
    padding-right: 10px;
}

.chat-tabs.collapsed {
    max-width: calc(100% - 20px);
    overflow: hidden;
}

.chat-tabs.collapsed .chat-tab:not(.active) {
    max-width: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

/* Estilos para o chat */
.chat-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-expand-btn {
    background: transparent;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.chat-expand-btn:hover {
    color: #2196F3;
}

.stream-wrapper.is-live .viewer-overlay {
    background-color: rgba(255, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stream-wrapper.is-live .viewer-overlay i {
    color: white;
}

.stream-wrapper.was-live .viewer-overlay {
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stream-wrapper.was-live .viewer-overlay i {
    color: #FF9800;
}

.stream-wrapper.player-error {
    background-color: rgba(0, 0, 0, 0.8);
}

.stream-wrapper.player-error .channel-overlay {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    font-weight: bold;
}

/* Estilos para o chat no tema escuro */
.chat-modal {
    background-color: rgba(18, 18, 18, 0.95);
    box-shadow: -2px 0 15px rgba(0, 0, 0, 0.7);
}

.chat-header {
    background: rgba(18, 18, 18, 0.95);
    border-bottom: 1px solid #333;
    position: relative;
    z-index: 20;
}

.chat-tabs-container {
    background: rgba(18, 18, 18, 0.9);
    border-bottom: 1px solid #333;
}

.chat-tabs {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    max-width: calc(100% - 20px);
    overflow-x: auto;
    background: transparent;
    padding-bottom: 5px;
}

.chat-tab {
    background: rgba(33, 150, 243, 0.2);
    border: 1px solid transparent;
    color: #e0e0e0;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.3s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.chat-tab:hover {
    background: rgba(33, 150, 243, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

.chat-tab.active {
    background: rgba(33, 150, 243, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
    font-weight: bold;
}

.chat-content {
    background: #121212;
}

body.chat-open #wrapper {
    margin-right: 450px;
    transition: margin-right 0.3s ease;
}

/* Estilos para o sistema de abas colapsáveis no tema escuro */
.chat-tabs.expanded {
    opacity: 1;
    max-width: 100%;
    overflow-x: auto;
    padding-right: 10px;
}

.chat-tabs.expanded .chat-tab {
    max-width: 150px;
}

.chat-tabs.collapsed .chat-tab:not(.active) {
    max-width: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.chat-tabs.collapsed .chat-tab.active {
    max-width: 100%;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

/* Ajustes para responsividade em telas menores */
@media (max-width: 768px) {
    .chat-modal {
        width: 320px;
    }
    
    body.chat-open #wrapper {
        margin-right: 320px;
    }
}

@media (max-width: 480px) {
    .chat-modal {
        width: 100%;
    }
    
    body.chat-open #wrapper {
        margin-right: 0;
        width: 100%;
        display: none;
    }
}

/* Estilos para o modo de visualização focada no tema escuro */
.stream-wrapper.focused {
    z-index: 20;
    transform: none !important;
    transition: all 0.3s ease;
    box-shadow: 0 0 25px rgba(33, 150, 243, 0.7);
    border: 2px solid #2196F3;
    background-color: rgba(0, 0, 0, 0.3);
}

.stream-wrapper.unfocused {
    opacity: 0.7;
    transform: none !important;
    transition: all 0.3s ease;
    filter: brightness(0.8);
}

.stream-wrapper.unfocused:hover {
    opacity: 0.9;
    filter: brightness(0.9);
    z-index: 15;
}

#unfocused-container {
    display: grid;
    gap: 8px;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 4px;
}

/* Ajusta o botão de foco quando está ativo */
.stream-wrapper.focused .focus-stream {
    background: rgba(33, 150, 243, 0.8);
    color: white;
}