:root {
    --primary-color: #e50914;
    --primary-dark: #b20710;
    --text-color: #333;
    --text-light: #777;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --border-color: #ddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --input-bg: #fff;
    --error-color: #dc3545;
}

/* Tema oscuro */
body.theme-dark {
    --text-color: #f0f0f0;
    --text-light: #aaa;
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --border-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --input-bg: #2d2d2d;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

/* Header estilo Netflix */
header {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 70px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.main-nav {
    display: flex;
    gap: 20px;
}

.main-nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-weight: 500;
}

.main-nav a:hover,
.main-nav a.active {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Menú de usuario con foto */
.user-menu {
    position: relative;
}

.user-avatar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    color: white;
}

.user-avatar-container:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-avatar-nav {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    border: 2px solid white;
}

.user-avatar-nav.placeholder {
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8em;
}

.username-nav {
    font-weight: 500;
    color: white;
}

.dropdown-arrow {
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.user-avatar-container:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Menú desplegable */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.3s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.9em;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 4px 0;
}

.logout-item {
    color: #e74c3c;
}

/* Botones de autenticación */
.auth-buttons {
    display: flex;
    gap: 10px;
}

.btn-login, .btn-register {
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-login {
    background: transparent;
    color: white;
    border: 1px solid white;
}

.btn-login:hover {
    background: white;
    color: #000;
}

.btn-register {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.btn-register:hover {
    background: #b80707;
    border-color: #b80707;
}

/* Botones de admin */
.btn-admin, .btn-add {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.btn-admin:hover, .btn-add:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-logout {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Botones de navegación mejorados */
.btn-profile, .btn-favorites {
    background: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-profile:hover, .btn-favorites:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    color: white;
}

/* Estilos para autenticación */
.auth-container {
    max-width: 500px;
    margin: 3rem auto;
    padding: 2rem;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.auth-container h2 {
    margin-top: 0;
    text-align: center;
    color: var(--primary-color);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: bold;
}

.form-group input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.2);
}

.auth-links {
    margin-top: 1rem;
    text-align: center;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.btn-login, .btn-register, .btn-logout {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-login {
    background-color: #6c757d;
    color: white;
}

.btn-login:hover {
    background-color: #5a6268;
}

.btn-register {
    background-color: #28a745;
    color: white;
}

.btn-register:hover {
    background-color: #218838;
}

.btn-logout {
    background-color: #dc3545;
    color: white;
}

.btn-logout:hover {
    background-color: #c82333;
}

/* Alertas */
.alert {
    padding: 0.75rem 1.25rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Dropdown de usuario */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.btn-user {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-user:hover {
    background-color: var(--primary-dark);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--card-bg);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px var(--shadow-color);
    z-index: 1;
    border-radius: 4px;
    overflow: hidden;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block;
    transition: background-color 0.3s;
}

.dropdown-content a:hover {
    background-color: var(--primary-color);
    color: white;
}

.user-dropdown:hover .dropdown-content {
    display: block;
}

/* Mensajes flash */
.flash-messages {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flash-message {
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 10px var(--shadow-color);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.flash-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.flash-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

main {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-top: 0;
}

/* Carrusel */
.carousel {
    margin: 2rem 0;
}

.carousel h3 {
    margin-bottom: 1rem;
}

.carousel-container {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding: 1rem 0;
    scrollbar-width: none; /* Firefox */
}

.carousel-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.carousel-item {
    flex: 0 0 auto;
    width: 200px;
    transition: transform 0.3s;
}

.carousel-item:hover {
    transform: scale(1.05);
}

.carousel-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.carousel-item .no-image {
    width: 100%;
    height: 300px;
    background-color: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    box-shadow: 0 2px 5px var(--shadow-color);
    color: var(--text-light);
}

.carousel-item .info {
    padding: 0.5rem;
}

.carousel-item .info h4 {
    margin: 0.5rem 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.carousel-item .info p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Filtros */
.filtros {
    margin: 2rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.filtro-tipo, .filtro-genero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.filtros h3 {
    margin: 0 1rem 0 0;
    font-size: 1rem;
}

.filtros a {
    padding: 0.5rem 1rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.filtros a:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filtros a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Grid de items */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.item-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px var(--shadow-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.item-card img {
    width: 100%;
    height: 350px;
    object-fit: cover;
}

.item-card .no-image {
    width: 100%;
    height: 350px;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777;
}

.item-card-content {
    padding: 1.5rem;
}

.item-card-content h3 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
}

.item-card-content p {
    margin: 0.3rem 0;
    font-size: 0.9rem;
    color: var(--text-light);
}

.actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: var(--primary-dark);
}

.btn.secondary {
    background-color: #6c757d;
}

.btn.secondary:hover {
    background-color: #5a6268;
}

.btn.danger {
    background-color: #dc3545;
}

.btn.danger:hover {
    background-color: #c82333;
}

/* Botones de favoritos */
.btn-favorite {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-favorite:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.btn-favorite.active {
    background: var(--primary-color);
    color: white;
}

.favorite-form {
    display: inline;
}

.admin-only {
    display: none;
}

.is-admin .admin-only {
    display: inline-block;
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a {
    padding: 0.5rem 1rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.pagination a:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Vista detalle */
.item-detail {
    display: flex;
    gap: 3rem;
    margin: 2rem 0;
}

.detail-image {
    flex: 0 0 300px;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.no-image.detail-image {
    width: 300px;
    height: 450px;
    background-color: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.detail-info {
    flex: 1;
}

.detail-info h2 {
    margin-top: 0;
    color: var(--primary-color);
}

.meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
}

.detail-resumen {
    margin: 2rem 0;
}

.detail-resumen h3 {
    margin-bottom: 0.5rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}

.btn-large {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
}

.btn-play {
    background-color: #28a745;
}

.btn-play:hover {
    background-color: #218838;
}

/* NEW: Detail actions styles */
.detail-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* NEW: Item actions styles */
.item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* NEW: Delete form styles */
.delete-form {
    display: inline-block;
    margin-left: 0.5rem;
}

.delete-form button {
    margin: 0;
    padding: 0.5rem 1rem;
}

/* Formularios de administración */
.admin-form-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1.5rem;
}

.form-row .form-group {
    flex: 1;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.2);
}

/* NEW: Form actions styles */
.form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1.5rem;
}

.current-image {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.current-image img {
    max-width: 200px;
    max-height: 300px;
    object-fit: contain;
    border-radius: 4px;
}

.image-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-change-image {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    flex: 1;
    border: none;
    font-family: inherit;
    font-size: inherit;
}

.btn-remove-image {
    padding: 0.5rem 1rem;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
    font-family: inherit;
    font-size: inherit;
}

.btn-change-image:hover {
    background-color: var(--primary-dark);
}

.btn-remove-image:hover {
    background-color: #c82333;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: inherit;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: inherit;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: inherit;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Login de administrador */
.admin-login-container {
    max-width: 400px;
    margin: 5rem auto;
    padding: 2rem;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.admin-login-container h2 {
    margin-top: 0;
    text-align: center;
    color: var(--primary-color);
}

.admin-login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.alert {
    padding: 0.75rem 1.25rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-group label {
    margin: 0;
    font-weight: normal;
}

.form-text {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Estilos para validación */
.is-invalid {
    border-color: var(--error-color) !important;
}

.invalid-feedback {
    color: var(--error-color);
    font-size: 0.8rem;
    display: none;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

/* NEW: Small button styles */
.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* NEW: Admin actions container */
.admin-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Estilos adicionales para el reproductor mejorado */
.buffer-info {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-top: 1px solid #333;
}

.buffer-stats p {
    margin: 0.2rem 0;
    font-size: 0.8rem;
}

.troubleshooting-section .card {
    border-left: 4px solid #f39c12;
}

.troubleshooting-section ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.troubleshooting-section li {
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.video-overlay {
    z-index: 10;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }
    
    .header-left {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .main-nav {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .header-right {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    
    .username-nav {
        display: none;
    }
    
    .item-detail {
        flex-direction: column;
    }
    
    .detail-image {
        flex: 0 0 auto;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    /* NEW: Responsive form actions */
    .form-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* NEW: Responsive detail actions */
    .detail-actions {
        flex-direction: column;
    }
    
    /* NEW: Responsive delete form */
    .delete-form {
        margin-left: 0;
        margin-top: 0.5rem;
    }
    
    .nav-right {
        flex-direction: column;
        align-items: flex-end;
    }
    
    .user-dropdown {
        width: 100%;
    }
    
    .dropdown-content {
        width: 100%;
    }
    
    /* Mejoras responsive para el reproductor */
    .video-player video {
        max-height: 50vh;
    }
    
    .buffer-info {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .nav-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .items-grid {
        grid-template-columns: 1fr;
    }
    
    .filtros {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filtro-tipo, .filtro-genero {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filtros h3 {
        margin-bottom: 0.5rem;
    }
    
    .auth-container {
        margin: 1rem;
        padding: 1.5rem;
    }
}