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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --border-color: #ddd;
    --accent: #007bff;
    --error: #dc3545;
    --success: #28a745;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #444;
    --accent: #4a9eff;
    --error: #ff6b6b;
    --success: #51cf66;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.3s, color 0.3s;
}

.header {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.header nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header a {
    color: var(--text-primary);
    text-decoration: none;
}

.footer {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

@media (max-width: 768px) {
    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.5rem;
        padding: 0.5rem;
    }
}

.video-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.video-card img {
    width: 100%;
    height: auto;
}

.video-card h3 {
    padding: 0.5rem;
}

.error {
    color: var(--error);
    padding: 0.5rem;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 4px;
}

.error-boundary {
    padding: 2rem;
    text-align: center;
}

.error-boundary h2 {
    color: var(--error);
    margin-bottom: 1rem;
}

.error-boundary button {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.skeleton-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.skeleton-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-color) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.skeleton-title {
    height: 20px;
    width: 80%;
    margin: 0.5rem;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-color) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 16px;
    width: 60%;
    margin: 0.5rem;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-color) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 2rem auto;
}

input, textarea, button {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

button {
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

button:hover:not(:disabled) {
    opacity: 0.9;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
}

.video-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.video-player-wrapper {
    width: 100%;
    margin-bottom: 1rem;
}

.video-info {
    padding: 1rem;
}

.video-title {
    margin-bottom: 0.5rem;
}

.video-meta {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.video-description {
    margin-bottom: 1rem;
}

.streaming-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

.streaming-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1rem;
}

.stream-video {
    width: 100%;
    height: auto;
    background: #000;
}

.live-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: #dc3545;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    z-index: 10;
}

.offline-message {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.stream-info {
    padding: 1rem 0;
}

.stream-stats {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.chat-container {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    height: fit-content;
    max-height: 80vh;
    overflow-y: auto;
}

.nav-links {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.logo {
    font-weight: bold;
    font-size: 1.2rem;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification {
    background: var(--accent);
    color: white;
    padding: 1rem;
    border-radius: 4px;
    min-width: 300px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .video-container {
        padding: 0.5rem;
    }
    
    .video-player-wrapper {
        position: relative;
        padding-bottom: 56.25%;
        height: 0;
    }
    
    .video-player-wrapper video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
    
    .streaming-container {
        grid-template-columns: 1fr;
    }
    
    .chat-container {
        max-height: 400px;
    }
    
    .header nav {
        flex-wrap: wrap;
    }
    
    .nav-links {
        flex-direction: column;
        width: 100%;
    }
}

