:root {
    --bg-main: #0f0f1a;
    --bg-header: rgba(20, 20, 35, 0.85);
    --bg-dark: #000;
    --bg-btn: rgba(255, 255, 255, 0.04);
    --bg-btn-hover: rgba(255, 255, 255, 0.1);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-header: rgba(255, 255, 255, 0.06);
    --bg-danger: rgba(244, 67, 54, 0.15);
    --bg-danger-hover: rgba(244, 67, 54, 0.25);
    --color-danger: #f44336;
    --bg-success: rgba(76, 175, 80, 0.15);
    --bg-success-hover: rgba(76, 175, 80, 0.25);
    --color-success: #4CAF50;
    --text-light: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-main);
    min-height: 100vh;
    color: var(--text-light);
}

/* Header */
.header {
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-header);
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.header-title svg {
    opacity: 0.9;
}

/* Grid de Vídeos */
.video-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    justify-content: flex-start;
}

.video-wrapper {
    display: flex;
    flex-direction: column;
}

.video-container {
    width: 180px;
    height: 320px;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.video-js {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Controles do Vídeo */
.video-controls {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.controls-group {
    display: flex;
    gap: 4px;
}

.ctrl-btn {
    width: 26px;
    height: 26px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.ctrl-btn svg {
    width: 14px;
    height: 14px;
}

.ctrl-btn.danger {
    color: rgba(244, 67, 54, 0.7);
}

.ctrl-btn.danger:hover {
    background: rgba(244, 67, 54, 0.2);
    color: var(--color-danger);
}

/* Botão Add Stream */
.add-stream {
    width: 30px;
    height: 30px;
    background-color: var(--bg-success);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.add-stream:hover {
    background-color: var(--bg-success-hover);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

.add-stream.initial {
    margin-top: 10px;
}

.add-stream.attached {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
}

/* Popover Input */
.input-container {
    display: none;
    position: fixed;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 10000;
}

.input-container.visible {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-container input {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 13px;
    min-width: 400px;
}

.input-container input::placeholder,
.add-stream-input input::placeholder {
    color: var(--text-muted);
}

.input-container input:focus,
.add-stream-input input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.input-container button {
    padding: 10px 16px;
    background: var(--bg-success);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: var(--color-success);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s ease;
}

.input-container button:hover {
    background: var(--bg-success-hover);
}

.input-container.video-id button {
    background: var(--bg-btn);
    border-color: var(--border-subtle);
    color: var(--text-muted);
    padding: 8px;
}

.input-container.video-id button:hover {
    background: var(--bg-btn-hover);
    color: #fff;
}

/* Controles Globais */
.global-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.controls-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 6px;
}

/* Campo Adicionar Stream */
.add-stream-input {
    display: none;
    align-items: center;
    gap: 6px;
}

.add-stream-input.visible {
    display: flex;
}

.add-stream-input.visible + .controls-divider {
    margin-left: 0;
}

#add-stream-btn.hidden {
    display: none;
}

.add-stream-input input {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-light);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 12px;
    width: 320px;
}

.add-stream-input .btn-ok {
    padding: 6px 12px;
    background: var(--bg-success);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: var(--color-success);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s ease;
}

.add-stream-input .btn-ok:hover {
    background: var(--bg-success-hover);
}

.add-stream-input .btn-close {
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--bg-danger);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: var(--color-danger);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.add-stream-input .btn-close:hover {
    background: var(--bg-danger-hover);
}

.add-stream-input .btn-close svg {
    width: 14px;
    height: 14px;
}

/* Botões Globais */
.global-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-btn);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.global-btn:hover {
    background: var(--bg-btn-hover);
    color: #fff;
    transform: translateY(-1px);
}

.global-btn svg {
    width: 16px;
    height: 16px;
}

.global-btn.success {
    background: var(--bg-success);
    border-color: rgba(76, 175, 80, 0.3);
    color: var(--color-success);
}

.global-btn.success:hover {
    background: var(--bg-success-hover);
}

.global-btn.danger {
    background: var(--bg-danger);
    border-color: rgba(244, 67, 54, 0.3);
    color: var(--color-danger);
}

.global-btn.danger:hover {
    background: var(--bg-danger-hover);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 2px;
    height: 2px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}