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

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-link:hover, .nav-link.active {
    background-color: #34495e;
}

.nav-user {
    color: #ecf0f1;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

/* Footer */
.footer {
    background-color: #2c3e50;
    color: white;
    padding: 15px 0;
    text-align: center;
    margin-top: 30px;
}

.footer a {
    color: #3498db;
    text-decoration: none;
}

/* Formularios */
.form-container {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s;
    border: none;
}

.btn-live {
    background-color: #e74c3c;
    color: white;
}

.btn-live:hover {
    background-color: #c0392b;
}

.btn-stop {
    background-color: #95a5a6;
    color: white;
}

.btn-stop:hover {
    background-color: #7f8c8d;
}

.btn {
    background-color: #3498db;
    color: white;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #f39c12;
    color: white;
}
.btn-secondary:hover {
    background-color: #e67e22;
}

/* Mensajes */
.success {
    background-color: #e8f5e9;
    color: #27ae60;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #2ecc71;
}

.errors {
    background-color: #fce4e4;
    color: #e74c3c;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #c0392b;
}

/* Streams Grid */
.streams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stream-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dashboard-links, .auth-links {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.stream-info {
    background: #ecf0f1;
    padding: 15px;
    border-left: 5px solid #3498db;
    border-radius: 4px;
    margin-bottom: 20px;
}

.stream-key {
    background: #bdc3c7;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: monospace;
}

.stream-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stream-preview {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* WebRTC/Video */
.webrtc-container, .viewer-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.video-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 20px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

#localVideo, #remoteVideo {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16 / 9;
}

.controls, .viewer-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.status-message {
    text-align: center;
    padding: 10px;
    background: #f1c40f;
    color: #333;
    border-radius: 4px;
    margin-top: 10px;
    font-weight: bold;
}

/* Viewer Specific */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 8px;
}

.loading-overlay p {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

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

.offline-message-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 62, 80, 0.95);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 15;
    border-radius: 8px;
    text-align: center;
}

/* Broadcaster Viewer Stats */
.viewer-stats {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.viewers-list-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.viewer-item {
    background: #ecf0f1;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #bdc3c7;
}

.viewer-status {
    font-weight: bold;
}

.no-viewers {
    font-style: italic;
    color: #7f8c8d;
}

.debug-stats {
    margin-top: 20px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 0.9em;
}

.input-copy-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.input-copy-group input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    background: #f9f9f9;
}

.hint {
    font-size: 0.9em;
    color: #7f8c8d;
}

/* Dashboard */
.dashboard-sections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.section-streams, .section-recordings {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.streams-list, .recordings-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stream-item, .recording-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.stream-status {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: bold;
}

.stream-status.live {
    background: #e74c3c;
    color: white;
}

.stream-status.offline {
    background: #bdc3c7;
    color: #333;
}


/* Responsive */
@media (min-width: 768px) {
    .dashboard-sections {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .streams-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-links, .auth-links {
        flex-direction: column;
    }
    
    .input-copy-group {
        flex-direction: column;
    }
}