/* ============================================
   COVASOL ACADEMY - Premium EdTech Platform
   Style: Academic & Artistic (MasterClass Inspired)
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    /* Colors */
    --color-bg: #F5F5F0;
    --color-bg-dark: #1A1A1A;
    --color-text: #1A1A1A;
    --color-text-light: #F5F5F0;
    --color-accent: #C2410C;
    --color-accent-hover: #9A3308;
    --color-grey: #6B6B6B;
    --color-grey-light: #E5E5E0;
    
    /* Typography */
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 6rem;
    --space-2xl: 8rem;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-full: 50%;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    overflow-x: hidden;
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-grey-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-grey);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-grey-light) var(--color-bg);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

p {
    font-size: 1rem;
    color: var(--color-grey);
    max-width: 65ch;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul {
    list-style: none;
}

/* ---------- Container ---------- */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.container-wide {
    max-width: 1600px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 1rem 2rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--color-text);
    color: var(--color-text);
}

.btn-outline:hover {
    background: var(--color-text);
    color: var(--color-text-light);
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-text-light);
    border: none;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(194, 65, 12, 0.3);
}

.btn-play {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    cursor: pointer;
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-play:hover {
    transform: scale(1.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.btn-play svg {
    width: 24px;
    height: 24px;
    margin-left: 4px;
}

/* ---------- Header ---------- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--space-md) 0;
    transition: var(--transition-base);
}

.header.scrolled {
    background: rgba(245, 245, 240, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    font-style: italic;
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--color-accent);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-text);
    transition: var(--transition-base);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-cta {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--color-text);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.nav-cta:hover {
    background: var(--color-text);
    color: var(--color-text-light);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.menu-toggle span {
    width: 24px;
    height: 1.5px;
    background: var(--color-text);
    transition: var(--transition-base);
}

/* ---------- Hero Section (Index) ---------- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 100px;
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    align-items: center;
}

.hero-content {
    padding-right: var(--space-lg);
}

.hero-subtitle {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: var(--space-md);
}

.hero-title {
    margin-bottom: var(--space-md);
}

.hero-quote {
    font-family: var(--font-heading);
    font-size: clamp(1.25rem, 2vw, 1.5rem);
    font-style: italic;
    color: var(--color-grey);
    margin-bottom: var(--space-lg);
    padding-left: var(--space-md);
    border-left: 2px solid var(--color-accent);
}

.hero-image {
    position: relative;
    height: 85vh;
    max-height: 800px;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.hero-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, 
        rgba(245, 245, 240, 0.3) 0%, 
        transparent 30%,
        transparent 70%,
        rgba(245, 245, 240, 0.5) 100%
    );
    z-index: 1;
}

/* ---------- Featured Courses Section ---------- */
.section {
    padding: var(--space-2xl) 0;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.section-title {
    position: relative;
}

.section-subtitle {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-grey);
    margin-bottom: var(--space-xs);
}

/* Horizontal Scroll Snap */
.courses-scroll {
    display: flex;
    gap: var(--space-md);
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    scroll-padding: var(--space-md);
    padding: var(--space-sm) 0 var(--space-lg);
    margin: 0 calc(-1 * var(--space-md));
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto; /* Cho phép scroll dọc bình thường */
    pointer-events: auto; /* Đảm bảo pointer events hoạt động */
}

.courses-scroll::-webkit-scrollbar {
    height: 4px;
}

.courses-scroll::-webkit-scrollbar-thumb {
    background: var(--color-accent);
}

/* Course Card - Magazine Style */
.course-card {
    flex: 0 0 380px;
    scroll-snap-align: start;
    position: relative;
    aspect-ratio: 3/4;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    pointer-events: auto; /* Đảm bảo pointer events hoạt động */
    transition: var(--transition-base);
}

.course-card-image {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.course-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.course-card:hover .course-card-image img {
    transform: scale(1.05);
    filter: sepia(0.2);
}

.course-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, 
        transparent 0%, 
        transparent 40%,
        rgba(26, 26, 26, 0.9) 100%
    );
    z-index: 1;
}

.course-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-md);
    z-index: 2;
    color: var(--color-text-light);
}

.course-card-category {
    font-size: 0.625rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: var(--space-xs);
}

.course-card-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--color-text-light);
}

.course-card-instructor {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* ---------- Why Us Section ---------- */
.why-us {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
}

.why-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
}

.why-item {
    text-align: center;
    padding: var(--space-lg);
}

.why-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-md);
    stroke: var(--color-accent);
    stroke-width: 1;
    fill: none;
}

.why-title {
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
    color: var(--color-text-light);
}

.why-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 30ch;
    margin: 0 auto;
}

/* ---------- Footer ---------- */
.footer {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
    padding: var(--space-xl) 0 var(--space-md);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.footer-brand .logo {
    color: var(--color-text-light);
    margin-bottom: var(--space-sm);
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

.footer-heading {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: var(--space-md);
    color: rgba(255, 255, 255, 0.5);
}

.footer-links li {
    margin-bottom: var(--space-xs);
}

.footer-links a {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.footer-links a:hover {
    color: var(--color-accent);
}

.footer-bottom {
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.footer-copyright {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.8;
}

.footer-copyright a {
    color: var(--color-accent);
}

.footer-copyright a:hover {
    text-decoration: underline;
}

/* ============================================
   COURSE DETAIL PAGE
   ============================================ */

/* ---------- Video Hero Banner ---------- */
.video-hero {
    position: relative;
    height: 80vh;
    min-height: 600px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.video-hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.video-hero-bg video,
.video-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.5) blur(2px);
}

.video-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, 
        rgba(26, 26, 26, 0.3) 0%,
        rgba(26, 26, 26, 0.7) 100%
    );
    z-index: 1;
}

.video-hero-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.video-hero-content {
    position: relative;
    z-index: 2;
    padding: var(--space-xl) 0;
    width: 100%;
}

.video-hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--color-text-light);
    margin-bottom: var(--space-sm);
    max-width: 700px;
}

.video-hero-instructor {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: rgba(255, 255, 255, 0.8);
}

.video-hero-instructor img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* ---------- Course Detail Layout ---------- */
.course-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-xl);
    padding: var(--space-xl) 0;
}

.course-main {
    min-width: 0;
}

/* ---------- Syllabus Timeline ---------- */
.syllabus {
    margin-bottom: var(--space-xl);
}

.syllabus-title {
    margin-bottom: var(--space-lg);
}

.timeline {
    position: relative;
    padding-left: var(--space-lg);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-grey-light);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-md);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: calc(-1 * var(--space-lg));
    top: 0;
    width: 16px;
    height: 16px;
    background: var(--color-bg);
    border: 2px solid var(--color-grey-light);
    border-radius: var(--radius-full);
    transform: translateX(-7px);
    transition: var(--transition-base);
    cursor: pointer;
}

.timeline-item.active .timeline-marker,
.timeline-item:hover .timeline-marker {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.timeline-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    cursor: pointer;
    transition: var(--transition-base);
}

.timeline-header:hover {
    color: var(--color-accent);
}

.timeline-chapter {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-grey);
    margin-bottom: var(--space-xs);
}

.timeline-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.timeline-duration {
    font-size: 0.875rem;
    color: var(--color-grey);
    white-space: nowrap;
}

.timeline-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
}

.timeline-item.active .timeline-toggle {
    transform: rotate(180deg);
}

.timeline-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
}

.timeline-item.active .timeline-content {
    max-height: 500px;
    padding: var(--space-sm) 0 var(--space-md);
}

.timeline-lessons {
    padding-left: var(--space-md);
}

.timeline-lesson {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    font-size: 0.9rem;
    color: var(--color-grey);
}

.timeline-lesson svg {
    width: 16px;
    height: 16px;
    stroke: var(--color-grey);
}

/* ---------- Instructor Bio ---------- */
.instructor-bio {
    background: var(--color-bg);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-grey-light);
}

.instructor-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.instructor-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.instructor-info h4 {
    margin-bottom: var(--space-xs);
}

.instructor-signature {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.25rem;
    color: var(--color-grey);
}

.instructor-text {
    font-size: 0.95rem;
    line-height: 1.8;
}

/* ---------- Pricing Card (Sticky) ---------- */
.pricing-sidebar {
    height: fit-content;
    position: sticky;
    top: 120px;
}

.pricing-card {
    background: var(--color-text);
    color: var(--color-text-light);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.pricing-label {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: var(--space-xs);
}

.pricing-amount {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.pricing-features {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pricing-feature {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--space-sm);
}

.pricing-feature svg {
    width: 16px;
    height: 16px;
    stroke: var(--color-accent);
}

.pricing-card .btn-primary {
    width: 100%;
    padding: 1.25rem;
    font-size: 0.875rem;
}

.pricing-guarantee {
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: var(--space-sm);
}

/* ---------- Video Modal ---------- */
.video-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
}

.video-modal.active {
    opacity: 1;
    visibility: visible;
}

.video-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

.video-modal-content {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 1200px;
    aspect-ratio: 16/9;
    transform: scale(0.9);
    transition: var(--transition-base);
}

.video-modal.active .video-modal-content {
    transform: scale(1);
}

.video-modal-content iframe,
.video-modal-content video {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-md);
}

.video-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 2rem;
    opacity: 0.7;
    transition: var(--transition-fast);
}

.video-modal-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* ---------- Animations ---------- */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }

/* ---------- Mobile Responsive ---------- */
@media (max-width: 1024px) {
    .course-layout {
        grid-template-columns: 1fr;
    }
    
    .pricing-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        padding: var(--space-sm);
        background: var(--color-bg);
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    }
    
    .pricing-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-md);
        gap: var(--space-md);
    }
    
    .pricing-features,
    .pricing-guarantee {
        display: none;
    }
    
    .pricing-card .btn-primary {
        width: auto;
        white-space: nowrap;
    }
    
    .course-main {
        padding-bottom: 120px;
    }
}

@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .hero-content {
        padding-right: 0;
        text-align: center;
        order: 2;
    }
    
    .hero-quote {
        border-left: none;
        padding-left: 0;
        border-top: 2px solid var(--color-accent);
        padding-top: var(--space-md);
    }
    
    .hero-image {
        height: 50vh;
        order: 1;
    }
    
    .why-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --space-lg: 3rem;
        --space-xl: 4rem;
        --space-2xl: 5rem;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        background: var(--color-bg);
        flex-direction: column;
        justify-content: center;
        gap: var(--space-md);
        padding: var(--space-lg);
        transition: var(--transition-base);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .menu-toggle {
        display: flex;
        z-index: 1001;
    }
    
    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
    
    .course-card {
        flex: 0 0 300px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero {
        min-height: auto;
        padding-top: 80px;
        padding-bottom: var(--space-lg);
    }
    
    .hero-image {
        height: 40vh;
    }
    
    .btn {
        width: 100%;
    }
    
    .course-card {
        flex: 0 0 280px;
    }
}

/* ---------- Utility Classes ---------- */
.text-center { text-align: center; }
.text-accent { color: var(--color-accent); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
