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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #222;
    --bg-card-hover: #333;
    --text-primary: #fff;
    --text-secondary: #aaa;
    --accent: #e50914;
    --accent-hover: #b20710;
    --font-main: 'Segoe UI', Arial, sans-serif;
    --transition: 0.3s ease;
    --border-radius: 8px;
    --border-color: #333;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* INTRO */
#intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#intro video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#intro.fade-out {
    opacity: 0;
    transition: opacity 1s ease;
}

/* AUTH */
.auth-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-logo {
    font-size: 64px;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.auth-box {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
}

.auth-box form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#auth-toggle {
    margin-top: 16px;
}

.error-text {
    color: var(--accent);
    font-size: 14px;
    margin-top: 12px;
    min-height: 20px;
    text-align: center;
}

.status-text {
    color: var(--text-secondary);
    font-size: 14px;
    min-height: 20px;
    text-align: center;
}

/* INPUTS */
.input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    outline: none;
    transition: border-color var(--transition);
    font-family: var(--font-main);
}

.input:focus, .input.focused {
    border-color: var(--accent);
}

.select {
    padding: 12px 16px;
    font-size: 16px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition);
    font-family: var(--font-main);
    appearance: auto;
    width: 100%;
}

.select:focus, .select.focused {
    border-color: var(--accent);
}

/* BUTTONS */
.btn {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-main);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn.focused, .btn:hover {
    transform: scale(1.03);
}

.btn-accent {
    background-color: var(--accent);
    color: white;
}

.btn-accent.focused, .btn-accent:hover {
    background-color: var(--accent-hover);
    border-color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.btn-outline.focused, .btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-sm {
    padding: 8px 18px;
    font-size: 14px;
}

/* HEADER */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--accent);
    flex-shrink: 0;
}

.header-logo {
    font-size: 28px;
    font-weight: bold;
    color: var(--accent);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* MAIN */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.main-content::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.main-content::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.connections-section {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

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

.section-header h2 {
    font-size: 22px;
    font-weight: 700;
}

.section-actions {
    display: flex;
    gap: 10px;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-size: 16px;
    padding: 40px 20px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
}

.connections-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.connection-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all var(--transition);
    flex-wrap: wrap;
    gap: 12px;
}

.connection-row.active {
    border-color: var(--accent);
    background: rgba(229, 9, 20, 0.08);
}

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

.connection-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.connection-type {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

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

/* MODALS */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-container {
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: var(--border-radius);
    padding: 30px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 4px 10px;
    transition: color var(--transition);
}

.modal-close:hover, .modal-close.focused {
    color: var(--accent);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

.modal-buttons .btn {
    min-width: 120px;
}

/* CATEGORIES */
.filter-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 60px;
}

.categories-list {
    max-height: 50vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 8px;
}

.categories-list::-webkit-scrollbar {
    width: 6px;
}

.categories-list::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.categories-list::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.category-group {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.category-item {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 4px;
    transition: background var(--transition);
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.category-item-name {
    color: var(--text-primary);
    font-weight: 600;
}

.category-item.playable {
    cursor: pointer;
}

.category-item.playable:hover {
    background: rgba(229, 9, 20, 0.15);
    border-left: 3px solid var(--accent);
    padding-left: 14px;
}

.play-icon {
    color: var(--accent);
    font-size: 12px;
    margin-left: 6px;
}

/* PLAYER */
#video-player {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#player-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

#player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    z-index: 9001;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    flex-wrap: wrap;
    gap: 10px;
}

.player-btn {
    padding: 10px 22px;
    font-size: 16px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-main);
}

.player-btn:hover, .player-btn:focus {
    background: var(--accent);
    border-color: #fff;
}

.player-info {
    font-size: 16px;
    color: var(--text-primary);
    text-align: center;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* RESPONSIVE */
@media (max-width: 600px) {
    .auth-logo {
        font-size: 48px;
    }

    .header-logo {
        font-size: 22px;
    }

    .header {
        padding: 12px 16px;
    }

    .main-content {
        padding: 16px;
    }

    .connection-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .connection-actions {
        width: 100%;
    }

    .connection-actions .btn {
        flex: 1;
    }

    .modal-container {
        padding: 20px;
    }

    #player-controls {
        padding: 14px 16px;
    }

    .player-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
}

@media (min-width: 1920px) {
    .auth-logo {
        font-size: 80px;
    }

    .auth-container {
        padding: 40px;
    }

    .connections-section {
        max-width: 1000px;
    }
}
