/* ==========================================
   MASTER STYLESHEET – AI LMS
   All styles are now controlled via CSS variables
   defined in the <head> (from admin theme settings).
   ========================================== */

/* ---------- RESET & BASE ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--theme-font, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    background-color: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--theme-primary, #6366f1);
}
a:hover {
    color: var(--theme-secondary, #a855f7);
}

/* ---------- BUTTONS ---------- */
.btn-primary {
    background-color: var(--theme-primary, #6366f1) !important;
    border-color: var(--theme-primary, #6366f1) !important;
    border-radius: var(--theme-button-radius, 50px) !important;
    padding: 0.6rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}
.btn-primary:hover {
    background-color: var(--theme-secondary, #a855f7) !important;
    border-color: var(--theme-secondary, #a855f7) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-outline-primary {
    border-color: var(--theme-primary, #6366f1) !important;
    color: var(--theme-primary, #6366f1) !important;
    border-radius: var(--theme-button-radius, 50px) !important;
    font-weight: 600;
    transition: all 0.3s ease;
}
.btn-outline-primary:hover {
    background-color: var(--theme-primary, #6366f1) !important;
    color: #fff !important;
    transform: translateY(-2px);
}

.btn-rounded {
    border-radius: var(--theme-button-radius, 50px);
}

/* ---------- NAVBAR ---------- */
.navbar {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    padding: 0.8rem 0;
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}
.navbar-brand i {
    color: var(--theme-primary, #6366f1);
}
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    transition: color 0.2s;
}
.navbar-dark .navbar-nav .nav-link:hover {
    color: #fff;
}

/* ---------- HERO CAROUSEL (GRADIENT BACKGROUND) ---------- */
.hero-section {
    background: linear-gradient(135deg, var(--hero-gradient-start, #0f172a), var(--hero-gradient-end, #1e293b));
    padding: 3rem 0 4rem;
    border-radius: 0 0 3rem 3rem;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
}
/* Subtle decorative glow */
.hero-section::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-section .carousel {
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
}

.hero-section .carousel-item {
    min-height: 340px;
    padding: 1.5rem 0;
}
.hero-section .carousel-item .row {
    align-items: center;
}

/* Text content */
.hero-section .carousel-item .text-content {
    color: #fff;
}
.hero-section .carousel-item .text-content h1 {
    font-weight: 800;
    font-size: 3rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.hero-section .carousel-item .text-content .lead {
    font-weight: 300;
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}
.hero-section .carousel-item .text-content .btn {
    background: var(--theme-primary, #6366f1);
    border: none;
    border-radius: var(--theme-button-radius, 50px);
    padding: 0.7rem 2.5rem;
    font-weight: 600;
    color: #fff;
    transition: all 0.3s;
}
.hero-section .carousel-item .text-content .btn:hover {
    background: var(--theme-secondary, #a855f7);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

/* Image */
.hero-section .carousel-item .image-wrapper img {
    max-height: 300px;
    width: 100%;
    object-fit: cover;
    border-radius: 1.2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.5s ease;
}
.hero-section .carousel-item .image-wrapper img:hover {
    transform: scale(1.02);
}

/* Carousel controls */
.hero-section .carousel-control-prev,
.hero-section .carousel-control-next {
    width: 6%;
    opacity: 0.6;
    transition: opacity 0.3s;
}
.hero-section .carousel-control-prev:hover,
.hero-section .carousel-control-next:hover {
    opacity: 1;
}
.hero-section .carousel-control-prev-icon,
.hero-section .carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    padding: 1rem;
}

.hero-section .carousel-indicators {
    bottom: -2.5rem;
}
.hero-section .carousel-indicators button {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--theme-primary, #6366f1);
    background: transparent;
    transition: all 0.3s;
}
.hero-section .carousel-indicators .active {
    background: var(--theme-primary, #6366f1);
    transform: scale(1.2);
}

/* Fallback static hero (when no slides) */
.hero-fallback {
    padding: 1.5rem 0;
}
.hero-fallback h1 {
    font-weight: 800;
    font-size: 2.8rem;
}
.hero-fallback .lead {
    font-weight: 300;
    opacity: 0.9;
}

/* ---------- STATS / FEATURES ---------- */
.stats-grid .stat-item {
    background: #fff;
    border-radius: 1.25rem;
    padding: 1.5rem 1rem;
    box-shadow: var(--theme-card-shadow, 0 2px 12px rgba(0, 0, 0, 0.04));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stats-grid .stat-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}
.stats-grid .stat-item i {
    font-size: 2.4rem;
    color: var(--theme-primary, #6366f1);
}
.stats-grid .stat-item h3 {
    font-weight: 700;
    margin: 0.5rem 0 0.2rem;
    font-size: 1.8rem;
}
.stats-grid .stat-item p {
    color: #94a3b8;
    margin: 0;
    font-weight: 500;
}

/* ---------- COURSE CARDS ---------- */
.course-card {
    background: #fff;
    border: none;
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: var(--theme-card-shadow, 0 4px 15px rgba(0, 0, 0, 0.05));
    transition: all 0.3s ease;
    height: 100%;
}
.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}
.course-card .card-img-top {
    height: 180px;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.course-card:hover .card-img-top {
    transform: scale(1.03);
}
.course-card .card-body {
    padding: 1.25rem;
}
.course-card .card-title {
    font-weight: 700;
    font-size: 1.1rem;
}
.course-card .card-text {
    color: #64748b;
    font-size: 0.95rem;
}
.course-card .meta {
    font-size: 0.85rem;
    color: #94a3b8;
}
.course-card .meta i {
    margin-right: 0.2rem;
}
.course-card .price {
    font-weight: 700;
    font-size: 1.2rem;
}
.course-card .price .old {
    color: #94a3b8;
    text-decoration: line-through;
    font-weight: 400;
    font-size: 0.95rem;
    margin-right: 0.5rem;
}
.course-card .price .discount {
    color: #ef4444;
}
.course-card .price .free {
    color: #22c55e;
}
.badge-primary-subtle {
    background: var(--theme-primary, #6366f1)20;
    color: var(--theme-primary, #6366f1);
}

/* ---------- COURSE DETAIL HERO (GRADIENT) ---------- */
.course-hero-gradient {
    background: linear-gradient(135deg, var(--hero-gradient-start, #0f172a), var(--hero-gradient-end, #1e293b));
    padding: 2.5rem 0 2rem;
    border-radius: 0 0 2.5rem 2.5rem;
    color: #fff;
    margin-bottom: 2rem;
}
.course-hero-gradient .breadcrumb {
    background: transparent;
    padding: 0;
}
.course-hero-gradient .breadcrumb-item a {
    color: #a5b4fc;
    text-decoration: none;
}
.course-hero-gradient .breadcrumb-item.active {
    color: #e2e8f0;
}
.course-hero-gradient h1 {
    font-weight: 700;
}
.course-hero-gradient .lead {
    color: #cbd5e1;
}
.course-hero-gradient .badge {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}
.course-hero-gradient .course-thumbnail {
    max-height: 180px;
    width: auto;
    border-radius: 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}
.course-hero-gradient .price-tag {
    font-size: 1.8rem;
    font-weight: 700;
}
.course-hero-gradient .price-tag .old {
    font-size: 1.2rem;
    color: #94a3b8;
    text-decoration: line-through;
    font-weight: 400;
    margin-right: 0.75rem;
}
.course-hero-gradient .price-tag .discount {
    color: #f87171;
}
.course-hero-gradient .price-tag .free {
    color: #4ade80;
}

/* ---------- CONTENT SECTIONS ---------- */
.content-section {
    background: #fff;
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: var(--theme-card-shadow, 0 2px 12px rgba(0, 0, 0, 0.04));
    margin-bottom: 1.5rem;
}
.content-section .lesson-item {
    border-bottom: 1px solid #f1f5f9;
    padding: 0.8rem 0;
}
.content-section .lesson-item:last-child {
    border-bottom: 0;
}

.detail-sidebar {
    background: #fff;
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: var(--theme-card-shadow, 0 2px 12px rgba(0, 0, 0, 0.04));
    position: sticky;
    top: 1.5rem;
}
.detail-sidebar .list-group-item {
    border: none;
    padding: 0.7rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.detail-sidebar .list-group-item:last-child {
    border-bottom: 0;
}
.detail-sidebar i {
    width: 24px;
    color: var(--theme-primary, #6366f1);
}

/* ---------- LESSON & QUIZ PAGES ---------- */
.lesson-container {
    background: #fff;
    border-radius: 1.25rem;
    padding: 2rem;
    box-shadow: var(--theme-card-shadow, 0 2px 12px rgba(0, 0, 0, 0.04));
}
.lesson-container .video-wrapper {
    border-radius: 1rem;
    overflow: hidden;
    background: #000;
}

.quiz-container .question-card {
    background: #fff;
    border-radius: 1.25rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--theme-card-shadow, 0 2px 8px rgba(0, 0, 0, 0.04));
}
.quiz-container .question-card .question-text {
    font-weight: 600;
    font-size: 1.1rem;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 992px) {
    .hero-section .carousel-item .text-content h1 {
        font-size: 2.4rem;
    }
    .hero-section .carousel-item .image-wrapper img {
        max-height: 220px;
    }
    .course-hero-gradient h1 {
        font-size: 2rem;
    }
}
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 0 3rem;
        border-radius: 0 0 2rem 2rem;
    }
    .hero-section .carousel-item {
        min-height: 280px;
        padding: 1rem 0;
    }
    .hero-section .carousel-item .text-content h1 {
        font-size: 1.8rem;
    }
    .hero-section .carousel-item .image-wrapper img {
        max-height: 160px;
    }
    .hero-fallback h1 {
        font-size: 2rem;
    }
    .course-hero-gradient {
        padding: 1.5rem 0;
        border-radius: 0 0 1.5rem 1.5rem;
    }
    .course-hero-gradient .course-thumbnail {
        max-height: 120px;
    }
    .detail-sidebar {
        position: static;
        margin-top: 1.5rem;
    }
    .course-card .card-img-top {
        height: 140px;
    }
}
@media (max-width: 576px) {
    .hero-section .carousel-item .text-content h1 {
        font-size: 1.5rem;
    }
    .hero-section .carousel-item .image-wrapper img {
        max-height: 120px;
    }
    .stats-grid .stat-item {
        padding: 1rem 0.5rem;
    }
    .stats-grid .stat-item i {
        font-size: 1.8rem;
    }
    .stats-grid .stat-item h3 {
        font-size: 1.4rem;
    }
}

/* ---------- CATEGORY CATALOG ---------- */
.category-featured-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.category-featured-card:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}
.category-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08) !important;
}
.hover-shadow:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.08) !important;
}


/* Clamp text to 2 lines */
.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-sidebar .list-group-item.active {
    background: var(--theme-primary)10;
    color: var(--theme-primary);
    border-radius: 0.5rem;
}
.detail-sidebar .list-group-item a {
    transition: color 0.2s;
}
.detail-sidebar .list-group-item a:hover {
    color: var(--theme-primary);
}

.institution-profile img { max-width: 100%; height: auto; border-radius: 1rem; }
.institution-profile h1, .institution-profile h2 { font-weight: 700; margin-top: 1.5rem; }
.institution-profile p { color: #475569; line-height: 1.8; }