/* Custom Styles for Academia Futuro */

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.lesson-checkbox:checked {
    background-color: #14B8A6;
    border-color: #0F766E;
}

#login-view.active {
    display: flex;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

/* Hover effects */
.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.lesson-item:hover {
    background-color: rgba(55, 65, 81, 0.8);
}

/* Progress bar animation */
.progress-bar {
    transition: width 0.3s ease-in-out;
}

/* Loading states */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #14B8A6;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #374151;
}

::-webkit-scrollbar-thumb {
    background: #14B8A6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0F766E;
}

/* Video Player Enhancement */
.video-container {
    position: relative;
    width: 100%;
    max-width: none;
    margin: 0 auto;
}

.video-container iframe {
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.3s ease;
}

.video-container:hover iframe {
    box-shadow: 0 35px 60px -12px rgba(0, 0, 0, 0.7);
}

/* Better video responsive behavior */
@media (min-width: 1280px) {
    .video-container {
        padding-bottom: 50% !important; /* Más grande en pantallas grandes */
    }
}

@media (max-width: 768px) {
    .video-container {
        padding-bottom: 65% !important; /* Más alto en móviles para mejor vista */
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .lg\:flex-row {
        flex-direction: column;
    }
}

/* Focus states for accessibility */
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid #14B8A6;
    outline-offset: 2px;
}

/* Error and success message styles */
.message-fade {
    transition: opacity 0.3s ease-in-out;
}

.message-fade.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Instructor Avatar Styles */
.instructor-avatar,
.instructor-profile-image {
    border: 2px solid #14B8A6;
    box-shadow: 0 4px 8px rgba(20, 184, 166, 0.2);
    transition: all 0.3s ease;
}

.instructor-avatar:hover,
.instructor-profile-image:hover {
    border-color: #0F766E;
    box-shadow: 0 6px 12px rgba(20, 184, 166, 0.3);
    transform: scale(1.05);
}

/* Fallback instructor initials styling */
.instructor-profile-image + div,
.instructor-avatar + div {
    border: 2px solid #14B8A6;
    box-shadow: 0 4px 8px rgba(20, 184, 166, 0.2);
    transition: all 0.3s ease;
}

.instructor-profile-image + div:hover,
.instructor-avatar + div:hover {
    border-color: #0F766E;
    box-shadow: 0 6px 12px rgba(20, 184, 166, 0.3);
    transform: scale(1.05);
}

/* Course Image Optimization */
.course-image {
    object-fit: cover;
    object-position: center center;
    width: 100%;
    height: 100%;
    min-height: 192px; /* h-48 equivalent */
    max-height: 192px;
}

/* Ensure proper aspect ratio maintenance */
.course-image-placeholder,
.course-image {
    aspect-ratio: 16/9; /* Standard video aspect ratio */
}

/* Better image loading states */
.course-image[style*="opacity: 0"] {
    filter: blur(2px);
}

.course-image[style*="opacity: 1"] {
    filter: none;
    transition: opacity 0.5s ease, filter 0.3s ease;
}

/* Admin Panel User List Responsive */
@media (max-width: 640px) {
    .admin-user-list li {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .admin-user-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .admin-user-buttons button {
        width: 100%;
        text-align: center;
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

/* Ensure buttons don't overflow */
.admin-user-item {
    overflow: hidden;
}

.admin-user-info {
    overflow-wrap: break-word;
    word-break: break-all;
    min-width: 0;
}

/* Protecciones de video anti-descarga */
.protected-video {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
}

.video-container {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    position: relative;
    background: #1f2937;
    border-radius: 12px;
    overflow: hidden;
}

/* Deshabilitar selección de texto en área de video */
.video-container *,
.video-container *:before,
.video-container *:after {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Deshabilitar menú contextual específicamente en videos */
.video-container,
.protected-video,
.video-overlay {
    -webkit-context-menu: none;
    -moz-context-menu: none;
}

/* Protección contra print screen */
@media print {
    .video-container {
        display: none !important;
        visibility: hidden !important;
    }
    .protected-video {
        display: none !important;
        visibility: hidden !important;
    }
}

/* Ocultar durante capturas de pantalla en algunos navegadores */
.video-container {
    -webkit-appearance: none;
    appearance: none;
}

/* Protección adicional contra herramientas de desarrollador */
.video-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: -1;
    pointer-events: none;
}

/* Prevenir selección en navegadores móviles */
.video-container {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}

/* Deshabilitar drag and drop */
.protected-video,
.video-container {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
}

/* Protección contra inspección de elementos */
.video-protected {
    position: relative;
}

.video-protected::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
    z-index: 1000;
}
