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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent: #ff6b35;
    --accent-hover: #ff8555;
    --success: #00ff88;
    --error: #ff3366;
    --border: #333333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

/* Password Screen */
#passwordScreen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
}

.container {
    background: var(--bg-secondary);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
}

.container h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
}

.container p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

form input[type="password"],
form input[type="text"],
form input[type="email"] {
    width: 100%;
    padding: 0.875rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s;
}

form input:focus {
    outline: none;
    border-color: var(--accent);
}

button {
    width: 100%;
    padding: 0.875rem;
    background: var(--accent);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background: var(--accent-hover);
}

button:disabled {
    background: var(--border);
    cursor: not-allowed;
}

.small-btn {
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.error {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

/* Stream Screen */
#streamScreen {
    flex-direction: column;
}

.stream-container {
    display: flex;
    height: 100vh;
    gap: 0;
}

.video-section {
    flex: 1;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    position: relative;
}

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

.stream-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}

.stream-status.online {
    border: 2px solid var(--success);
}

.stream-status.offline {
    border: 2px solid var(--error);
}

.stream-status.online #statusText::before {
    content: "● ";
    color: var(--success);
}

.stream-status.offline #statusText::before {
    content: "● ";
    color: var(--error);
}

.viewer-count::before {
    content: "👁 ";
}

/* Chat Section */
.chat-section {
    width: 380px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    border-left: 2px solid var(--border);
}

.user-info {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border);
}

#userDisplay {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#username {
    font-weight: 600;
    color: var(--accent);
}

#registerForm {
    margin-top: 1rem;
}

#registerForm input {
    margin-bottom: 0.5rem;
}

#registerForm button {
    width: auto;
    display: inline-block;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.chat-message {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.message-username {
    font-weight: 600;
    color: var(--accent);
}

.message-time {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.message-text {
    color: var(--text-primary);
    word-wrap: break-word;
}

.system-message {
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    border-radius: 4px;
}

.chat-input-container {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-top: 2px solid var(--border);
}

#chatForm {
    display: flex;
    gap: 0.5rem;
}

#chatInput {
    flex: 1;
    margin-bottom: 0;
}

#chatForm button {
    width: auto;
    padding: 0.875rem 1.5rem;
}

/* Admin Panel */
.admin-panel {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 1000;
}

.admin-toggle {
    width: auto;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--accent);
}

.admin-controls {
    position: absolute;
    bottom: 3rem;
    left: 0;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 1rem;
    min-width: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.admin-controls h3 {
    margin-bottom: 1rem;
    color: var(--accent);
}

.admin-controls button {
    margin-bottom: 0.5rem;
}

#adminContent {
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.ban-item {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.ban-item strong {
    color: var(--accent);
}

.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .stream-container {
        flex-direction: column;
    }

    .chat-section {
        width: 100%;
        height: 50vh;
        border-left: none;
        border-top: 2px solid var(--border);
    }

    .video-section {
        height: 50vh;
    }
}

/* Loading State */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}