:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --light-bg: #f8f9fa;
    --dark-text: #212529;

    /* Educational Typography System (Phase 3) */
    --font-base: clamp(16px, 1.2vw, 18px);

    --h1: clamp(26px, 3.2vw, 46px);
    --h2: clamp(22px, 2.6vw, 34px);
    --h3: clamp(19px, 2.1vw, 26px);
    --h4: clamp(17px, 1.7vw, 21px);
    --h5: clamp(16px, 1.4vw, 19px);
    --h6: clamp(14px, 1.2vw, 16px);

    --ui: clamp(13px, 1vw, 14px);
    --small: clamp(12px, 0.9vw, 13px);
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-text);
    font-size: var(--font-base);
    line-height: 1.8;
}

h1 {
    font-size: var(--h1);
    line-height: 1.15;
}

h2 {
    font-size: var(--h2);
    line-height: 1.2;
}

h3 {
    font-size: var(--h3);
    line-height: 1.25;
}

h4 {
    font-size: var(--h4);
    line-height: 1.3;
}

h5 {
    font-size: var(--h5);
    line-height: 1.35;
}

h6 {
    font-size: var(--h6);
    line-height: 1.4;
}

.navbar,
.sidebar,
.breadcrumb,
.meta,
.badge,
.form-text {
    font-size: var(--ui);
}

small,
.small,
.text-muted {
    font-size: var(--small);
}

.navbar-dark.bg-primary {
    background-color: var(--primary-color) !important;
    background: linear-gradient(90deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

/* Navbar Text Enhancement */
.navbar-dark .navbar-brand {
    color: #ffffff !important;
    font-weight: 700;
    font-size: 1.3rem;
}

.navbar-dark .nav-link {
    color: #ffffff !important;
    font-weight: 600;
    padding: 0.5rem 1rem !important;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.navbar-dark .nav-link:hover,
.navbar-dark .nav-link:focus {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

.navbar-dark .nav-link.active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

.navbar-dark .dropdown-toggle::after {
    opacity: 0.8;
}

/* ===================================
   UNIFIED CARD STYLES
   =================================== */
.card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden;
}

.card:hover {
    /* Hover effect disabled */
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Card that should not have hover effect */
.card.no-hover:hover {
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.card-body {
    padding: 1.5rem;
}

.card-header {
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.card-footer {
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
}

.card-title {
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    line-height: 1.4;
}

.card-text {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Course Card Specific Styles */
.course-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.course-card:hover {
    /* Hover effect disabled */
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.course-badges {
    padding: 20px 20px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.course-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.course-title {
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 12px;
    font-size: 1.15rem;
    line-height: 1.4;
}

.course-description {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: auto;
}

.meta-item {
    color: #868e96;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item i {
    color: var(--primary-color);
}

.course-footer {
    padding: 15px 20px 20px;
    margin-top: auto;
}

.course-footer .btn {
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.course-footer .btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.4);
}

/* Unified Badge Styles */
.badge-free {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-premium {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #000;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-category {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Stats Cards */
.stats-badge {
    padding: 15px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    min-width: 200px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.stats-badge:hover {
    transform: scale(1.05);
}

.stats-total {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(67, 97, 238, 0.3);
}

.stats-free {
    background: rgba(40, 167, 69, 0.9);
    color: white;
}

.stats-premium {
    background: rgba(255, 193, 7, 0.9);
    color: #000;
}

/* Form Controls Enhancement */
.form-control-lg,
.form-select-lg {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control-lg:focus,
.form-select-lg:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

/* Filters Section */
.filters-section {
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
}

/* No Results */
.no-results-icon {
    opacity: 0.5;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* ===================================
   UNIFIED HERO SECTIONS
   =================================== */
.hero-section,
.courses-hero-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    padding: 80px 0;
    color: var(--dark-text);
    position: relative;
    overflow: hidden;
}

.hero-section::before,
.courses-hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.02'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.hero-section h1,
.courses-hero-section h1 {
    color: var(--primary-color);
    text-shadow: none;
    position: relative;
}

.hero-section .lead,
.courses-hero-section .lead {
    color: #6c757d !important;
    position: relative;
}

.hero-section .btn-light,
.hero-section .btn-primary {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
}

.hero-section .btn-light:hover,
.hero-section .btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.3);
}

.hero-section .btn-outline-light,
.hero-section .btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    font-weight: 600;
    transition: all 0.3s ease;
}

.hero-section .btn-outline-light:hover,
.hero-section .btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.hero-buttons {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Responsive Hero */
@media (max-width: 768px) {

    .hero-section,
    .courses-hero-section {
        padding: 50px 0;
    }

    .hero-section h1,
    .courses-hero-section h1 {
        font-size: 1.8rem;
    }

    .hero-buttons .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

.section-title {
    font-weight: 700;
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    margin-top: 10px;
    border-radius: 2px;
}

.login-card {
    max-width: 450px;
    margin: 50px auto;
    padding: 2rem;
}

.dashboard-stats .card {
    border-right: 5px solid var(--primary-color);
    border-left: none;
}

/* Lesson Accordion */
.accordion-item {
    border: none !important;
    margin-bottom: 1rem;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.accordion-button {
    border-radius: 12px !important;
    font-weight: 600;
    padding: 1rem 1.25rem;
    transition: all 0.3s ease;
}

.accordion-button:not(.collapsed) {
    background-color: #f8f9fa;
    color: var(--primary-color);
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: rgba(0, 0, 0, .125);
}

.accordion-body {
    padding: 1.5rem;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Note Item Styles */
.note-item {
    transition: all 0.3s ease;
    border-right: 3px solid #ffc107;
}

.note-item:hover {
    background-color: #fff3cd !important;
}

/* ===================================
   LESSON SIDEBAR ICONS ENHANCEMENT
   =================================== */
/* Default lesson icon (not started) */
.list-group-item .fa-circle {
    color: #cbd5e1 !important;
    font-size: 0.65rem;
    transition: all 0.3s ease;
}

.list-group-item:hover .fa-circle {
    color: var(--primary-color) !important;
    transform: scale(1.2);
}

/* Playing lesson icon */
.list-group-item.active .fa-play-circle {
    color: #fbbf24 !important;
    animation: pulse-play 2s ease-in-out infinite;
    font-size: 0.85rem;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
}

@keyframes pulse-play {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* Completed lesson icon */
.list-group-item .fa-check-circle.text-success {
    color: #10b981 !important;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.3));
}

.list-group-item:hover .fa-check-circle.text-success {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 3px 8px rgba(16, 185, 129, 0.5));
}

/* Mobile offcanvas icons */
.offcanvas .fa-circle {
    color: #cbd5e1 !important;
    font-size: 0.65rem;
    transition: all 0.3s ease;
}

.offcanvas .list-group-item:hover .fa-circle {
    color: var(--primary-color) !important;
    transform: scale(1.2);
}

.offcanvas .list-group-item.active .fa-play-circle {
    color: #fbbf24 !important;
    animation: pulse-play 2s ease-in-out infinite;
    font-size: 0.85rem;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
}

.offcanvas .fa-check-circle.text-success {
    color: #10b981 !important;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.3));
}

.offcanvas .list-group-item:hover .fa-check-circle.text-success {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 3px 8px rgba(16, 185, 129, 0.5));
}

@media (max-width: 768px) {
    .container.py-4 {
        padding-top: 0.5rem !important;
    }
}

/* Admin Sidebar Responsive Height */
.admin-sidebar {
    min-height: auto;
}

@media (min-width: 768px) {
    .admin-sidebar {
        min-height: calc(100vh - 56px);
    }
}

/* ===================================
   COURSE PROGRESS BAR STYLES
   =================================== */
.course-progress .progress {
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.course-progress .progress-bar.bg-warning {
    background: #fb912b !important;
}

.course-progress .progress-bar.bg-success {
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%) !important;
}

.course-progress .text-warning {
    color: #fb912b !important;
}

/* ===================================
   PAGINATION STYLES - LIGHT MODE
   =================================== */
.pagination {
    gap: 4px;
}

.pagination .page-item .page-link {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    color: var(--primary-color);
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.pagination .page-item .page-link:hover {
    background-color: var(--primary-color, #4361ee);
    border-color: var(--primary-color, #4361ee);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.3);
}

.pagination .page-item .page-link:focus {
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
    outline: none;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color, #4361ee);
    border-color: var(--primary-color, #4361ee);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.35);
}

.pagination .page-item.disabled .page-link {
    background-color: #f8f9fa;
    border-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Responsive pagination */
@media (max-width: 576px) {
    .pagination .page-link {
        padding: 0.4rem 0.65rem;
        font-size: 0.85rem;
        min-width: 36px;
    }

    .pagination-lg {
        font-size: 1rem;
    }
}

/* ===================================
   LESSON PAGE RESPONSIVE TABS
   =================================== */
@media (max-width: 767.98px) {

    /* Grid Layout for stacking */
    .lesson-tabs-section .nav-tabs {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        border-bottom: 0 !important;
        padding: 0.25rem;
    }

    /* Reset individual items */
    .lesson-tabs-section .nav-tabs .nav-item {
        width: 100% !important;
        margin: 0 !important;
    }

    /* Card-like styling for links */
    .lesson-tabs-section .nav-tabs .nav-link {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 0.75rem 1rem;
        background-color: #fff;
        border: 1px solid #e9ecef !important;
        border-radius: 0.5rem !important;
        color: #495057;
        font-weight: 500;
        text-align: right;
        /* Adjust based on direction (RTL) */
        transition: all 0.2s ease-in-out;
    }

    /* Active styling */
    .lesson-tabs-section .nav-tabs .nav-link.active {
        background-color: #f8f9fa !important;
        border: 1px solid var(--primary-color) !important;
        border-right: 5px solid var(--primary-color) !important;
        color: var(--primary-color) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        font-weight: 600;
    }

    /* Badge alignment (Push to left) */
    .lesson-tabs-section .nav-tabs .nav-link .badge {
        margin-right: auto !important;
        margin-left: 0 !important;
    }

    /* Icon spacing */
    .lesson-tabs-section .nav-tabs .nav-link i {
        margin-left: 0.75rem !important;
        width: 1.25rem;
        text-align: center;
    }
}

/* Phase 5: Mobile Spacing (Mandatory) */
@media (max-width: 576px) {

    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .row {
        --bs-gutter-x: 0.75rem;
    }

    .card {
        padding: 0.75rem !important;
    }

    section {
        margin-bottom: 1.25rem;
    }
}

/* ===================================
   DESKTOP TYPOGRAPHY ENHANCEMENTS
   For larger screens (desktop and tablets)
   =================================== */
@media (min-width: 769px) {

    /* Better line heights for desktop reading */
    body {
        line-height: 1.7;
    }

    h1,
    .h1 {
        line-height: 1.25;
    }

    h2,
    .h2 {
        line-height: 1.3;
    }

    h3,
    .h3 {
        line-height: 1.35;
    }

    p {
        line-height: 1.75;
        margin-bottom: 1.25rem;
    }

    .lead {
        font-size: 1.2rem;
        line-height: 1.8;
    }
}

/* ===================================
   LARGE DESKTOP TYPOGRAPHY
   For screens 1200px and above
   =================================== */
@media (min-width: 1200px) {

    /* Slightly larger base font for large screens */
    body {
        font-size: 17px;
    }

    h1,
    .h1 {
        font-size: 2.75rem;
    }

    h2,
    .h2 {
        font-size: 2.25rem;
    }

    h3,
    .h3 {
        font-size: 1.85rem;
    }

    .card-title,
    .course-title {
        font-size: 1.2rem;
    }

    .card-text,
    .course-description {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2.5rem;
    }

    .lead {
        font-size: 1.3rem;
    }
}

/* ============================================
   PRICING PAGE STYLES
   ============================================ */

/* Pricing Description Color - Blue in Light Mode, Orange in Dark Mode */
.text-pricing-desc {
    color: #0d6efd;
    /* Bootstrap primary blue */
}

[data-bs-theme="dark"] .text-pricing-desc {
    color: #fd7e14;
    /* Bootstrap orange */
}

/* Best Value Badge - Keep same yellow color in both light and dark modes */
.bg-warning.text-dark {
    background-color: #ffc107 !important;
    color: #000 !important;
}

[data-bs-theme="dark"] .bg-warning.text-dark,
[data-bs-theme="dark"] .position-absolute.bg-warning.text-dark {
    background-color: #ffc107 !important;
    color: #000 !important;
    --bs-bg-opacity: 1;
}

/* ============================================
   STICKY NAVBAR STYLES
   ============================================ */

/* Make top bar sticky along with navbar */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 1040;
    transition: all 0.3s ease;
}

/* Sticky navbar enhancements */
.navbar.sticky-top {
    position: sticky;
    top: 40px;
    /* Offset by the height of top bar (adjust if needed) */
    z-index: 1030;
    transition: all 0.3s ease, box-shadow 0.3s ease;
}

/* Enhanced shadow when scrolling */
.navbar.sticky-top.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

/* Dark mode sticky navbar */
[data-bs-theme="dark"] .navbar.sticky-top {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .navbar.sticky-top.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

/* Ensure navbar stays on top of content */
.navbar.sticky-top {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Mobile adjustments */
@media (max-width: 991.98px) {
    .navbar.sticky-top {
        top: 40px;
        /* Adjust for mobile top bar height */
    }

    /* Fixed: Added spacing between logo row and collapsible menu */
    .navbar-collapse {
        margin-top: 15px;
        padding-bottom: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 15px;
    }

    .nav-item .nav-link {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
}

@media (max-width: 768px) {
    .navbar.sticky-top {
        top: 40px;
    }
}