/*------------------------------------*\
    #COURSE VIEW STYLES
\*------------------------------------*/

/**
 * Base styles for the course view container.
 */
#course-view {
    /* Base view styles will likely come from main.css */
    /* Add specific padding or layout if needed */
    padding: 0;
    /* Override default view padding if necessary */
    overflow-y: auto;
    /* Allow scrolling for content */
    height: 100%;
    position: relative;
}

/**
 * Back Button Styles
 */
.back-button {
    position: absolute;
    top: 30px;
    /* Adjust as needed */
    left: 30px;
    /* Adjust as needed */
    z-index: 5;
    /* Ensure it's above other content but below overlays if needed */
    background-color: rgba(0, 0, 0, 0.6);
    /* Semi-transparent background */
    color: #fff;
    border: 2px solid transparent;
    border-radius: 50%;
    /* Make it circular */
    width: 50px;
    /* Fixed size */
    height: 50px;
    /* Fixed size */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    /* Adjust icon size */
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}


.back-button:hover,
.back-button.focused,
.back-button:focus {
    background-color: rgba(0, 0, 0, 0.9);
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 10px var(--primary-color);
}

/**
 * Loading Styles
 */
.course-loading-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--background-color-dark);
    z-index: 10;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

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

.loading-text {
    font-size: 1.5rem;
    color: var(--text-color-light);
    margin: 0;
}

.error-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 80vh;
    width: 100%;
    text-align: center;
    padding: 20px;
}

.error-message h2 {
    color: var(--error-color, #ff4d4d);
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.error-message p {
    color: var(--text-color-medium);
    margin-bottom: 25px;
    font-size: 1.1rem;
    max-width: 80%;
}

.error-message .button {
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.error-message .button:hover,
.error-message .button:focus {
    background-color: var(--primary-color-dark, #c41230);
    outline: none;
}

.loading-indicator {
    /* Styles for loading state - similar to other views */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-color-light);
    font-size: 1.5rem;
}

/**
 * Hero Section (Course Carousel)
 */
.course-hero {
    position: relative;
    height: 60vh;
    /* Adjust height as needed */
    display: flex;
    align-items: flex-end;
    /* Align content to the bottom */
    padding: 40px 30px;
    /* Match general layout padding */
    box-sizing: border-box;
    color: #fff;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.hero-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Cover the area, might crop */
}

.hero-gradient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 20%, rgba(0, 0, 0, 0) 80%);
    /* Bottom fade */
}

.hero-content {
    max-width: 50%;
    /* Limit width of text content */
}

#course-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.course-metadata {
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--text-color-medium);
    /* Lighter text */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.course-metadata span {
    margin: 0 5px;
}

.course-metadata span:first-child {
    margin-left: 0;
}

.button-container {
    display: flex;
    gap: 15px;
    /* Space between buttons */
    margin-bottom: 20px;
}

/* General button styles (from components.css or here) */
.course-hero .button {
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    display: inline-flex;
    /* Align icon and text */
    align-items: center;
    gap: 8px;
    /* Space between icon and text */
    vertical-align: middle;
    /* Align button vertically if needed */
}

/* Style for image icons within buttons */
.button-icon {
    width: 2em;
    /* Size relative to button font size */
    height: 2em;
    display: inline-block;
    vertical-align: middle;
    /* Helps align with text */
    /* Add margin if needed, gap property on button should handle spacing */
}

/* Specific styles for Play and My List buttons */
#play-button,
#my-list-button {
    background-color: #fff;
    /* White background */
    color: #000;
    /* Black text */
    border-color: #fff;
    /* Match border to background */
}

/* Hover/Focus styles for Play and My List buttons */
#play-button:hover,
#my-list-button:hover {
    background-color: #e0e0e0;
    /* Light grey background on hover */
    border-color: #e0e0e0;
    color: #000;
    /* Keep text black */
    transform: scale(1.05);
    /* Keep scale effect */
    /* Override general focus outline if necessary */
    outline: none;
}

#play-button:focus,
#play-button.focused,
#my-list-button:focus,
#my-list-button.focused {
    background-color: #e0e0e0;
    /* Light grey background */
    border-color: var(--primary-color);
    color: #000;
    /* Keep text black */
    transform: scale(1.05);
    outline: none;
}

#course-progress-container {
    margin-top: 15px;
}

#course-progress-bar {
    width: 100%;
    height: 8px;
    /* Remove default appearance */
    -webkit-appearance: none;
    appearance: none;
    /* Style the track/background */
    background-color: #444;
    /* Dark grey background for the track */
    border-radius: 4px;
    overflow: hidden;
    /* Ensure value doesn't overflow */
}

/* Style the filled part (value) for WebKit browsers */
#course-progress-bar::-webkit-progress-value {
    background-color: #ED1C24;
    /* Red color */
    border-radius: 4px;
}

/* Style the track for WebKit browsers */
#course-progress-bar::-webkit-progress-bar {
    background-color: #444;
    border-radius: 4px;
}

/* Style the filled part (value) for Firefox */
#course-progress-bar::-moz-progress-bar {
    background-color: #ED1C24;
    /* Red color */
    border-radius: 4px;
}

#course-progress-text {
    font-size: 0.9rem;
    color: var(--text-color-medium);
    display: block;
    margin-top: 5px;
}

/**
 * Course Details Sections (Info, Teacher)
 */
.course-details,
.teacher-details {
    padding: 30px 30px;
    /* Match general layout padding */
    background-color: var(--background-color-dark);
    /* Or appropriate background */
    color: var(--text-color-light);
}

.course-details h2,
.teacher-details h2,
.recommendations h2 {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--text-color-highlight);
    /* Or primary color */
}

#course-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color-medium);
    max-width: 800px;
    /* Limit description width for readability */
}

.teacher-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: var(--background-color-medium);
    /* Slightly different bg */
    padding: 20px;
    border-radius: 8px;
    max-width: 800px;
}

.teacher-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

#teacher-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 5px 0;
}

#teacher-bio {
    font-size: 0.9rem;
    color: var(--text-color-medium);
    margin: 0;
}

/**
 * Recommendations Section
 */
.recommendations {
    padding: 30px 30px 60px 30px;
    /* More bottom padding */
    background-color: var(--background-color-dark);
}

/* Apply video-carousel styles */
.recommendations .video-carousel {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding: 15px;
    /* Add padding around the items */
    padding-left: 0;
    /* Remove extra left padding if section already has padding */
    margin-left: -15px;
    /* Counteract the item margin/padding if needed */
    /* Scrollbar hiding */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.recommendations .video-carousel::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

/* Apply video-item styles from homeView */
.recommendations .video-item {
    min-width: 220px;
    background-color: var(--dark-bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
    outline: none;
    /* Remove default outline for focus */
}

.recommendations .video-item:hover,
.recommendations .video-item.focused {
    transform: scale(1.05);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(var(--primary-color-rgb), 0.5);
}

.recommendations .video-thumbnail {
    position: relative;
    height: 140px;
    overflow: hidden;
}

.recommendations .video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recommendations .video-title {
    padding: 12px;
    font-size: 18px;
    color: var(--light-text);
    white-space: normal;
    overflow: visible;
    line-height: 1.4;
    font-weight: 800;
    min-height: 60px;
}

/* Remove old course-card styles if they conflict */
/*
.recommendations .course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
    gap: 20px;
}

.recommendations .course-card {
    background-color: var(--background-color-medium);
    border-radius: 4px;
    overflow: hidden;
}

.recommendations .course-card img {
    width: 100%;
    height: 120px; 
    object-fit: cover;
    display: block;
}

.recommendations .course-card h3 {
    font-size: 0.9rem;
    padding: 10px;
    margin: 0;
    text-align: center;
    color: var(--text-color-light);
}
*/

/**
 * Focus Styles (Ensure consistency)
 */
#course-view .focusable.focused {
    outline: 3px solid var(--focus-color);
    box-shadow: 0 0 10px var(--focus-color);
}

/* General View Styles */
.course-view-container {
    padding: 20px;
    /* Keep some padding, but remove left padding for sidebar */
    /* padding-left: 280px; /* Removed: No sidebar in this view */
    padding-top: 80px;
    /* Adjust if header overlaps */
    color: #fff;
}

/* Focus Styles */
.focusable:focus,
.focusable.focused,
[data-focusable]:focus,
[data-focusable].focused,
.focus-section:focus,
.focus-section.focused {
    outline: none;
    /* Keep border-radius for consistency if needed elsewhere */
    /* border-radius: 4px; */
}

/* Specific focus adjustments if needed */
.back-button:focus,
.back-button.focused {
    background-color: rgba(0, 0, 0, 0.9);
    border-color: var(--primary-color);
    /* Removed box-shadow: box-shadow: 0 0 10px var(--primary-color); */
}

.hero-section .button:focus,
.hero-section .button.focused {
    background-color: var(--accent-color-dark, #005c8a);
    transform: scale(1.05);
    border-color: var(--primary-color);
    /* Ensure border changes */
}

.course-details.focusable:focus,
.course-details.focusable.focused,
.teacher-details.focusable:focus,
.teacher-details.focusable.focused {
    background-color: rgba(255, 255, 255, 0.05);
    /* Subtle background on focus */
    /* No border or shadow needed for these sections */
}

.video-item:focus,
.video-item.focused {
    transform: scale(1.05);
    border-color: var(--primary-color);
    /* Keep border color change */
    /* Removed box-shadow: box-shadow: 0 0 15px rgba(var(--primary-color-rgb), 0.5); */
}

/* Course Information & Teacher Details Sections */
.course-details,
.teacher-details {
    background-color: rgba(0, 0, 0, 0.3);
    /* Semi-transparent background */
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    transition: background-color 0.2s ease, outline 0.2s ease;
    /* Smooth transition for focus */
}

.course-details h2,
.teacher-details h2 {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--text-color-highlight);
    /* Or primary color */
}

/* My List Button States */
#my-list-button.loading {
    opacity: 0.7;
    position: relative;
    overflow: hidden;
    pointer-events: none;
    /* Prevent clicks during loading */
}

#my-list-button.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

#my-list-button.success {
    background-color: #4CAF50;
    /* Green for success */
    border-color: #4CAF50;
    color: white;
    transition: background-color 0.3s ease;
}

#my-list-button.error {
    background-color: #F44336;
    /* Red for error */
    border-color: #F44336;
    color: white;
    transition: background-color 0.3s ease;
}

/* Course Content Section */
.course-content-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.course-content-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #ffffff;
}

/* Section Styling */
.course-section {
    margin-bottom: 1.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.section-header {
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.3);
}

.section-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #ffffff;
}

/* Lessons List */
.section-lessons {
    padding: 0.5rem 0;
}

.lesson-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lesson-item:last-child {
    border-bottom: none;
}

.lesson-item:hover, .lesson-item:focus {
    background-color: rgba(255, 255, 255, 0.1);
}

.lesson-icon {
    width: 24px;
    height: 24px;
    margin-right: 1rem;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.video-icon {
    background-image: url('../assets/images/video-icon.png');
}

.quiz-icon {
    background-image: url('../assets/images/quiz-icon.png');
}

.lesson-details {
    flex: 1;
}

.lesson-title {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: #ffffff;
}

.lesson-meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.lesson-type, .lesson-duration {
    margin-right: 1rem;
}

.lesson-completed-badge {
    color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.lesson-action {
    margin-left: 1rem;
}

.play-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-image: url('../assets/images/play-icon.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* Completed Lesson Styling */
.lesson-item.completed .lesson-title {
    color: rgba(255, 255, 255, 0.7);
}

.lesson-item.completed .lesson-icon::after {
    content: '✓';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: #4CAF50;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 16px;
    font-size: 0.7rem;
    position: relative;
    top: -8px;
    left: 8px;
}

/* Empty section message */
.empty-section-message {
    padding: 1rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    font-style: italic;
}

/* Focus styling for TV navigation */
.lesson-item:focus {
    outline: 2px solid white;
    box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.5);
}