/* ===================================
   MODERN COLOR SCHEME & DESIGN SYSTEM
   =================================== */

:root {
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #3b82f6;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: #0891b2;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
    --border-radius-lg: 12px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, 
        #3b4d7a 0%,     /* Dark blue-purple like your reference */
        #5a6fa8 20%,    /* Medium blue */
        #7b94d1 40%,    /* Lighter blue */
        #a4b8e0 60%,    /* Light blue-gray */
        #c9d6ed 80%,    /* Very light blue */
        #e8eff8 100%    /* Almost white at bottom */
    );
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden; /* Prevent horizontal scrolling */
    position: relative;
}

/* Prevent layout shifts when modals open */
body.modal-open {
    overflow: hidden;
    padding-right: 0 !important; /* Override Bootstrap's scrollbar compensation */
}

/* Stable positioning for course selection elements */
#course-selection-container {
    position: relative;
    min-height: 200px; /* Ensure consistent height */
}

.btn-group, .form-group {
    position: relative; /* Prevent floating elements from affecting layout */
}

/* Course Selection Area Styling - Proper Alignment */
#course-selection .form-control {
    height: 42px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

/* Fix double arrows on course selection dropdowns */
#course-selection select.form-control,
#partition,
#courseCodeSelect {
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
    background-image: none !important;
    background: #ffffff !important;
    padding-right: 0.75rem !important;
}

#course-selection .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* Course Selection Row Layout */
#course-selection .row {
    align-items: flex-start !important;
}

#course-selection .col-md-3 {
    display: flex;
    flex-direction: column;
}

/* Get Course Data Button - Hidden since auto-loading is enabled */
#get-course-button {
    display: none !important;
}

/* ===================================
   ENHANCED NAVBAR STYLING - CLEAN PROFESSIONAL LAYOUT
   =================================== */

.navbar {
    background: var(--primary-gradient) !important;
    box-shadow: var(--shadow-lg);
    border: none;
    min-height: 70px;
    transition: all 0.3s ease;
    padding: 0.4rem 0.5rem !important;
    overflow: visible !important;
    position: relative !important;
}

.navbar-nav {
    flex-wrap: nowrap !important;
    gap: 0.25rem !important;
    align-items: center !important;
    overflow: visible !important;
}

.navbar .container {
    max-width: 100%;
    padding: 0 !important;
    overflow: visible !important;
}

.navbar-brand img {
    margin-right: 8px;
    filter: brightness(1.1);
    transition: transform 0.3s ease;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Logo sizing for different screen sizes */
#logopic {
    height: 60px;
    width: auto;
    object-fit: contain;
    display: block;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

.navbar-text {
    color: white !important;
    font-weight: 600;
    font-size: 1.2rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Logo styling for main content section */
.logo-main-content {
    height: 80px;
    width: auto;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    object-fit: contain;
}

.logo-main-content:hover {
    transform: scale(1.05);
}

/* Enhanced Button Styles */
.btn {
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
    font-size: 0.875rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Enhanced Focus Indicators for Accessibility */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.3);
}

/* Skip to main content for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Base Button Sizing for Clean Single-Row Layout */
.navbar .btn {
    height: 36px !important;
    padding: 0.5rem 0.9rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.875rem !important;
    border-radius: 22px !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    text-align: center !important;
    line-height: 1 !important;
    margin: 0 0.15rem !important;
    font-weight: 500 !important;
    border: 1px solid transparent !important;
    text-transform: none !important;
    flex-shrink: 0;
}

/* Primary Generate Button */
.navbar .btn-generate-primary {
    background: linear-gradient(135deg, #4ade80, #22c55e) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3) !important;
    font-weight: 600 !important;
}

.navbar .btn-generate-primary:hover {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4) !important;
    color: white !important;
}

/* Primary Save Button */
.navbar .btn-save-primary {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3) !important;
    font-weight: 600 !important;
}

.navbar .btn-save-primary:hover {
    background: linear-gradient(135deg, #d97706, #b45309) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
    color: white !important;
}

/* Standard Workflow Buttons */
.navbar .btn-workflow {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(10px) !important;
}

.navbar .btn-workflow:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

/* Admin Dropdown - Fixed Positioning */
.admin-dropdown {
    position: relative !important;
}

.admin-dropdown .dropdown-toggle {
    background: rgba(0, 0, 0, 0.2) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    font-size: 0.875rem !important;
}

.admin-dropdown .dropdown-toggle:hover {
    background: rgba(0, 0, 0, 0.3) !important;
    color: white !important;
}

.admin-dropdown .dropdown-menu {
    background: white !important;
    border: none !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    border-radius: 8px !important;
    min-width: 160px !important;
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    z-index: 1050 !important;
    margin-top: 0.125rem !important;
    transform: none !important;
    will-change: auto !important;
}

.admin-dropdown .dropdown-item {
    padding: 0.6rem 1rem !important;
    color: #374151 !important;
    transition: all 0.2s ease !important;
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    border: none !important;
    background: transparent !important;
}

.admin-dropdown .dropdown-item:hover {
    background-color: #f3f4f6 !important;
    color: #1f2937 !important;
}

/* ===================================
   PROGRESSIVE DISCLOSURE & COGNITIVE LOAD REDUCTION
   =================================== */

/* Collapsible Form Sections */
.form-section {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    overflow: hidden;
}

.form-section-header {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-section-header:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

.form-section-header.collapsed {
    border-bottom: none;
}

.form-section-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.field-count {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
}

.completion-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
}

.completion-indicator.complete {
    color: var(--success-color);
}

.completion-indicator.partial {
    color: var(--warning-color);
}

.completion-indicator.empty {
    color: var(--text-secondary);
}

.form-section-content {
    padding: 1rem;
    background: var(--card-bg);
    transition: all 0.3s ease;
}

.form-section-content.collapsed {
    display: none;
}

/* Collapse/Expand Icons */
.collapse-icon {
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

/* Form Field Groups within Sections */
.field-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.field-group.single-column {
    grid-template-columns: 1fr;
}

/* Enhanced Field Labels with Context */
.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-label.required::after {
    content: "*";
    color: var(--danger-color);
    font-weight: 700;
}

.field-help {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.field-help-icon {
    color: var(--info-color);
    cursor: help;
    font-size: 0.875rem;
}

/* Auto-save Indicators - Enhanced Visibility and Positioning */
.save-indicator {
    position: fixed;
    top: 75px;
    right: 20px;
    left: 20px;
    margin: 0 auto;
    max-width: 300px;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 1060;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: center;
    border: 2px solid transparent;
}

.save-indicator.saving {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-color: rgba(245, 158, 11, 0.3);
    animation: pulse 2s infinite;
}

.save-indicator.saved {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: rgba(16, 185, 129, 0.3);
}

.save-indicator.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-color: rgba(239, 68, 68, 0.3);
}

.save-indicator.hidden {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* ===================================
   CONTAINER AND LAYOUT STYLES
   =================================== */

.container {
    max-width: 1200px;
    padding-left: 1rem;
    padding-right: 1rem;
}

#main-content-wrapper {
    margin-top: 1rem;
}

/* ===================================
   KEYBOARD NAVIGATION & ACCESSIBILITY
   =================================== */

/* Responsive navbar adjustments */
@media (max-width: 1200px) {
    .workflow-label {
        display: none; /* Hide step labels on smaller screens */
    }
    
    .navbar .btn {
        max-width: 90px !important;
        font-size: 0.6rem !important;
        padding: 0.25rem 0.3rem !important;
    }
    
    .workflow-section {
        margin-right: 0.5rem;
        padding-right: 0.5rem;
    }
}

@media (max-width: 992px) {
    .navbar-nav {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
    }
    
    .workflow-section {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        margin-right: 0;
        padding: 0.5rem 0;
        justify-content: center;
    }
    
    .workflow-section:last-child {
        border-bottom: none;
    }
    
    .navbar .btn {
        max-width: none !important;
        margin: 0.1rem 0.25rem !important;
    }
}

/* Keyboard Navigation Helpers */
.keyboard-shortcut {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    font-family: monospace;
}

/* Focus Trap for Modals - Simple Bootstrap approach */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    display: none;
    overflow: auto;
}

.modal.show {
    display: block;
}

.modal-dialog {
    position: relative;
    margin: 3rem auto;
    max-width: 800px;
    z-index: 1060;
}

/* User Management Modal Specific Centering */
#userManagementModal .modal-dialog {
    margin: 2rem auto;
    position: relative;
    transform: translateY(0);
    max-width: 1400px;
    width: 98%;
}

/* Ensure modal content is visible and centered */
#userManagementModal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Optimize table layout for User Management */
#userManagementModal .table {
    table-layout: auto;
    width: 100%;
    font-size: 0.9rem;
}

#userManagementModal .table th,
#userManagementModal .table td {
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Specific column widths for better visibility */
#userManagementModal .table th:nth-child(1),
#userManagementModal .table td:nth-child(1) {
    width: 25%;
    min-width: 200px;
}

#userManagementModal .table th:nth-child(2),
#userManagementModal .table td:nth-child(2) {
    width: 15%;
    min-width: 120px;
}

#userManagementModal .table th:nth-child(3),
#userManagementModal .table td:nth-child(3) {
    width: 20%;
    min-width: 150px;
}

#userManagementModal .table th:nth-child(4),
#userManagementModal .table td:nth-child(4) {
    width: 15%;
    min-width: 80px;
}

#userManagementModal .table th:nth-child(5),
#userManagementModal .table td:nth-child(5) {
    width: 25%;
    min-width: 120px;
}

/* SPECIFIC FIX: Target the dynamically created role dropdowns in the user table */
#userManagementModal #users-table-body select.form-control.form-control-sm {
    font-size: 0.9rem !important;
    padding: 0.35rem 0.75rem !important;
    min-width: 160px !important;
    width: 160px !important;
    height: 34px !important;
    border: 1px solid #ced4da !important;
    background-color: #ffffff !important;
    color: #495057 !important;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
    line-height: 1.4 !important;
}

/* Ensure the table cell gives enough room */
#userManagementModal #users-table-body td:nth-child(3) {
    padding: 0.5rem !important;
    min-width: 180px !important;
}

/* Make role dropdown/select elements larger and more readable */
#userManagementModal .table td select,
#userManagementModal .table td .form-control {
    font-size: 0.9rem !important;
    padding: 0.4rem 0.6rem !important;
    min-width: 140px !important;
    height: 32px !important;
    border: 1px solid #ced4da !important;
    background-color: white !important;
    color: #495057 !important;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
}

/* Specifically target the small form controls in the table */
#userManagementModal .table td .form-control-sm {
    font-size: 0.85rem !important;
    padding: 0.35rem 0.5rem !important;
    min-width: 140px !important;
    height: 30px !important;
    line-height: 1.2 !important;
    border: 1px solid #ced4da !important;
    background-color: white !important;
    color: #495057 !important;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
}

/* Override any Bootstrap table styling that might interfere */
#userManagementModal .table td select option {
    color: #495057 !important;
    background-color: white !important;
    padding: 0.25rem 0.5rem !important;
}

/* Simple, working table cell alignment */
#userManagementModal .table td {
    vertical-align: middle !important;
    padding: 0.75rem !important;
    line-height: 1.4;
}

/* Ensure all table rows have consistent height */
#userManagementModal .table tr {
    height: 60px !important;
}

/* Make sure select dropdowns in role column are properly sized */
#userManagementModal .table td:nth-child(3) select {
    width: 160px !important;
}

/* Better spacing for User Management form elements */
#userManagementModal .form-group {
    margin-bottom: 1.25rem;
}

#userManagementModal .form-control {
    margin-bottom: 0.75rem;
}

#userManagementModal .row {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
}

#userManagementModal .col-md-6 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

/* Enhanced Tab Navigation */
.nav-tabs {
    border-bottom: none !important;
    margin-bottom: 0 !important;
}

.nav-tabs .nav-link {
    position: relative;
    border: 1px solid #dee2e6 !important;
    border-bottom: none !important;
    margin-bottom: 0 !important;
    margin-right: 2px;
    border-radius: 0.375rem 0.375rem 0 0 !important;
}

.nav-tabs .nav-link.active {
    border: 1px solid #dee2e6 !important;
    border-bottom: none !important;
    z-index: 10;
}

.nav-tabs .nav-link:focus {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
    z-index: 10;
}

/* Connect tabs to content below */
.tab-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.tab-content .card {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    margin-top: 0 !important;
}

/* Accessibility Improvements */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --text-primary: #000000;
        --text-secondary: #333333;
        --border-color: #000000;
        --card-bg: #ffffff;
    }
    
    .btn:focus,
    .form-control:focus,
    .nav-link:focus {
        outline: 4px solid #000000;
        outline-offset: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===================================
   ENHANCED CARD STYLES
   =================================== */

/* Enhanced Cards with Layered Depth System */
.card {
    border: none;
    border-radius: 16px;
    background: linear-gradient(145deg, #f1f5f9 0%, #f8fafc 100%); /* Base layer - darker */
    box-shadow: 
        0 8px 25px rgba(37, 99, 235, 0.08),
        0 3px 10px rgba(0, 0, 0, 0.06),
        inset 0 1px 2px rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        rgba(79, 70, 229, 0.2) 0%, 
        rgba(147, 51, 234, 0.1) 50%, 
        rgba(79, 70, 229, 0.2) 100%);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 35px rgba(37, 99, 235, 0.12),
        0 5px 15px rgba(0, 0, 0, 0.08),
        inset 0 1px 2px rgba(255, 255, 255, 0.9);
    z-index: 2;
}

.card-header {
    background: transparent !important; /* Make background transparent */
    border: none !important; /* Remove border around the bar */
    border-radius: 16px 16px 0 0 !important;
    padding: 0.4rem 1rem; /* Further reduced padding */
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    box-shadow: none !important; /* Remove box shadow */
    z-index: 3;
    margin-bottom: 0 !important; /* Remove bottom margin */
}

.card-header h5, 
.card-header h6 {
    margin-bottom: 0;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.card-body {
    padding: 0.4rem 1rem 1rem; /* Reduced top and overall padding */
    margin-top: 0 !important;
    background: linear-gradient(145deg, #ffffff 0%, #fefefe 100%); /* Top layer - lightest */
    position: relative;
    z-index: 4;
}

/* Specific styling for input section to reduce top whitespace */
#input-section .card-body {
    padding: 0rem 1rem 0.1rem !important; /* Zero top padding, minimal bottom padding */
}

/* Reduce margin on the title container within input section */
#input-section .card-body .d-flex:first-child {
    margin-bottom: 0.25rem !important; /* Minimal bottom margin of title container */
}

/* Reduce spacing in form elements */
#input-section .form-row {
    margin-bottom: 0.1rem !important; /* Minimal form row bottom margin */
}

/* Reduce spacing on form columns */
#input-section .col-md-5,
#input-section .col-md-4,
#input-section .col-md-3 {
    margin-bottom: 0.25rem !important; /* Minimal column margins */
}

/* Reduce spacing on labels and form controls */
#input-section label {
    margin-bottom: 0.1rem !important; /* Minimal label bottom margin */
}

#input-section .form-control {
    margin-bottom: 0.1rem !important; /* Minimal form control bottom margin */
}

#input-section .form-text {
    margin-top: 0.1rem !important; /* Minimal help text top margin */
}

/* AGGRESSIVE VERTICAL SPACING REDUCTION */
/* Override Bootstrap margin classes throughout the application */
.mb-1 { margin-bottom: 0.1rem !important; }
.mb-2 { margin-bottom: 0.2rem !important; }
.mb-3 { margin-bottom: 0.3rem !important; }
.mb-4 { margin-bottom: 0.4rem !important; }
.mb-5 { margin-bottom: 0.5rem !important; }

/* Reduce form-group spacing significantly */
.form-group {
    margin-bottom: 0.3rem !important;
}

/* Reduce card spacing */
.card.mb-4 {
    margin-bottom: 0.4rem !important;
}

/* Reduce tab content spacing */
.tab-content .card {
    margin-bottom: 0.3rem !important;
}

/* Reduce heading spacing in tabs */
.tab-pane h6.mb-3 {
    margin-bottom: 0.3rem !important;
}

/* Reduce spacing between form sections */
.tab-pane .mt-4 {
    margin-top: 0.4rem !important;
}

/* Week Details styling - white background with dark text */
.card-header:has(h5:contains("Week")), 
.card-header h5:contains("Details"),
[class*="week-"] .card-header {
    background: white !important;
    color: #333 !important;
}

/* Alternative selector for week details headers */
.card-header h5 {
    color: #333 !important;
}

.card-header {
    background: white !important;
    padding: 0.2rem 1rem !important; /* Further reduce padding for all card headers */
    margin-bottom: 0 !important;
}

/* Reduce spacing between week details and module content */
.tab-pane .card-header {
    padding: 0.1rem 1rem !important; /* Minimal padding for week details headers */
}

.tab-pane .card-body {
    padding-top: 0.2rem !important; /* Minimal top padding for week content */
}

/* Reduce whitespace below Course Details button */
.tab-pane .card-header + .card-body {
    padding-top: 0.1rem !important; /* Even less padding below course details */
    margin-top: 0 !important;
}

/* General reduction of spacing in tab content */
.tab-content .card {
    margin-bottom: 0.5rem !important; /* Reduce bottom margin of cards in tabs */
}

/* UNIFORM HEADER STYLING - All headers match the Change Log dark gray appearance */
#course-info-pane .card-header,
#weeks-content .card-header,
.tab-pane .card-header {
    background: #495057 !important; /* Dark gray/slate background matching Change Log */
    color: white !important;
    font-weight: 600 !important;
    border: none !important;
    border-bottom: none !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0.375rem 0.375rem 0 0 !important; /* Only round top corners */
    outline: none !important;
}

/* Ensure all text in these headers is white */
#course-info-pane .card-header h5,
#course-info-pane .card-header .h6,
#weeks-content .card-header h6,
#weeks-content .card-header h5,
.tab-pane .card-header h6,
.tab-pane .card-header h5 {
    color: white !important;
    background: transparent !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    margin-bottom: 0;
    text-shadow: none !important;
}

/* ===================================
   ENHANCED TAB NAVIGATION
   =================================== */

.nav-tabs {
    border: none !important; /* Remove border around entire tab group */
    border-bottom: none !important;
    background: transparent;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 0.25rem 0.5rem 0;
    margin-bottom: 0;
}

.nav-tabs .nav-item {
    margin-bottom: -2px;
    margin-right: 0.25rem;
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 0.5rem 0.5rem 0 0 !important; /* More pronounced rounded top corners */
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    transition: all 0.3s ease;
    background: transparent;
    position: relative;
    margin-bottom: 2px;
}

.nav-tabs .nav-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-tabs .nav-link.active {
    background: var(--primary-gradient);
    color: white !important;
    border-bottom: 2px solid var(--primary-color);
    font-weight: 700 !important;
    box-shadow: var(--shadow-md);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
    z-index: 7; /* Highest for active navigation */
}

.nav-tabs .nav-link.active i {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    color: white !important;
}

.tab-content {
    background: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%); /* Darker at top, lighter at bottom */
    border: 2px solid var(--border-color) !important; /* Add border around tab content */
    border-top: none !important; /* Remove top border to connect with tabs */
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    min-height: 400px;
    position: relative;
    z-index: 1;
    padding: 0 !important; /* Remove padding around tab content */
    margin: 0 !important; /* Remove margin around tab content */
}

/* ===================================
   INPUT SECTION - LAYERED DEPTH SYSTEM
   =================================== */

#input-section {
    background: transparent !important; /* Clear white background */
    border: none !important; /* Remove border */
    border-radius: 20px;
    backdrop-filter: none !important; /* Remove backdrop filter */
    box-shadow: none !important; /* Remove shadow */
    position: relative;
    overflow: hidden;
    z-index: 0; /* Base layer */
}

#input-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(79, 70, 229, 0.3) 0%, 
        rgba(147, 51, 234, 0.2) 50%, 
        rgba(79, 70, 229, 0.3) 100%);
}

#input-section .card-title {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 0.8rem; /* Reduced spacing */
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.8);
}

/* ===================================
   FORM CONTROLS AND INPUTS
   =================================== */

.form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    background: var(--card-bg);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.form-control-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

/* Enhanced Button Styles with Better Depth */
.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    box-shadow: 
        0 6px 20px rgba(79, 70, 229, 0.25),
        0 2px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 2px rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a52e8 0%, #8b47f0 100%);
    transform: translateY(-3px);
    box-shadow: 
        0 8px 25px rgba(79, 70, 229, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 2px rgba(255, 255, 255, 0.25);
}

.btn-outline-secondary {
    border: 2px solid rgba(148, 163, 184, 0.6);
    color: var(--text-secondary);
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    box-shadow: 
        0 3px 8px rgba(0, 0, 0, 0.05),
        inset 0 1px 2px rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-outline-secondary:hover {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    border-color: #64748b;
    color: white;
    transform: translateY(-2px);
    box-shadow: 
        0 6px 15px rgba(100, 116, 139, 0.2),
        0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 12px;
    box-shadow: 
        0 6px 20px rgba(16, 185, 129, 0.25),
        0 2px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 2px rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-success:hover {
    background: linear-gradient(135deg, #14c085 0%, #06925b 100%);
    transform: translateY(-3px);
    box-shadow: 
        0 8px 25px rgba(16, 185, 129, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-warning {
    background: linear-gradient(135deg, #ffd93d 0%, #ff9500 100%);
    border: none;
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e6c235 0%, #e6850a 100%);
    transform: translateY(-2px);
}

.btn-info {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    border: none;
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #5aa3f0 0%, #0770c4 100%);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    border: none;
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff5252 0%, #d64545 100%);
    transform: translateY(-2px);
}

/* ===================================
   ENHANCED FORM AND FIELD STYLES
   =================================== */

/* Input Section Specifics */
#input-section label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Welcome message styling - clean inline version */
#welcome-message {
    font-style: italic;
    color: #6b7280;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    margin: 0 !important;
}

/* Inline welcome message styling */
.welcome-inline {
    font-style: italic;
    color: #6b7280;
    font-size: 1rem;
}

/* Enhanced Field Display (Read-Only View) */
.field-display {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
    background: var(--light-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.field-display:hover {
    background: rgba(102, 126, 234, 0.02);
    border-color: var(--primary-color);
}

.field-display .label {
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-display .value {
    color: var(--text-primary);
    white-space: pre-wrap;
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.field-display .value i.small {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.field-display .value ul,
.field-display .value ol {
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.field-display .value table {
    font-size: 0.9em;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    width: auto;
    max-width: 100%;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* Enhanced Section Headers - Layered Depth with Z-Index Hierarchy */
.section-header {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem; /* Reduced from 0.5rem */
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25), 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    z-index: 5; /* Highest layer - most prominent */
}

.section-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
}

/* Course Details Section - Tighter Spacing */
#courseDetails h6.font-weight-bold,
#courseDetails .section-header,
.course-detail-label {
    margin-top: 0.5rem !important; /* Reduced spacing */
    margin-bottom: 0.15rem !important; /* Much tighter */
}

/* Content following section headers */
.section-header + .form-group,
.section-header + div,
.section-header + p {
    margin-top: 0.25rem !important;
}

/* Additional Spacing Improvements */
.container-fluid .row > [class*="col-"] {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* Improved visual hierarchy for course content */
#courseDetails p,
#courseDetails .form-group p {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Enhanced spacing for content sections with layered depth */
.tab-pane {
    padding: 0 !important; /* Remove all padding */
    margin: 0 !important; /* Remove all margin */
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%); /* Mid-layer background */
    position: relative;
    z-index: 2;
}

.tab-pane .card {
    margin: 0 !important; /* Remove card margins */
    border-radius: 0 !important; /* Remove border radius to fit flush */
    border: none !important; /* Remove border */
    background: transparent !important; /* Make card background transparent */
    /* Cards inherit the layered system defined above */
}

/* Fix Course Details header to match active tab styling */
.tab-pane .card h6,
.tab-pane .card .card-header h6,
.tab-pane .card-header h6 {
    background: var(--primary-gradient) !important; /* Same as active tab */
    color: white !important; /* Same as active tab */
    font-weight: 700 !important; /* Same as active tab */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important; /* Same as active tab */
    padding: 1rem 1.5rem !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important; /* Flush with tab content */
    box-shadow: var(--shadow-md) !important; /* Same as active tab */
}

/* Add padding back to card body content only */
.tab-pane .card .card-body {
    padding: 1.5rem !important;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%) !important; /* Match tab content */
}

/* Edit Form Styling with Enhanced Depth */
.edit-form .form-group {
    margin-bottom: 0.8rem; /* Reduced from 1rem */
    position: relative;
}

.edit-form .form-control {
    border: 2px solid #3b82f6 !important; /* Clear blue border to indicate editable */
    background: linear-gradient(145deg, #f8fafc 0%, #ffffff 100%) !important; /* Mid-layer background */
    border-radius: 12px;
    padding: 0.7rem 1rem;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.04),
        0 1px 3px rgba(59, 130, 246, 0.15) !important; /* Blue shadow to reinforce editability */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 3;
}

/* Make ALL form controls in edit mode clearly visible */
.edit-mode .form-control,
.editing .form-control {
    border: 2px solid #3b82f6 !important; /* Blue border for all editable fields */
    background: #ffffff !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1) !important;
}

.edit-form .form-control:focus {
    border-color: #4f46e5;
    background: linear-gradient(145deg, #ffffff 0%, #fefefe 100%); /* Lightest when focused */
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.04),
        0 0 0 3px rgba(79, 70, 229, 0.1),
        0 4px 12px rgba(79, 70, 229, 0.15);
    outline: none;
    transform: translateY(-1px);
    z-index: 6; /* Above section headers when focused */
}

/* Enhanced Form Labels */
.edit-form label,
.form-group label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.4rem; /* Reduced spacing */
    font-size: 0.875rem;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.edit-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ===================================
   MODAL ENHANCEMENTS
   =================================== */

.modal-content {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    background: var(--primary-gradient);
    color: white;
    border-bottom: none;
    padding: 1.5rem;
}

/* Remove header styling from loading/waiting modals */
.loading-spinner .modal-header,
#loading-modal .modal-header,
.modal.loading .modal-header {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    display: none !important;
}

/* Fix the loadingSpinner blue line issue */
#loadingSpinner {
    border: none !important;
    border-top: none !important;
    outline: none !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
}

#loadingSpinner::before,
#loadingSpinner::after {
    display: none !important;
}

/* Design Document Download Spinner Styling */
#designDocSpinner {
    backdrop-filter: blur(2px);
    border: 2px solid var(--primary-color, #007bff) !important;
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.15) !important;
}

#designDocSpinner::before,
#designDocSpinner::after {
    display: none !important;
}

#designDocSpinner .fa-download {
    animation: downloadPulse 1.5s ease-in-out infinite;
}

@keyframes downloadPulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.1); 
        opacity: 0.8; 
    }
}

.modal-header .modal-title {
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.modal-header .close {
    color: white;
    opacity: 0.8;
    text-shadow: none;
}

.modal-header .close:hover {
    opacity: 1;
    color: white;
}

.modal-body {
    padding: 2rem;
    background: var(--light-bg);
}

.modal-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
}

/* ===================================
   ALERT AND MESSAGE STYLES
   =================================== */

.alert {
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(238, 90, 82, 0.1) 100%);
    color: #c53030;
    border-left: 4px solid #ff6b6b;
}

.alert-success {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.1) 0%, rgba(68, 160, 141, 0.1) 100%);
    color: #2d7d74;
    border-left: 4px solid #4ecdc4;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 217, 61, 0.1) 0%, rgba(255, 149, 0, 0.1) 100%);
    color: #b7791f;
    border-left: 4px solid #ffd93d;
}

.alert-info {
    background: linear-gradient(135deg, rgba(116, 185, 255, 0.1) 0%, rgba(9, 132, 227, 0.1) 100%);
    color: #2c5aa0;
    border-left: 4px solid #74b9ff;
}

/* ===================================
   NOTIFICATION ANIMATIONS
   =================================== */

@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToRight {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Notification specific styling */
[data-notification="true"] {
    transition: top 0.3s ease-in-out;
}

/* ===================================
   ENHANCED LOADING SPINNER - PROFESSIONAL DESIGN
   =================================== */

/* Target the specific loadingSpinner ID to override inline styles */
#loadingSpinner {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1060 !important;
    background-color: white !important; /* Override inline rgba background */
    padding: 2.5rem 3rem !important; /* Override inline 30px padding */
    border-radius: 16px !important; /* Override inline 8px radius */
    text-align: center !important;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.5), 0 25px 50px rgba(0, 0, 0, 0.4) !important; /* Override inline shadow */
    backdrop-filter: blur(10px) !important;
    border: 3px solid #ddd !important; /* Add visible border */
    min-width: 280px !important;
}

.loading-spinner {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1060 !important;
    background: white !important;
    padding: 2.5rem 3rem !important;
    border-radius: 16px !important;
    text-align: center !important;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.5), 0 25px 50px rgba(0, 0, 0, 0.4) !important; /* Dark backdrop + strong shadow */
    backdrop-filter: blur(10px) !important;
    border: 3px solid #ddd !important; /* More visible gray border */
    min-width: 280px !important;
    animation: modalFadeIn 0.3s ease-out !important;
}

/* Loading spinner backdrop */
.loading-spinner::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
    backdrop-filter: blur(2px);
}

.loading-spinner .spinner-border {
    width: 3.5rem !important;
    height: 3.5rem !important;
    border-width: 0.35rem !important;
    color: var(--primary-color) !important;
    animation: spin 1s linear infinite !important;
}

.loading-spinner .spinner-border {
    border-color: #e5e7eb !important;
    border-top-color: var(--primary-color) !important;
}

.loading-spinner p {
    color: #374151 !important;
    font-weight: 600 !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0 !important;
    font-size: 1.1rem !important;
    text-shadow: none !important;
}

/* Enhanced spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Professional loading icon - REMOVED to eliminate blue line */
.loading-spinner::after {
    display: none !important; /* Remove the blue line completely */
}

.edit-form label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}
.edit-form textarea {
    resize: vertical;
    min-height: 80px;
    font-size: 0.95rem;
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
    padding: 0.5rem;
}
.edit-form textarea:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.form-actions {
    padding-top: 1rem;
    border-top: 1px solid #eee;
    margin-top: 1.5rem;
}

/* Tab Styling Adjustments */
.nav-tabs {
    border-bottom: 1px solid #dee2e6; /* Ensure bottom border exists */
    /* Removed mb-3 class in HTML */
}

.tab-pane .card {
    /* Remove top border and top radius of card inside tab pane */
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin-bottom: 1.5rem; /* Re-add margin for spacing between content and next element */
}

.nav-tabs .nav-link {
    color: #495057;
    border-bottom-color: transparent; /* Hide bottom border by default */
    margin-bottom: -1px; /* Overlap the tab content border */
    border-top-left-radius: .25rem;  /* Keep top radius */
    border-top-right-radius: .25rem; /* Keep top radius */

}

.nav-tabs .nav-link.active {
    background-color: #fff; /* Make active tab background white */
    border-color: #dee2e6 #dee2e6 #fff; /* Match card border, make bottom white */
    font-weight: 600;
    color: #007bff;
}

.nav-tabs .nav-link:hover:not(.active) { /* Style non-active hover */
    border-color: #e9ecef #e9ecef #dee2e6;
    background-color: #f8f9fa; /* Light hover background */
}


/* Loading Spinner - Styles moved to inline for simplicity */

/* Utility Classes */
.edit-button i { margin-right: 5px; }
/* Screen reader only styles */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Specificity for Navbar Actions Alignment */
@media (min-width: 992px) {
  .navbar-expand-lg .navbar-nav {
    align-items: center; /* Vertically align items */
  }
}

/* ===================================
   ENHANCED CHANGELOG STYLES
   =================================== */

.changelog-entries {
    max-height: 600px;
    overflow-y: auto;
    position: relative;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: var(--border-radius);
}

.changelog-entry {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    margin-left: 3rem;
    transition: all 0.3s ease;
}

.changelog-entry:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(5px);
}

.changelog-entry:last-child {
    margin-bottom: 0;
}

.changelog-entry.border-left-4 {
    border-left-width: 4px !important;
}

.border-success {
    border-color: var(--success-color) !important;
}

.border-warning {
    border-color: var(--warning-color) !important;
}

.border-info {
    border-color: var(--info-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.border-secondary {
    border-color: var(--text-secondary) !important;
}

.changelog-action strong {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 700;
}

.changelog-comment p {
    background: var(--light-bg);
    border-left: 3px solid var(--primary-color);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 0;
    font-style: italic;
    color: var(--text-secondary);
}

.changelog-details .details-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

.changelog-details ul {
    margin-bottom: 0;
    list-style: none;
    padding-left: 0;
}

.changelog-details ul li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.changelog-details ul li:last-child {
    border-bottom: none;
}

.changelog-details ul li strong {
    color: var(--primary-color);
    font-weight: 600;
    min-width: 150px;
}

/* Enhanced Timeline effect for change log entries */
.changelog-entry::before {
    content: '';
    position: absolute;
    left: -2.25rem;
    top: 1.5rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid var(--card-bg);
    box-shadow: 0 0 0 3px var(--border-color);
    z-index: 2;
}

.changelog-entry.border-success::before {
    background: var(--success-color);
}

.changelog-entry.border-warning::before {
    background: var(--warning-color);
}

.changelog-entry.border-info::before {
    background: var(--info-color);
}

.changelog-entry.border-secondary::before {
    background: var(--text-secondary);
}

/* Responsive adjustments for change log */
@media (max-width: 768px) {
    /* Simple responsive logo - just reduce height, let width scale naturally */
    #logopic {
        height: 45px;
    }
    
    .logo-main-content {
        height: 60px;
    }
    
    /* Navbar adjustments for mobile */
    .navbar-text {
        font-size: 1rem;
        margin-left: 8px;
    }
    
    .changelog-entry {
        margin-left: 1.5rem;
        padding: 1rem;
    }
    
    .changelog-entries::before {
        left: 1rem;
    }
    
    .changelog-entry::before {
        left: -1.25rem;
        width: 10px;
        height: 10px;
    }
    
    .changelog-action strong {
        font-size: 1rem;
    }
}

/* ===================================
   ENHANCED MODAL AND TAB STYLING
   =================================== */

/* Enhanced tab styling within modals - Better contrast and visibility */
.modal .nav-tabs {
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1rem;
    background: #f8fafc; /* Light gray background for tab bar */
    padding: 0.5rem;
    border-radius: 8px 8px 0 0;
}

.modal .nav-tabs .nav-link {
    color: #374151 !important; /* Dark gray text for visibility */
    border: 1px solid #d1d5db;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    background: white; /* White background for tabs */
    font-weight: 500;
    margin-right: 0.25rem;
    border-radius: 6px 6px 0 0;
}

.modal .nav-tabs .nav-link:hover {
    border-color: #3b82f6;
    color: #1d4ed8 !important;
    background: #eff6ff; /* Light blue hover */
    border-radius: 6px 6px 0 0;
}

.modal .nav-tabs .nav-link.active {
    color: white !important; /* White text on active tab */
    background: var(--primary-gradient) !important; /* Blue gradient like main tabs */
    border-bottom-color: var(--primary-color);
    font-weight: 700;
    border: 1px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Enhanced form controls in modals - Better visibility and contrast */
.modal .form-control:not(textarea) {
    height: 42px !important;
    border: 2px solid #3b82f6 !important; /* Blue border for visibility */
    border-radius: 8px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.95rem !important;
    transition: all 0.3s ease !important;
    background: white !important;
    color: #374151 !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1) !important;
}

/* Separate styling for textareas in modals */
.modal textarea.form-control {
    border: 2px solid #3b82f6 !important; /* Blue border for visibility */
    border-radius: 8px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.95rem !important;
    transition: all 0.3s ease !important;
    background: white !important;
    color: #374151 !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1) !important;
    resize: vertical;
    min-height: 120px; /* Ensure decent minimum height for textareas */
}

.modal .form-control:focus {
    border-color: #1d4ed8 !important;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25) !important;
    background: #fefefe !important;
}

/* Better styling for range sliders in modals */
.modal input[type="range"] {
    appearance: none !important;
    width: 100% !important;
    height: 8px !important;
    border-radius: 4px !important;
    background: #e5e7eb !important;
    outline: none !important;
    border: 1px solid #d1d5db !important;
}

.modal input[type="range"]::-webkit-slider-thumb {
    appearance: none !important;
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    background: var(--primary-gradient) !important;
    cursor: pointer !important;
    border: 2px solid white !important;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3) !important;
}

.modal input[type="range"]::-moz-range-thumb {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    background: var(--primary-gradient) !important;
    cursor: pointer !important;
    border: 2px solid white !important;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3) !important;
}

.modal .form-control::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

.modal .form-control:hover {
    border-color: #9ca3af !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

.modal .form-group label {
    font-weight: 600 !important;
    color: #374151 !important;
    margin-bottom: 0.5rem !important;
    font-size: 0.9rem !important;
    display: block !important;
}

.modal .form-group small {
    color: #6b7280 !important;
    font-size: 0.8rem !important;
    margin-top: 0.25rem !important;
}

/* Enhanced edge padding for modal forms */
.modal form {
    padding: 0 0.5rem;
}

.modal .row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.modal .row .col-md-6,
.modal .row .col-md-8,
.modal .row .col-md-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Enhanced range slider styling */
.form-control-range {
    -webkit-appearance: none;
    appearance: none;
    background: #cbd5e1;
    cursor: pointer;
    height: 12px;
    outline: none;
    width: 100%;
    border-radius: 6px;
    border: 2px solid #94a3b8;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-control-range::-webkit-slider-track {
    background: #cbd5e1;
    height: 12px;
    border-radius: 6px;
    border: none;
}

.form-control-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 28px;
    width: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    cursor: pointer;
    border: 4px solid #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    position: relative;
    margin-top: -10px;
}

.form-control-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5), 0 3px 8px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1e3a8a 100%);
}

.form-control-range::-webkit-slider-thumb:active {
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.6);
}

.form-control-range::-moz-range-track {
    background: #cbd5e1;
    height: 12px;
    border-radius: 6px;
    border: none;
}

.form-control-range::-moz-range-thumb {
    height: 28px;
    width: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    cursor: pointer;
    border: 4px solid #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.form-control-range::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5), 0 3px 8px rgba(0, 0, 0, 0.3);
}

/* Firefox specific fix */
.form-control-range::-moz-range-track {
    background: #cbd5e1 !important;
    height: 12px !important;
    border-radius: 6px !important;
    border: none !important;
}

.form-control-range::-moz-range-progress {
    background: #cbd5e1 !important;
    height: 12px !important;
    border-radius: 6px !important;
}

/* Slider container with range indicators */
.slider-container {
    position: relative;
    margin: 15px 0;
    padding: 10px 5px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.slider-range-indicators {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding: 0 14px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.slider-range-indicators .range-min,
.slider-range-indicators .range-max {
    background: #ffffff;
    padding: 4px 10px;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    color: var(--primary-color);
}

/* Quiz generation form specific styling */
.quiz-generation-form .form-group {
    margin-bottom: 25px;
}

.quiz-generation-form .form-group label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.quiz-generation-form .form-group .form-text {
    margin-top: 8px;
    font-style: italic;
}

/* Enhanced modal animations */
@keyframes modalSlideIn {
    from { 
        opacity: 0; 
        transform: scale(0.8) translateY(-50px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

.modal.show .modal-dialog {
    animation: modalSlideIn 0.3s ease-out;
}

/* Enhanced modal content sections */
.modal .tab-content {
    background: var(--card-bg);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    padding: 2.5rem;
    margin-top: -1px;
}

.modal .tab-pane {
    border: none;
    padding: 0.5rem 1.5rem;
}

/* Revert form groups to normal spacing */
.modal .form-group {
    margin-bottom: 1rem !important;
}

.modal .row .form-group {
    margin-bottom: 1rem !important;
}

.modal h6 {
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    margin-top: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.modal h6 i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Enhanced modal close button */
.modal-header .close {
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    padding: 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
    background: transparent;
    border: none;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-header .close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Enhanced select styling - Match main page approach */
.modal select.form-control {
    height: 42px !important;
    border: 2px solid #d1d5db !important;
    border-radius: 8px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.95rem !important;
    transition: all 0.3s ease !important;
    background-color: #ffffff !important;
    color: #374151 !important;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
}

.modal select.form-control:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25) !important;
    outline: none !important;
}

/* Fix dropdown visibility and styling - Match working main page approach */
select.form-control,
.form-control select,
select {
    height: 42px !important;
    background-color: #ffffff !important;
    color: #374151 !important;
    border: 2px solid #d1d5db !important;
    border-radius: 8px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.95rem !important;
    font-weight: normal !important;
    line-height: 1.5 !important;
    transition: all 0.3s ease !important;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
}

/* Force selected option visibility - Simple approach */
select.form-control:valid,
.form-control select:valid,
select:valid {
    color: #374151 !important;
    background-color: #ffffff !important;
}

select.form-control:focus,
.form-control select:focus,
select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25) !important;
    outline: none !important;
    background-color: #ffffff !important;
    color: #374151 !important;
}

select.form-control option,
.form-control select option,
select option {
    background-color: #ffffff !important;
    color: #000000 !important;
    padding: 0.75rem;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    line-height: 1.4;
}

/* Specific styling for small form controls */
select.form-control-sm {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #2563eb !important;
    font-weight: 500 !important;
    font-size: 0.9rem !important;
    padding: 0.5rem 2rem 0.5rem 0.75rem !important;
    height: 2.5rem !important;
    line-height: 1.5 !important;
    vertical-align: middle !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 0.8em 0.8em;
    -webkit-text-fill-color: #000000 !important;
}

/* Enhanced form labels and text styling */
label.small,
.small {
    color: #374151;
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.font-weight-bold {
    font-weight: 700 !important;
    color: #1e293b;
}

/* Enhanced form group styling */
.form-group label,
.form-row label {
    color: #1e293b;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Specific styling for section headers that are hard to read on dark backgrounds */
.card-header h4,
.card-header h5,
.course-section h4,
.course-section h5,
#courseDetails .small,
#courseDetails .font-weight-bold:not(.course-title):not(td),
.course-info .small,
.card-header .h6,
.card-header h6 {
    color: #f8fafc !important; /* Light text color */
    text-shadow: none !important;
    font-weight: 700 !important;
    background-color: #334155 !important; /* Darker background color */
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* Enhanced body background for better contrast */
body {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%) !important;
    min-height: 100vh;
}

/* Enhanced main content area */
#main-content {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Enhanced card styling for better separation */
.card {
    background-color: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(37, 99, 235, 0.2) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    margin-bottom: 1rem !important;
}

.card-body {
    background-color: rgba(255, 255, 255, 0.98) !important;
    padding: 1.25rem !important;
}

/* Tab content styling */
.tab-content {
    background-color: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(37, 99, 235, 0.2) !important;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Fix the specific section headers like "Book Info" that have text-primary class */
h6.section-header.text-primary,
.section-header.text-primary,
h6.text-primary,
h6.section-header.mt-4.mb-3.text-primary {
    color: #ffffff !important;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8) !important;
    font-weight: 700 !important;
    background-color: #2563eb !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 8px !important;
    margin: 0.5rem 0 0.5rem 0 !important;
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
}

/* Fix the section headers like "Book Info" that have text-primary class */
.section-header.text-primary,
h6.section-header.text-primary,
.text-primary.section-header {
    background: var(--primary-gradient) !important; /* Blue gradient background like active tabs */
    color: #ffffff !important; /* White text like active tabs */
    border: none !important; /* No border as requested */
    font-weight: 600 !important; /* Bold text */
    padding: 8px 15px !important; /* Consistent padding */
    margin: 0 !important; /* Remove margins */
    border-radius: 0 !important; /* Square corners to match tabs */
    text-shadow: none !important; /* Remove text shadow for clean look */
    display: block !important; /* Full width block */
    width: 100% !important; /* Full width */
}

/* Fix field labels in course display - make them dark and visible */
#course-info-display-tab .text-muted.small,
.field-display .label.text-muted.small,
.field-display .text-muted.small {
    color: #374151 !important;
    text-shadow: none !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

/* Ensure field values stay readable */
.field-display .value,
#course-info-display-tab .value {
    color: #1e293b !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    margin-top: 0.2rem;
}

/* Course details specific styling */
#courseDetails .font-weight-bold,
#courseDetails strong,
.course-details strong,
.course-info strong {
    color: #ffffff !important;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8) !important;
    font-weight: 700 !important;
}

/* Table headers in course details */
th {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8) !important;
    font-weight: 700 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    padding: 0.5rem !important;
}

/* Enhanced table styling for all tables */
.table {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 1rem !important;
}

.table thead th {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    padding: 0.6rem 0.8rem !important;
}

.table tbody td {
    padding: 0.5rem 0.8rem !important;
    border-top: 1px solid var(--border-color) !important;
}

.table tbody tr:hover {
    background: rgba(37, 99, 235, 0.05) !important;
}

/* Enhanced disabled state for selects */
select.form-control:disabled,
select.form-control-sm:disabled,
select:disabled {
    background-color: #f1f5f9 !important;
    color: #64748b !important;
    border-color: #cbd5e1 !important;
    opacity: 1;
    cursor: not-allowed;
    font-weight: 600 !important;
    min-height: 3rem;
    padding: 1rem 2.5rem 1rem 1rem;
}

select.form-control-sm:disabled {
    min-height: 2.5rem;
    padding: 0.75rem 2rem 0.75rem 1rem;
}

select.form-control:disabled option,
select.form-control-sm:disabled option,
select:disabled option {
    color: #64748b !important;
    font-weight: 600 !important;
    padding: 0.75rem;
}

/* Override any Bootstrap select styling */
.form-control,
.form-control-sm {
    line-height: 1.5;
}

/* Ensure text is visible in all browsers */
select,
select.form-control,
select.form-control-sm {
    -webkit-text-fill-color: #000000 !important;
}

select:disabled,
select.form-control:disabled,
select.form-control-sm:disabled {
    -webkit-text-fill-color: #64748b !important;
}

/* Additional fixes for selected value visibility */
select option:checked,
select option[selected] {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

/* Force dropdown text to be black when selected */
select:not([multiple]):not([size]) {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Webkit specific fixes */
select::-webkit-select-placeholder {
    color: #000000 !important;
}

/* Firefox specific fixes for text visibility */
select:-moz-focusring {
    color: transparent !important;
    text-shadow: 0 0 0 #000000 !important;
}

/* Enhanced table styling in modals */
.modal .table {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.modal .table thead th {
    background: var(--primary-gradient);
    color: var(--white-color);
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    padding: 1rem 0.75rem; /* Better padding */
}

.modal .table tbody tr {
    transition: all 0.2s ease;
}

.modal .table tbody td {
    padding: 1rem 0.75rem !important; /* Better padding for table cells */
    font-size: 0.95rem !important;
    color: #111827 !important; /* Darker text for better readability */
    background-color: #ffffff !important; /* Ensure white background */
}

.modal .table tbody tr:hover {
    background: rgba(108, 99, 255, 0.05);
    transform: scale(1.01); /* Reduced scale to prevent layout shift */
}

.modal .table tbody tr:hover td {
    background-color: rgba(108, 99, 255, 0.05) !important;
}

/* Enhanced badge and role text styling in tables */
.modal .table .badge,
.modal .table [class*="badge"],
.modal .table td:nth-child(3) { /* Role column - typically 3rd column */
    background-color: #f3f4f6 !important;
    color: #111827 !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    border: 1px solid #d1d5db !important;
    display: inline-block !important;
    min-width: auto !important;
}

/* Specific styling for Administrator role text */
.modal .table td:contains("Administrator"),
.modal .table td:contains("Admin") {
    background-color: #dbeafe !important;
    color: #1e40af !important;
}

/* Enhanced responsive design for modals */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem 0.5rem;
    }
    
    .modal .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .modal .tab-content {
        padding: 1rem;
    }
    
    .modal .form-group {
        margin-bottom: 1rem;
    }
}

/* ===================================
   ENHANCED BOOTSTRAP COLOR OVERRIDES
   =================================== */

/* Enhanced outline button styles */
.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-gradient);
    border-color: var(--primary-color);
    color: var(--white-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}

.btn-outline-success {
    color: var(--success-color);
    border-color: var(--success-color);
}

.btn-outline-success:hover {
    background: var(--success-color);
    border-color: var(--success-color);
    color: var(--white-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
}

.btn-outline-warning {
    color: var(--warning-color);
    border-color: var(--warning-color);
}

.btn-outline-warning:hover {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: var(--white-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.btn-outline-danger {
    color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-outline-danger:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: var(--white-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-outline-info {
    color: var(--info-color);
    border-color: var(--info-color);
}

.btn-outline-info:hover {
    background: var(--info-color);
    border-color: var(--info-color);
    color: var(--white-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

/* Enhanced disabled button state */
.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    transform: none !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

/* Enhanced button group styling */
.btn-group .btn {
    border-radius: var(--border-radius);
    margin-right: 0.25rem;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* Enhanced pulse animation */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse-on-hover:hover {
    animation: pulse 0.6s ease-in-out;
}

/* Enhanced table row hover effects */
.table-hover tbody tr:hover {
    background: rgba(108, 99, 255, 0.08);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

/* Enhanced badge styling */
.badge {
    border-radius: var(--border-radius);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: var(--primary-gradient);
}

.badge-success {
    background: var(--success-color);
}

.badge-warning {
    background: var(--warning-color);
}

.badge-danger {
    background: var(--danger-color);
}

.badge-info {
    background: var(--info-color);
}

/* Enhanced breadcrumb styling */
.breadcrumb {
    background: var(--light-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.breadcrumb-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* ===================================
   QUIZ MANAGEMENT STYLES
   =================================== */

.quiz-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.quiz-generation-form {
    background: var(--light-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    border: 2px dashed var(--border-color);
    text-align: center;
}

.quiz-questions .card {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.quiz-questions .card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.quiz-questions .card-header {
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
}

.quiz-questions .form-control-sm {
    border-radius: 4px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease;
}

.quiz-questions .form-control-sm:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

.quiz-questions .text-success {
    background-color: rgba(5, 150, 105, 0.1);
    border-color: var(--success-color) !important;
}

.quiz-button {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transition: all 0.2s ease;
}

.quiz-button:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.quiz-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Button group consistency fixes */
.btn-group .btn {
    margin-left: -1px;
    /* Ensure consistent height and alignment */
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.btn-group .btn:first-child {
    margin-left: 0;
}

/* Ensure buttons within spans inside btn-group maintain alignment */
.btn-group span .btn {
    margin-left: -1px;
}

/* Force consistent button sizing in podcast and quiz sections */
.podcast-container .btn-group .btn-sm,
.quiz-container .btn-group .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    height: auto;
    min-height: 31px; /* Bootstrap's default btn-sm height */
}

/* Quiz question type badges */
.quiz-questions .card-header h6::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 0.5rem;
    background-color: var(--info-color);
}

/* Different colors for different question types */
.quiz-questions .card-header:has-text("multiple_choice")::after {
    background-color: var(--primary-color);
}

.quiz-questions .card-header:has-text("true_false")::after {
    background-color: var(--success-color);
}

.quiz-questions .card-header:has-text("essay")::after {
    background-color: var(--warning-color);
}

/* Loading states */
.quiz-loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.quiz-loading .fas {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .quiz-container {
        padding: 1rem;
    }
    
    .quiz-generation-form {
        padding: 1.5rem;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        margin-left: 0;
        margin-top: -1px;
        border-radius: var(--border-radius) !important;
    }
    
    .btn-group .btn:first-child {
        margin-top: 0;
    }
}

/* Quiz Edit Mode Styles */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.quiz-header h4 {
    margin: 0;
    color: #495057;
}

.quiz-edit-controls {
    display: flex;
    gap: 10px;
}

.question-input.editable {
    border: 2px solid #007bff;
    background-color: #f8f9ff;
}

.question-input.editable:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.question-type-selector {
    margin-bottom: 10px;
    padding: 5px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    font-size: 0.9em;
}

.question-delete-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    margin-top: 5px;
}

.question-delete-btn:hover {
    background-color: #c82333;
}

.answer-input {
    margin-bottom: 5px;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: 100%;
}

.answer-input.editable {
    border-color: #28a745;
    background-color: #f8fff8;
}

.answer-weight-input {
    width: 80px;
    margin-left: 10px;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.answer-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.add-answer-btn, .delete-answer-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

.add-answer-btn {
    background-color: #28a745;
    color: white;
}

.add-answer-btn:hover {
    background-color: #218838;
}

.delete-answer-btn {
    background-color: #dc3545;
    color: white;
}

.delete-answer-btn:hover {
    background-color: #c82333;
}

.add-question-container {
    text-align: center;
    padding: 20px;
    border: 2px dashed #ced4da;
    border-radius: 8px;
    margin-top: 20px;
    background-color: #f8f9fa;
    display: none;
}

.add-question-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
}

.add-question-btn:hover {
    background-color: #0056b3;
}

.question-card.editing {
    border: 2px solid #007bff;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.1);
}

.feedback-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.feedback-tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8em;
}

.feedback-tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Answer Management Styles */
.add-answer-container {
    padding: 10px;
    margin-top: 10px;
    border: 1px dashed #ced4da;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.answer-input {
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.answer-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.answer-weight-input {
    transition: border-color 0.15s ease-in-out;
}

.answer-weight-input:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.delete-answer-btn {
    transition: all 0.15s ease-in-out;
}

.delete-answer-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.add-answer-btn {
    transition: all 0.15s ease-in-out;
    font-weight: 500;
}

.add-answer-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Question type specific styles */
.matching-pairs .row {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
}

.dropdown-group {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 15px;
}

.dropdown-group .card-header {
    background-color: #e9ecef;
    border-bottom: 1px solid #dee2e6;
}

.blank-answer {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
}

/* Edit mode indicators */
.question-card.editing .card-header {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.question-card.editing {
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* Responsive adjustments for answer management */
@media (max-width: 768px) {
    .answer-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .answer-weight-input {
        width: 100%;
        margin-left: 0;
        margin-top: 5px;
    }
    
    .delete-answer-btn, .add-answer-btn {
        width: 100%;
        margin-top: 5px;
    }
    
    .matching-pairs .row > div {
        margin-bottom: 10px;
    }
}

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    #logopic {
        height: 35px;
    }
    
    .logo-main-content {
        height: 50px;
    }
    
    .navbar-text {
        font-size: 0.9rem;
        margin-left: 5px;
    }
    
    /* Ensure navbar doesn't overflow */
    .navbar-nav.mr-auto {
        flex-wrap: nowrap;
        align-items: center;
    }
}

/* ===================================
   PODCAST SCRIPT STYLES
   =================================== */

.podcast-container {
    max-width: 100%;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Ensure podcast and quiz button rows have consistent height */
.podcast-container .d-flex,
.quiz-container .d-flex {
    align-items: center;
}

.podcast-container .btn-group,
.quiz-container .btn-group {
    flex-shrink: 0;
}

/* Normalize heading sizes to prevent height differences */
.podcast-container h5,
.quiz-container h4 {
    line-height: 1.2;
    margin: 0;
}

.podcast-script {
    font-family: 'Courier New', Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #2c3e50;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 0;
    max-height: 600px;
    overflow-y: auto;
}

.podcast-content .card {
    border: none;
    box-shadow: var(--shadow-md);
    border-radius: var(--border-radius-lg);
}

.podcast-content .card-body {
    padding: 2rem;
}

.podcast-generation-form .card {
    border: none;
    box-shadow: var(--shadow-md);
    border-radius: var(--border-radius-lg);
}

.podcast-button {
    background-color: transparent;
    border-color: #28a745;
    color: #28a745;
    transition: all 0.3s ease;
}

.podcast-button:hover {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

.podcast-script-textarea {
    font-family: 'Courier New', Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    min-height: 400px;
}

.podcast-script::-webkit-scrollbar {
    width: 8px;
}

.podcast-script::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.podcast-script::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.podcast-script::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===================================
   PODCAST SCRIPT EDITOR STYLES
   =================================== */

.podcast-metadata-header {
    box-shadow: var(--shadow-md);
    border: none;
}

.metadata-item {
    font-size: 0.9rem;
}

.metadata-item strong {
    font-weight: 600;
}

.podcast-script-display .dialogue-block {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    position: relative;
    border-left: 4px solid;
}

.podcast-script-display .dialogue-block:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.podcast-script-display .speaker-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.podcast-script-display .speaker-text {
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Consistent Speaker Color Scheme */
.border-left-speaker-0 { border-left-color: #3b82f6 !important; } /* Blue */
.border-left-speaker-1 { border-left-color: #10b981 !important; } /* Green */
.border-left-speaker-2 { border-left-color: #f59e0b !important; } /* Amber */
.border-left-speaker-3 { border-left-color: #8b5cf6 !important; } /* Purple */
.border-left-speaker-4 { border-left-color: #ef4444 !important; } /* Red */

.text-speaker-0 { color: #3b82f6 !important; } /* Blue */
.text-speaker-1 { color: #10b981 !important; } /* Green */
.text-speaker-2 { color: #f59e0b !important; } /* Amber */
.text-speaker-3 { color: #8b5cf6 !important; } /* Purple */
.text-speaker-4 { color: #ef4444 !important; } /* Red */

/* Speaker Badges */
.badge-speaker-0 { 
    background-color: #3b82f6; 
    color: white; 
}
.badge-speaker-1 { 
    background-color: #10b981; 
    color: white; 
}
.badge-speaker-2 { 
    background-color: #f59e0b; 
    color: white; 
}
.badge-speaker-3 { 
    background-color: #8b5cf6; 
    color: white; 
}
.badge-speaker-4 { 
    background-color: #ef4444; 
    color: white; 
}

.dialogue-edit-block {
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.dialogue-edit-block:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.dialogue-edit-block .card-header {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-bottom: 1px solid var(--border-color);
}

.dialogue-edit-block .btn-sm {
    transition: all 0.2s ease;
}

.dialogue-edit-block .btn-sm:hover {
    transform: translateY(-1px);
}

.dialogue-text {
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s ease;
}

.dialogue-text:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Animation for new blocks */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dialogue-edit-block {
    animation: slideInDown 0.3s ease-out;
}

/* ===================================
   VOICE SELECTION ENHANCEMENTS
   =================================== */

.voice-selection-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-select {
    flex: 1;
    transition: border-color 0.2s ease;
}

.voice-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.play-sample-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: white;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
}

.play-sample-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.play-sample-btn:active {
    transform: translateY(0);
}

.play-sample-btn.playing {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.play-sample-btn.playing i::before {
    content: "\f04c"; /* pause icon */
}

.voice-description {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-style: italic;
    transition: color 0.2s ease;
}

.voice-select:focus + .play-sample-btn + .voice-description,
.voice-select:hover + .play-sample-btn + .voice-description {
    color: var(--primary-color);
}

/* Tooltip for voice descriptions */
.voice-select option[data-description]:hover {
    background-color: var(--light-bg);
}

/* Custom select styling for better UX */
.voice-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23666' d='m2 0-2 2h4zm0 5 2-2h-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    padding-right: 2rem;
}

/* Audio player for samples */
.voice-sample-audio {
    display: none;
}

/* Modal enhancement for voice selection */
#createAudioModal .voice-selection-container .form-group {
    margin-bottom: 1.5rem;
}

#createAudioModal .voice-description {
    line-height: 1.4;
    padding: 0.25rem 0;
}