/* AI Learning Portal Styles */
/* Feature: ai-learning-portal */

/* Base Styles */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-bg: #f8f9fa;
    --dark-text: #212529;
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
	padding-top: 56px; /* Height of navbar */
    background-color: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.6;
}

/* Accessibility - Focus Styles */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to main content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
	position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}
.navbar-nav .nav-link {
    font-weight: 600 !important; /* !important to override Bootstrap */
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

/* Main Container */
#app {
    min-height: calc(100vh - 56px);
    padding-bottom: 2rem;
}

.page-content {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    margin-bottom: 1.5rem;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.action-card {
    cursor: pointer;
    transition: all var(--transition-speed);
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.action-card i {
    transition: transform var(--transition-speed);
}

.action-card:hover i {
    transform: scale(1.1);
}

/* Chat Interface */
.chat-container {
    height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 1rem;
    background-color: white;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    max-width: 80%;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.user-message {
    background-color: #e3f2fd;
    margin-left: auto;
    text-align: right;
}

.ai-message {
    background-color: #f5f5f5;
    margin-right: auto;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.message-content {
    word-wrap: break-word;
}

/* Video Player */
#lessonVideo {
    border-radius: var(--border-radius);
    background-color: #000;
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all var(--transition-speed);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

/* Tables */
.table {
    background-color: white;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,0.02);
}

/* Progress Bars */
.progress {
    height: 1.5rem;
    border-radius: var(--border-radius);
    background-color: #e9ecef;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* Alerts */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Loading Spinner */
#loadingSpinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

/* Course Cards */
.course-card {
    transition: all var(--transition-speed);
    cursor: pointer;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.course-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* My Courses Specific Styles */
.action-card.border-primary {
    border-width: 2px !important;
    border-color: var(--primary-color) !important;
}

#courseListContainer {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.course-card .card-footer {
    padding: 0.5rem;
}

.course-card .btn-group .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* Badges */
.badge {
    padding: 0.5em 0.75em;
    border-radius: 4px;
    font-weight: 500;
}

/* Accessibility - High Contrast Mode Support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--dark-text);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Responsive Design - Tablet */
@media (max-width: 992px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .chat-container {
        height: 300px;
    }
    
    .course-thumbnail {
        height: 150px;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    .action-card i {
        font-size: 3rem !important;
    }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    #app {
        padding: 0;
    }
    
    .page-content {
        padding: 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .chat-container {
        height: 250px;
    }
    
    .chat-message {
        max-width: 90%;
        font-size: 0.9rem;
    }
    
    .course-thumbnail {
        height: 120px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
    }
    
    .action-card {
        margin-bottom: 1rem;
    }
    
    .action-card i {
        font-size: 2.5rem !important;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table thead th {
        font-size: 0.75rem;
    }
    
    /* Stack columns on mobile */
    .row > [class*='col-'] {
        margin-bottom: 1rem;
    }
    
    /* Make tables scrollable on mobile */
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Responsive Design - Small Mobile */
@media (max-width: 576px) {
    .navbar-brand i {
        display: none;
    }
    
    .chat-container {
        height: 200px;
    }
    
    .input-group .btn {
        padding: 0.375rem 0.75rem;
    }
    
    .card-header h4,
    .card-header h5 {
        font-size: 1rem;
    }
    
    /* Full width buttons on small screens */
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    #alertContainer,
    #loadingSpinner {
        display: none !important;
    }
    
    .page-content {
        display: block !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
        page-break-inside: avoid;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --light-bg: #1a1a1a;
        --dark-text: #e0e0e0;
    }
    
    body {
        background-color: var(--light-bg);
        color: var(--dark-text);
    }
    
    .card {
        background-color: #2a2a2a;
        color: var(--dark-text);
    }
    
    .table {
        background-color: #2a2a2a;
        color: var(--dark-text);
    }
    
    .form-control,
    .form-select {
        background-color: #2a2a2a;
        color: var(--dark-text);
        border-color: #444;
    }
    
    .chat-container {
        background-color: #2a2a2a;
        border-color: #444;
    }
    
    .user-message {
        background-color: #1e3a5f;
    }
    
    .ai-message {
        background-color: #333;
    }
}

/* Utility Classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.shadow-hover:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

/* Keyboard Navigation Indicators */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Screen Reader Only Content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
/* ========================================
   MINIMAL THREE-COLUMN LAYOUT CSS V2
   Only layout-specific styles, no colors/branding
   ======================================== */

/* Remove default Bootstrap row negative margins for full-width layout */
#lessonViewerPage .row {
    margin-left: 0;
    margin-right: 0;
}

/* Remove default Bootstrap column padding for seamless layout */
#lessonViewerPage .row > [class*='col-'] {
    padding-left: 0;
    padding-right: 0;
}

/* FIX #2: AI Tutor column - add top spacing and extend to bottom */
#lessonViewerPage .lesson-viewer-ai-tutor-column {
    height: calc(100vh - 56px) !important;
    overflow-y: auto;
    padding-top: 15px !important; /* Add space from top navbar */
    padding-bottom: 15px !important; /* Add space at bottom too */
}

/* Optimize AI Tutor display area */
#lessonViewerPage .lesson-viewer-ai-tutor-column .card-body {
    padding: 0.75rem;
    overflow-y: auto;
    height: 100%;
}

/* Override inline height on chat messages container */
#lessonViewerPage .lesson-viewer-ai-tutor-column .chat-messages-container {
    height: 500px !important;  /* Override inline style */
    max-height: calc(100vh - 250px) !important;  /* Prevent overflow */
}

/* Make AI Tutor messages use full width */
#lessonViewerPage .lesson-viewer-ai-tutor-column .chat-message {
    max-width: 100% !important;  /* Use full width instead of 80% */
}


/* Ensure AI Tutor card fills the column height - override Bootstrap h-100 */
#lessonViewerPage .lesson-viewer-ai-tutor-column .card.h-100 {
    height: calc(100% - 30px) !important; /* Override h-100, account for top+bottom padding */
    min-height: calc(100vh - 56px - 30px) !important; /* Account for top+bottom padding */
}

/* Responsive: Stack on mobile */
@media (max-width: 991px) {
    #lessonViewerPage .col-lg-2,
    #lessonViewerPage .col-lg-7,
    #lessonViewerPage .col-lg-3 {
        height: auto !important;
        max-height: none !important;
    }
    
    #lessonViewerPage .lesson-viewer-ai-tutor-column {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    
    #lessonViewerPage .lesson-viewer-ai-tutor-column .card {
        height: auto !important;
        min-height: auto !important;
    }
}

/* Optional: Smooth scrolling */
#lessonViewerPage [style*="overflow-y: auto"] {
    scroll-behavior: smooth;
}

/* AI Tutor Flashcard Styles - Scoped to AI Tutor page only */
#aiTutorPage .flashcard {
    perspective: 1000px;
    cursor: pointer;
    height: 200px;
    margin-bottom: 15px;
}

#aiTutorPage .flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

#aiTutorPage .flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

#aiTutorPage .flashcard-front,
#aiTutorPage .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#aiTutorPage .flashcard-front {
    background-color: #f8f9fa;
}

#aiTutorPage .flashcard-back {
    background-color: #e3f2fd;
    transform: rotateY(180deg);
}

#aiTutorPage .flashcard:hover .flashcard-inner {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* AI Tutor Content Display Styles */
.content-display {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   B2C SPECIFIC STYLES - EARNINGS CARD
   ======================================== */

/* Earnings Card Section */
.earnings-card {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.earnings-amount {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.earnings-label {
    opacity: 0.9;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.earnings-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.earnings-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.earnings-item-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.earnings-item-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Responsive adjustments for Earnings Card */
@media (max-width: 768px) {
    .earnings-card {
        padding: 1.5rem;
    }
    
    .earnings-amount {
        font-size: 2rem;
    }
    
    .earnings-breakdown {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .earnings-item-value {
        font-size: 1.25rem;
    }
}

/* ========================================
   B2C SPECIFIC STYLES - ENHANCED MY COURSES
   ======================================== */

/* Enhanced My Courses Section */
.courses-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #1f2937;
}

/* Course List Items */
.course-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.course-item:hover {
    border-color: #7c3aed;
    background: #f9fafb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
}

.course-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e0e7ff, #ddd6fe);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.course-thumbnail i {
    font-size: 2rem;
    color: #7c3aed;
}

.course-info {
    flex: 1;
}

.course-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
    color: #1f2937;
}

.course-meta {
    color: #64748b;
    font-size: 0.9rem;
}

.course-stats {
    display: flex;
    gap: 1.5rem;
    margin-right: 1rem;
}

.course-stat {
    text-align: center;
}

.course-stat-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1f2937;
}

.course-stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badge Styles */
.badge-status {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-published {
    background: #d1fae5;
    color: #065f46;
}

.badge-draft {
    background: #fef3c7;
    color: #92400e;
}

/* Buttons */
.btn-primary-purple {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary-purple:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.3);
    color: white;
}

.btn-outline-purple {
    border: 2px solid #7c3aed;
    color: #7c3aed;
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-purple:hover {
    background: #7c3aed;
    color: white;
}

/* Responsive adjustments for Enhanced My Courses */
@media (max-width: 768px) {
    .course-item {
        flex-direction: column;
        text-align: center;
    }
    
    .course-thumbnail {
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .course-stats {
        margin-right: 0;
        margin-top: 1rem;
        justify-content: center;
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn-primary-purple,
    .btn-outline-purple {
        width: 100%;
    }
}


/* Revenue Split Breakdown Styles */
.breakdown-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.breakdown-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.breakdown-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.breakdown-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.breakdown-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.25rem;
}

.breakdown-count {
    font-size: 0.8rem;
    color: #6c757d;
}

#revenue-breakdown-section {
    background: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

#revenue-breakdown-section h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Price Field Toggle */
#priceFieldContainer {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        overflow: hidden;
    }
    to {
        opacity: 1;
        max-height: 200px;
    }
}

/* Paid Course Checkbox */
#isPaidCourse {
    cursor: pointer;
}

#isPaidCourse + label {
    cursor: pointer;
    user-select: none;
}
