@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

html {
    scroll-behavior: smooth;
}

:root {
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-color: #ec4899;
    --accent-orange: #f59e0b;
    --glass: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(226, 232, 240, 0.8);
    --card-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

/* Global Responsive Resets */
img, video, iframe, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes skeleton-loading {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border: none !important;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    animation: fadeIn 0.6s ease-out;
}

/* Header */
header {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Navigation */
.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1rem;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
}

.mobile-only-nav { display: none; }

.search-container {
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 250px;
}

.search-container input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
}

.auth-btns {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-primary);
    z-index: 1100;
}

/* Dropdown Menu */
.dropdown {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%; 
}
.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: -20px; /* Slight offset */
  background-color: white;
  min-width: 220px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 10000;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  margin-top: 10px;
  animation: menuFadeIn 0.2s ease-out;
}

/* Invisible bridge to keep menu open while hovering gap */
.dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 15px;
}

.dropdown-content a {
  color: #475569 !important;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 8px;
  transition: all 0.2s;
}
.dropdown-content a:hover {
  background-color: #f0f9ff;
  color: var(--primary-color) !important;
  transform: translateX(4px);
}
.dropdown:hover .dropdown-content {
  display: block;
}
.dropdown:hover .dropbtn {
  color: var(--primary-color);
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Section */
.hero {
    padding: 5rem 5% 8rem;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.hero-content {
    flex: 1;
    max-width: 600px;
    z-index: 1;
}

.hero-tag {
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 1rem;
    display: inline-block;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw + 1rem, 3.8rem);
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #1e293b, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

.hero-image-wrap {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    position: relative;
}

.hero-image {
    width: 100%;
    max-width: 550px;
    border-radius: 2rem;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Stats Mini Cards */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: -4rem;
    margin-bottom: 6rem;
    position: relative;
    z-index: 2;
}

.stat-mini {
    background: white;
    padding: 1.5rem;
    border-radius: 1.2rem;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Categories Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 3rem;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 1rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 6rem;
}

.cat-item {
    background: white;
    padding: 2rem;
    border-radius: 1.5rem;
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.cat-item:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: var(--card-shadow);
}

.cat-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    background: #f1f5f9;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Course Cards & Blog Cards Grids */
.course-grid, .blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 6rem;
}

/* Tablet: 2 columns */
@media (max-width: 992px) {
    .course-grid, .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: 1 column */
@media (max-width: 600px) {
    .course-grid, .blog-grid {
        grid-template-columns: 1fr;
    }
}

.course-card, .blog-card {
    background: white;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border: 1px solid var(--glass-border);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.course-card:hover, .blog-card:hover {
    transform: translateY(-5px);
}

.course-img-wrap, .blog-img {
    height: 220px;
    overflow: hidden;
    position: relative;
}

.course-img, .blog-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.course-card:hover .course-img, .blog-card:hover .blog-img img {
    transform: scale(1.05);
}

.course-level {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.3rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
}

.course-body, .blog-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-instructor {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}

.inst-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.course-title, .blog-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
}

.rating {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--accent-orange);
    font-weight: 600;
}

/* Instructors Section */
.instructor-row {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding-bottom: 2rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory; /* Snap scrolling for better mobile feel */
}

.instructor-row > * {
    scroll-snap-align: start;
}

.inst-card {
    min-width: 220px;
    background: white;
    padding: 1.5rem;
    border-radius: 1.2rem;
    text-align: center;
    border: 1px solid var(--glass-border);
}

.inst-lg-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    object-fit: cover;
}

/* Partners Branding */
.partners {
    padding: 4rem 2rem;
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    opacity: 0.5;
    filter: grayscale(1);
    flex-wrap: wrap;
    gap: 2rem;
    text-align: center;
}

/* Footer Improvements */
footer {
    background: linear-gradient(to bottom, #1e293b, #000000);
    color: #f8f8f8;
    padding: 6rem 5% 3rem;
}

footer p {
    color: #f8f8f8 !important;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
    gap: 4rem;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-logo {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    display: block;
    color: white;
    text-decoration: none;
}

.footer-col h4 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: #f8f8f8;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

/* Common Buttons */
.btn {
    padding: 0.5rem .8rem;
    border-radius: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
}

.btn-ghost:hover {
    background: #f1f5f9;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 5%;
}

/* List View (Chapters/Playlists) */
.list-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.list-item:hover {
    transform: translateX(10px);
    border-color: var(--primary-color);
    box-shadow: var(--card-shadow);
}

.item-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: #cbd5e1;
    min-width: 40px;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ----------------------------------------------------
   RESPONSIVE DESIGN (Mobile & Tablet)
---------------------------------------------------- */

@media (max-width: 1024px) {
    .hero-title { font-size: 2.8rem; }
    .footer-grid { grid-template-columns: 1fr 1fr 1fr; gap: 2rem; }
    .footer-col:first-child { grid-column: 1 / -1; margin-bottom: 2rem; } /* Logo colspan */
    .footer-col:last-child { grid-column: 1 / -1; margin-top: 2rem; } /* Subscribe colspan */
}

@media (max-width: 768px) {
    /* Header & Navigation */
    .header-inner { 
        padding: 0.8rem 5%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .mobile-menu-btn {
        display: block;
        order: 2;
    }

    .nav-links {
        display: none; 
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
        border-bottom: 1px solid var(--glass-border);
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        align-items: center; /* Center items on mobile */
        text-align: center;
        z-index: 1000;
        animation: slideDown 0.3s ease-out; /* Add animation */
    }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        font-size: 1.1rem;
        width: 100%;
        display: block;
    }

    .mobile-only-nav {
        display: block !important;
        background: #e0e7ff;
        color: var(--primary-color) !important;
        padding: 12px;
        border-radius: 8px;
        font-weight: 700;
        margin-top: 10px;
    }

    .search-container {
        display: flex;
        width: 100%;
        order: 3; /* Move to bottom row on mobile */
        margin: 0.5rem 0;
    }
    
    .logo {
        order: 1;
        font-size: 1.4rem;
    }

    .auth-btns {
        display: none; 
    }

    /* Hero */
    .hero { 
        flex-direction: column;
        text-align: center; 
        padding: 3rem 5% 4rem; 
        gap: 2rem;
    }
    
    .hero-content {
        max-width: 100%;
    }
    
    .hero-image-wrap { 
        margin-top: 1rem; 
        justify-content: center;
        width: 100%;
    }
    
    .hero-image { 
        max-width: 100%; 
        width: 100%;
        height: auto;
    }

    /* Typography */
    .hero-title { 
        font-size: clamp(1.8rem, 8vw, 2.4rem); 
        line-height: 1.2;
    }
    .hero-desc { 
        font-size: 1rem; 
    }
    
    /* Stats */
    .stats-bar {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 1rem;
        margin-top: 0;
        margin-bottom: 3rem;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        text-align: left;
    }

    .footer-col {
        align-items: flex-start;
    }

    /* Global */
    .container { padding: 3rem 5%; }
    .section-header { 
        flex-direction: row; 
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center; 
        gap: 1rem; 
    }

    /* Contact Form Mobile Optimization (Tablet & Mobile) */
    #contact { padding: 4rem 2rem !important; }
    #contact .contact-card-container { 
        flex-direction: column !important; 
        border-radius: 1.5rem !important;
    }
    #contact .contact-card-container > div {
        min-width: 100% !important;
    }
    #contact .contact-card-container > div:first-child { /* Form Side */
        padding: 2.5rem 2rem !important; 
    }
    #contact .contact-card-container > div:last-child { /* Image Side */
        min-height: 300px !important;
        order: -1; /* Image on top for mobile/tablet */
    }
    
    @media (max-width: 480px) {
        .logo { font-size: 1.2rem; }
        .logo img { height: 32px; }
        .hero { padding-top: 2rem; }
        .section-header { flex-direction: column; align-items: stretch; }
        .section-header .btn { width: 100%; }

        /* Smaller Mobile Adjustments */
        #contact { padding: 3rem 1rem !important; }
        #contact .contact-card-container > div:first-child { padding: 2rem 1.5rem !important; }
        #contact .contact-card-container > div:last-child { min-height: 250px !important; }
        #contact .contact-card-container form > div { flex-direction: column; gap: 1rem; }
        #contact h2 { font-size: 2rem !important; }
    }
}

/* ====== NEW MOBILE DRAWER APP-STYLE LOGIC ====== */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.drawer-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: white;
    z-index: 2001;
    box-shadow: 4px 0 25px rgba(0,0,0,0.15);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.mobile-drawer.open {
    left: 0;
}

.drawer-header {
    background: linear-gradient(135deg, #1e293b, #6366f1);
    padding: 30px 20px 24px;
    position: relative;
    color: white;
    border-bottom-right-radius: 20px;
}
.drawer-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.drawer-close:hover {
    background: rgba(255, 255, 255, 0.3);
}
.drawer-logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}
.drawer-logo {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 12px;
    padding: 6px;
    object-fit: contain;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.drawer-title-group {
    display: flex;
    flex-direction: column;
}
.drawer-title {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.2;
}
.drawer-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2px;
    font-weight: 500;
}

.drawer-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.drawer-search {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 12px 15px;
    gap: 10px;
    margin-bottom: 5px;
    border: 1px solid transparent;
    transition: border 0.3s;
}
.drawer-search:focus-within {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.drawer-search input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.drawer-search svg {
    color: #94a3b8;
}

.drawer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.drawer-menu li a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 15px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.05rem;
    border-radius: 12px;
    transition: background 0.2s, color 0.2s;
}
.drawer-menu li a:hover {
    background: #f8fafc;
    color: var(--primary-color);
}
.drawer-menu li a svg {
    width: 22px;
    height: 22px;
    color: #64748b;
    transition: color 0.2s;
}
.drawer-menu li a:hover svg {
    color: var(--primary-color);
}

.drawer-has-submenu > a {
    justify-content: space-between;
}
.drawer-item-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.drawer-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}
.drawer-submenu.expanded {
    max-height: 200px;
}
.drawer-submenu li a {
    padding: 10px 15px 10px 52px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.drawer-submenu li a:hover {
    color: var(--primary-color);
    background: transparent;
}
.drawer-caret {
    transition: transform 0.3s;
}
.expanded .drawer-caret {
    transform: rotate(180deg);
}

.drawer-auth-btns {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}
.drawer-btn {
    text-align: center;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    font-size: 1rem;
    transition: var(--transition);
}
.drawer-btn-primary {
    background: var(--primary-color);
    color: white;
}
.drawer-btn-ghost {
    background: #f1f5f9;
    color: var(--text-primary);
}
