/* 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;
    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);
}

.navbar-brand {
    font-weight: 600;
    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;
}

/* 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;
}
