:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: #f8f9fa;
}

/* Desktop Layout Improvements */
@media (min-width: 992px) {
    .main-content {
        padding: 2rem;
    }
    
    .page-header {
        margin-bottom: 3rem;
        padding-bottom: 1.5rem;
        border-bottom: 2px solid #e9ecef;
    }
    
    .content-section {
        margin-bottom: 3rem;
    }
    
    .row.g-4 > * {
        padding: 1rem;
    }
    
    .section-title {
        font-size: 2.5rem;
        font-weight: 700;
        margin-bottom: 1rem;
        color: var(--dark-color);
    }
    
    .section-subtitle {
        font-size: 1.2rem;
        color: var(--secondary-color);
        margin-bottom: 2rem;
    }
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    min-height: 500px;
    display: flex;
    align-items: center;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
}

/* Feature Icons */
.feature-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Cards */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

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

/* Desktop Card Improvements */
@media (min-width: 992px) {
    .card {
        height: 100%;
    }
    
    .card-body {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .module-card .card-body {
        min-height: 280px;
    }
    
    .feature-card .card-body {
        min-height: 250px;
        text-align: center;
    }
}

/* Navigation */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* Stats */
.stat-item h3 {
    font-size: 3rem;
}

/* Forms */
.form-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Video Player */
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
}

/* Quiz Styles */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.question-card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.option-btn {
    width: 100%;
    text-align: left;
    margin-bottom: 0.5rem;
    border: 2px solid #e9ecef;
    background: white;
    color: #333;
    transition: all 0.3s ease;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.option-btn.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.option-btn.correct {
    border-color: var(--success-color);
    background: var(--success-color);
    color: white;
}

.option-btn.incorrect {
    border-color: var(--danger-color);
    background: var(--danger-color);
    color: white;
}

/* Forum Styles */
.forum-post {
    border-left: 4px solid var(--primary-color);
    background: #f8f9fa;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 10px 10px 0;
}

.forum-reply {
    margin-left: 2rem;
    border-left: 2px solid #dee2e6;
    padding-left: 1rem;
}

/* Certificate Styles */
.certificate {
    border: 10px solid #gold;
    background: linear-gradient(45deg, #fff, #f9f9f9);
    padding: 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.certificate::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,215,0,0.1) 10px,
        rgba(255,215,0,0.1) 20px
    );
    z-index: -1;
}

/* Module Styles */
.module-card {
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

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

.module-progress {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.module-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #20c997);
    transition: width 0.3s ease;
}

/* Admin Layout */
.admin-sidebar {
    width: 250px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.admin-content {
    margin-left: 250px;
    min-height: 100vh;
    padding: 0;
}

.mobile-menu-toggle {
    display: none;
}

/* Desktop Optimizations */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    .hero-section {
        min-height: 600px;
        padding: 4rem 0;
    }
    
    .display-4 {
        font-size: 3.5rem;
        line-height: 1.2;
    }
    
    .lead {
        font-size: 1.4rem;
        line-height: 1.6;
    }
    
    .feature-icon {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }
    
    .card {
        margin-bottom: 2rem;
    }
    
    .module-card {
        margin-bottom: 1.5rem;
        min-height: 350px;
    }
    
    .stat-item h3 {
        font-size: 4rem;
    }
    
    .form-container {
        max-width: 500px;
        padding: 3rem;
    }
    
    .quiz-container {
        max-width: 900px;
    }
    
    .certificate {
        padding: 4rem;
        max-width: 800px;
        margin: 0 auto;
    }
    
    .btn {
        padding: 0.75rem 2rem;
        font-size: 1rem;
    }
    
    .btn-lg {
        padding: 1rem 2.5rem;
        font-size: 1.2rem;
    }
    
    .card-body {
        padding: 2rem;
    }
    
    .p-4 {
        padding: 2.5rem !important;
    }
    
    .p-5 {
        padding: 3.5rem !important;
    }
    
    .mb-4 {
        margin-bottom: 2.5rem !important;
    }
    
    .mb-5 {
        margin-bottom: 3.5rem !important;
    }
    
    .section-spacing {
        padding: 5rem 0;
    }
    
    .navbar-brand {
        font-size: 1.8rem;
    }
    
    .table {
        font-size: 1rem;
    }
    
    .table th,
    .table td {
        padding: 1rem;
    }
    
    .modal-lg {
        max-width: 900px;
    }
    
    .modal-xl {
        max-width: 1200px;
    }
}

/* Extra Large Desktop */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-section {
        min-height: 700px;
        padding: 5rem 0;
    }
    
    .display-4 {
        font-size: 4rem;
    }
    
    .lead {
        font-size: 1.5rem;
    }
    
    .feature-icon {
        width: 120px;
        height: 120px;
        font-size: 3rem;
    }
    
    .module-card {
        margin-bottom: 1.5rem;
        min-height: 400px;
    }
    
    .stat-item h3 {
        font-size: 5rem;
    }
    
    .form-container {
        max-width: 600px;
        padding: 4rem;
    }
    
    .btn {
        padding: 0.75rem 2rem;
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 2.5rem;
    }
    
    .section-spacing {
        padding: 6rem 0;
    }
    
    /* Enhanced spacing for ultra-wide screens */
    .main-content {
        padding: 2rem 3rem;
    }
    
    .page-header {
        padding: 2rem 0;
        margin-bottom: 3rem;
    }
    
    .content-section {
        margin-bottom: 3rem;
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        width: 250px;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s ease;
    }
    
    .admin-sidebar.show {
        left: 0;
    }
    
    .admin-content {
        margin-left: 0;
        width: 100%;
    }
    
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1051;
        background: var(--primary-color);
        color: white;
        border: none;
        padding: 10px;
        border-radius: 5px;
    }
}

@media (max-width: 992px) {
    .hero-section {
        min-height: 400px;
        text-align: center;
        padding: 2rem 0;
    }
    
    .display-4 {
        font-size: 2.5rem;
    }
    
    .lead {
        font-size: 1.1rem;
    }
    
    .stat-item h3 {
        font-size: 2.5rem;
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .card {
        margin-bottom: 1.5rem;
    }
    
    .module-card {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 768px) {
    .hero-section {
        min-height: 350px;
        padding: 1.5rem 0;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .stat-item h3 {
        font-size: 2rem;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .forum-reply {
        margin-left: 1rem;
    }
    
    .certificate {
        padding: 2rem 1rem;
    }
    
    .form-container {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .quiz-container {
        padding: 0 1rem;
    }
    
    .question-card {
        margin-bottom: 1.5rem;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .p-4 {
        padding: 1.5rem !important;
    }
    
    .p-5 {
        padding: 2rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    .mb-5 {
        margin-bottom: 2rem !important;
    }
}

@media (max-width: 576px) {
    .hero-section {
        min-height: 300px;
        padding: 1rem 0;
    }
    
    .display-4 {
        font-size: 1.8rem;
    }
    
    .lead {
        font-size: 0.95rem;
    }
    
    .stat-item h3 {
        font-size: 1.8rem;
    }
    
    .feature-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .certificate {
        padding: 1.5rem 0.5rem;
        border-width: 5px;
    }
    
    .form-container {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        border-radius: 20px;
    }
    
    .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .card-body {
        padding: 0.8rem;
    }
    
    .p-4 {
        padding: 1rem !important;
    }
    
    .p-5 {
        padding: 1.5rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .mb-5 {
        margin-bottom: 1.5rem !important;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.6rem;
    }
    
    h3 {
        font-size: 1.4rem;
    }
    
    h4 {
        font-size: 1.2rem;
    }
    
    h5 {
        font-size: 1.1rem;
    }
    
    .text-center {
        text-align: center !important;
    }
    
    .d-flex {
        flex-wrap: wrap;
    }
    
    .justify-content-between {
        justify-content: center !important;
        gap: 1rem;
    }
    
    .col-auto {
        width: 100%;
        text-align: center;
        margin-bottom: 1rem;
    }
}

/* Mobile Navigation Styles */
.mobile-menu-toggle {
    display: none;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1049;
}

.mobile-overlay.show {
    display: block;
}

/* Improved Card Styles for Mobile */
@media (max-width: 768px) {
    .card {
        border-radius: 15px;
        box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    }
    
    .card-header {
        border-radius: 15px 15px 0 0 !important;
        padding: 1rem;
    }
    
    .list-group-item {
        padding: 0.8rem 1rem;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
}

/* Improved Form Styles for Mobile */
@media (max-width: 768px) {
    .form-control {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .form-label {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .input-group {
        margin-bottom: 1rem;
    }
    
    .form-select {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* Improved Table Styles for Mobile */
@media (max-width: 768px) {
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        vertical-align: middle;
    }
    
    .table-responsive {
        border-radius: 10px;
    }
}

/* Touch-friendly Interactive Elements */
@media (max-width: 768px) {
    .btn,
    .form-control,
    .form-select,
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav-link {
        justify-content: flex-start;
        padding: 0.8rem 1rem;
    }
    
    .dropdown-item {
        padding: 0.6rem 1rem;
        min-height: 40px;
        display: flex;
        align-items: center;
    }
}

/* Utility Classes for Mobile */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-center {
        text-align: center !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-mb-3 {
        margin-bottom: 1rem !important;
    }
    
    .mobile-p-2 {
        padding: 0.5rem !important;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Alert Styles */
.alert {
    border: none;
    border-radius: 10px;
}

/* Button Styles */
.btn {
    border-radius: 25px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Table Styles */
.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.table thead th {
    background: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
}

/* Progress Bar */
.progress {
    height: 10px;
    border-radius: 5px;
    background: #e9ecef;
}

.progress-bar {
    border-radius: 5px;
    transition: width 0.6s ease;
}

.chapter-nav { 
    padding: 1.25rem; 
}

.epub-reader { 
    padding: 1.5rem; 
}

@media (max-width: 992px) { 
    .progress-tracker { 
        position: static; 
        margin-top: 2rem; 
    } 
}