/**
 * Content Protection Styles
 * Additional CSS-based protection for course content
 */

/* Disable text selection on protected content */
.course-content,
.lecture-content,
.video-container,
.pdf-viewer,
.course-material {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Preview content has less restrictive protection */
.preview-content {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Disable drag and drop on protected elements */
.course-content img,
.lecture-content img,
.video-container video,
.course-material * {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    
    pointer-events: auto;
}

/* Hide video controls that allow downloading */
video::-webkit-media-controls-download-button {
    display: none !important;
}

video::-webkit-media-controls-fullscreen-button {
    display: none !important;
}

/* Custom video controls styling */
.protected-video-container {
    position: relative;
    overflow: hidden;
}

.protected-video-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
    background: transparent;
}

/* Watermark overlay for videos */
.video-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.1);
    font-size: 2rem;
    font-weight: bold;
    pointer-events: none;
    z-index: 10;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
}

/* PDF protection styles */
.pdf-container {
    position: relative;
    overflow: hidden;
}

.pdf-container iframe {
    border: none;
    width: 100%;
    height: 600px;
}

/* Disable print styles for protected content */
@media print {
    .course-content,
    .lecture-content,
    .video-container,
    .pdf-viewer,
    .course-material {
        display: none !important;
    }
    
    .no-print {
        display: none !important;
    }
    
    body::after {
        content: "Printing of course content is not allowed. Please contact support for assistance.";
        display: block;
        text-align: center;
        font-size: 18px;
        margin: 50px;
        color: #333;
    }
}

/* Protection overlay for sensitive content */
.content-protection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 5;
    pointer-events: none;
}

/* Blur effect when dev tools are detected */
.dev-tools-detected .course-content,
.dev-tools-detected .lecture-content,
.dev-tools-detected .video-container {
    filter: blur(10px);
    transition: filter 0.3s ease;
}

/* Custom scrollbar to hide content inspection */
.protected-content::-webkit-scrollbar {
    width: 8px;
}

.protected-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.protected-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.protected-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Hide text cursor on protected text */
.no-select {
    cursor: default !important;
}

.no-select * {
    cursor: default !important;
}

/* Video loading protection */
.video-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 100;
}

.video-loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

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

/* Mobile protection enhancements */
@media (max-width: 768px) {
    .course-content,
    .lecture-content,
    .video-container {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Text lecture styling */
.text-content-viewer {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    margin: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.text-header {
    font-size: 1.5rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.text-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #343a40;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.text-content p {
    margin-bottom: 1rem;
}

.text-content h1, .text-content h2, .text-content h3, 
.text-content h4, .text-content h5, .text-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #212529;
}

.text-content ul, .text-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.text-content blockquote {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #6c757d;
}

/* High contrast mode protection */
@media (prefers-contrast: high) {
    .course-content::after {
        content: "Protected Content";
        position: absolute;
        top: 10px;
        right: 10px;
        background: #000;
        color: #fff;
        padding: 4px 8px;
        font-size: 10px;
        border-radius: 3px;
        opacity: 0.7;
    }
}

/* Screen reader protection (hide sensitive content from screen readers) */
.sr-protected {
    speak: none;
    -webkit-speak: none;
}

/* Disable image context menu specifically */
img.protected-image {
    pointer-events: none;
    -webkit-user-drag: none;
    -moz-user-drag: none;
    user-drag: none;
}

/* Custom alert styles for protection messages */
.protection-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    max-width: 350px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.protection-alert::before {
    content: '🔒';
    margin-right: 8px;
    font-size: 16px;
}
