/* Enhanced JavaScript CSS - Additional styles for modern functionality */

/* Force all modals to be hidden by default */
.modal {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: -1 !important;
    overflow: hidden !important;
    outline: 0 !important;
    visibility: hidden !important;
}

/* Remove modal from document flow completely */
.modal:not(.show) {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

/* Only show modals when explicitly set to show */
.modal.show {
    display: block !important;
    z-index: 9999 !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Ensure modal content is visible and centered */
.modal.show .modal-dialog {
    opacity: 1 !important;
    transform: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 1rem !important;
}

.modal.show .modal-content {
    opacity: 1 !important;
    display: block !important;
    position: relative !important;
    background: white !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    max-width: 500px !important;
    width: 100% !important;
}

.modal-backdrop {
    z-index: 1050 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.modal-dialog {
    position: relative !important;
    width: auto !important;
    margin: 0.5rem !important;
    pointer-events: none !important;
    display: flex !important;
    align-items: center !important;
    min-height: calc(100% - 1rem) !important;
}

.modal-content {
    pointer-events: auto !important;
    background-color: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    color: #212529 !important;
    background-clip: padding-box !important;
    outline: 0 !important;
}

@media (min-width: 576px) {
    .modal-dialog {
        max-width: 500px !important;
        margin: 1.75rem auto !important;
    }
}

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out !important;
    transform: translate(0, -50px) !important;
}

.modal.show .modal-dialog {
    transform: none !important;
}

/* Override any conflicting styles */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

.modal-header {
    display: flex !important;
    flex-shrink: 0 !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 1rem 1rem !important;
    border-bottom: 1px solid #dee2e6 !important;
    border-top-left-radius: calc(0.375rem - 1px) !important;
    border-top-right-radius: calc(0.375rem - 1px) !important;
}

.modal-body {
    position: relative !important;
    flex: 1 1 auto !important;
    padding: 1rem !important;
}

.modal-footer {
    display: flex !important;
    flex-shrink: 0 !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    padding: 0.75rem !important;
    border-top: 1px solid #dee2e6 !important;
    border-bottom-right-radius: calc(0.375rem - 1px) !important;
    border-bottom-left-radius: calc(0.375rem - 1px) !important;
}

.modal-footer > * {
    margin: 0.25rem !important;
}

/* Ensure modal appears on top of everything */
.modal,
.modal-backdrop {
    position: fixed !important;
    z-index: 9999 !important;
}

/* Enhanced Form Styles */
.form-control.focused {
    border-color: var(--primary-color, #3a65ed) !important;
    box-shadow: 0 0 0 0.2rem rgba(58, 101, 237, 0.25) !important;
    outline: none;
}

.form-control.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Loading Button States */
.btn.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.btn.loading::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinLoader 0.8s linear infinite;
}

@keyframes spinLoader {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.notification.show {
    transform: translateX(0);
}

.notification i {
    margin-right: 8px;
}

.notification-success { 
    background: linear-gradient(135deg, #28a745, #20c997);
}

.notification-error { 
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.notification-warning { 
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #212529;
}

.notification-info { 
    background: linear-gradient(135deg, #17a2b8, #0dcaf0);
}

/* Enhanced Card Hover Effects */
.lms-card.hovered,
.course-card.hovered,
.dashboard-widget.hovered {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* Mobile Menu Enhancements */
.u-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: background 0.3s ease;
    z-index: 2001;
}

.u-menu-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.u-nav-container-collapse {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
}

.u-sidenav {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    padding: 20px;
    overflow-y: auto;
}

.u-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1999;
}

.u-nav-2 {
    padding-top: 80px;
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.u-nav-2 .u-nav-item {
    margin-bottom: 5px;
}

.u-nav-2 .u-nav-link {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    border-radius: 5px;
    margin-bottom: 5px;
}

.u-nav-2 .u-nav-link:hover {
    background: rgba(58, 101, 237, 0.2);
    color: #3a65ed;
    transform: translateX(5px);
}

.u-nav-2 .u-nav-link i {
    width: 20px;
    margin-right: 10px;
}

/* Progress Bar Animations */
.progress-bar-lms {
    transition: width 1s ease-in-out;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .notification {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: calc(100% - 20px);
    }
    
    .u-sidenav {
        width: 280px;
    }
    
    .form-lms {
        margin: 0 15px;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .u-sidenav {
        width: 100%;
        right: 0;
    }
    
    .u-text-1 {
        font-size: 1.75rem !important;
    }
    
    .u-text-2 {
        font-size: 1rem !important;
    }
}

/* Focus States for Accessibility */
.btn:focus,
.form-control:focus,
.u-nav-link:focus {
    outline: 2px solid #3a65ed;
    outline-offset: 2px;
}

/* Loading States for Different Elements */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3a65ed;
    border-radius: 50%;
    animation: spinLoader 1s linear infinite;
}

/* Enhanced Alert Styles */
.alert-lms {
    position: relative;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.alert-lms i {
    margin-right: 10px;
    font-size: 1.2em;
}

.alert-lms-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-lms-danger {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-lms-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-lms-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* Tooltip Styles */
.tooltip-popup {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
}

.tooltip-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Enhanced Course Cards */
.course-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.course-card .course-image {
    position: relative;
    overflow: hidden;
}

.course-card .course-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(58, 101, 237, 0.8), rgba(118, 75, 162, 0.8));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.course-card:hover .course-image::before {
    opacity: 1;
}

/* Enhanced Dashboard Widgets */
.dashboard-widget {
    position: relative;
    overflow: hidden;
}

.dashboard-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.dashboard-widget:hover::before {
    left: 100%;
}

/* Smooth Page Transitions */
.page-transition {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.page-transition.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Print Styles */
@media print {
    .u-header,
    .u-footer,
    .btn,
    .notification {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .lms-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
