* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

:root {
    --bg-dark: #000000;
    --accent-primary: #833ab4;
    --accent-secondary: #fd1d1d;
    --accent-tertiary: #fcb045;
    --text-main: #ffffff;
    --surface: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(0, 0, 0, 0.7);
}

html {
    overflow-x: hidden;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Desktop: Trava a tela para visualização em grade única */
@media (min-width: 769px) {
    body {
        height: 100vh;
        overflow: hidden;
    }
}

/* Mobile: Habilita rolagem para múltiplos vídeos */
@media (max-width: 768px) {
    body {
        height: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Base Grid */
.grid-main {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 768px) {
    .grid-main {
        height: auto;
        min-height: 100vh;
        padding-top: 80px;
        padding-bottom: 100px;
        /* Garante que o botão de config não cubra o vídeo */
        align-items: flex-start;
        /* Alinha no topo para permitir o crescimento do scroll */
    }
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    width: 100%;
    height: 100%;
    gap: 0;
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr;
        /* Força uma coluna única no mobile */
        height: auto;
    }
}

.video-item {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    cursor: pointer;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.98);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

@media (max-width: 768px) {
    .video-item {
        aspect-ratio: 16 / 9;
        /* Mantém a proporção correta no mobile */
        height: auto;
    }
}

.video-item iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border: 0;
}

/* Custom Borders */
.border-primary {
    border: 3px solid var(--accent-primary);
}

.border-secondary {
    border: 3px solid var(--accent-secondary);
}

.border-tertiary {
    border: 3px solid var(--accent-tertiary);
}

.border-gradient {
    border: 3px solid transparent;
    background-image: linear-gradient(var(--bg-dark), var(--bg-dark)),
        linear-gradient(45deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: transparent;
}

.status-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-indicator.visible {
    opacity: 1;
}

/* Version Badge */
.version-badge {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    color: #444;
    z-index: 1000;
    pointer-events: none;
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
    }
}

/* Floating Elements */
.floating-logo {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    animation: float 3s ease-in-out infinite;
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px var(--accent-secondary));
}

.logo-text {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 2px;
    background: linear-gradient(45deg, #fff, var(--accent-tertiary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.floating-control {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
}

.btn-settings {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.btn-settings:hover {
    background: var(--accent-primary);
    transform: scale(1.05);
}

/* Modal Implementation */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #111;
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.8rem;
    color: #888;
}

.input-group input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border-color);
    color: white;
    padding: 12px;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--accent-primary);
}

.modal-footer {
    margin-top: 25px;
    display: flex;
    gap: 10px;
}

.btn-save {
    flex: 1;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.btn-close {
    background: #333;
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-add-stream {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border-color);
    color: #888;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 20px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-add-stream:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: var(--accent-tertiary);
}

.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.btn-remove {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.2);
    color: #ff4444;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

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

#inputContainer {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

#inputContainer::-webkit-scrollbar {
    width: 4px;
}

#inputContainer::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}