/* 
   Udemy Clone Design System 
   Based on Udemy's visual identity as of 2024
*/

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Merriweather:wght@300;400;700&family=Inter:wght@400;500;700;900&family=Outfit:wght@400;700;800&display=swap');

:root {
  /* Colors */
  --color-primary: #A78BFA;
  --color-primary-hover: #8B5CF6;
  --color-black: #2E1065;
  --color-black-hover: #C4B5FD;
  --color-white: #F5F3FF;
  --color-gray-100: #EDE9FE;
  /* Backgrounds */
  --color-surface: #EDE9FE;
  --color-surface-alt: #F5F3FF;
  --color-gray-200: #8B5CF6;
  /* Borders */
  --color-border: #8B5CF6;
  --color-gray-300: #8B5CF6;
  /* Borders strong */
  --color-gray-400: #C4B5FD;
  --color-gray-500: #C4B5FD;
  /* Secondary Text */
  --color-text-secondary: #C4B5FD;
  --color-gray-700: #2E1065;
  /* Primary Text */
  --color-text-main: #2E1065;

  --color-orange-rating: #A78BFA;
  --color-brown-rating-text: #C4B5FD;

  /* Spacing */
  --spacing-xs: 0.4rem;
  --spacing-sm: 0.8rem;
  --spacing-md: 1.6rem;
  --spacing-lg: 2.4rem;
  --spacing-xl: 3.2rem;
  --spacing-xxl: 6.4rem;

  /* Layout */
  --navbar-height: 72px;
  --container-width: 1340px;
}

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

html {
  font-size: 62.5%;
  /* 1rem = 10px */
}

body {
  font-family: 'Inter', sans-serif;
  /* Udemy primary font (approx) */
  font-size: 1.6rem;
  /* 16px */
  line-height: 1.4;
  color: var(--color-black);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: var(--color-primary);
  font-weight: 700;
}

a:hover {
  color: var(--color-primary-hover);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Merriweather', serif;
  /* Udemy heading font (approx) */
  font-weight: 700;
  color: var(--color-black);
  margin-bottom: var(--spacing-sm);
}

h1 {
  font-size: 3.2rem;
  letter-spacing: -0.05rem;
}

h2 {
  font-size: 2.4rem;
  letter-spacing: -0.02rem;
}

h3 {
  font-size: 1.9rem;
  font-family: 'Roboto', sans-serif;
  /* Card titles are Sans */
}

/* Utilities */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 2.4rem;
}

.text-bold {
  font-weight: 700;
}

.text-sm {
  font-size: 1.4rem;
}

.text-xs {
  font-size: 1.2rem;
}

.text-gray {
  color: var(--color-gray-500);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 4.8rem;
  /* Standard Udemy button height */
  padding: 0 1.2rem;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.1s;
}

.btn-sm {
  height: 3.2rem;
  /* Small button */
  padding: 0 1.2rem;
  font-size: 1.4rem;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-black);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-black);
}

.btn-outline {
  background-color: var(--color-white);
  color: var(--color-black);
  border-color: var(--color-black);
}

.btn-outline:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--color-black);
  /* Ensure color stays black */
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-black);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: rgba(167, 139, 250, 0.1);
  color: var(--color-primary);
  /* Udemy headers often modify this, but basics */
}

.btn-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  /* Often used for icons */
  padding: 0;
}

/* Navbar */
.navbar {
  height: var(--navbar-height);
  background-color: var(--color-surface);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
  /* Darker shadows for dark UI */
  position: relative;
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 2.4rem;
  gap: 1.2rem;
  border-bottom: 1px solid var(--color-border);
}

.navbar .logo {
  flex-shrink: 0;
  margin-right: 0.8rem;
}

.navbar .logo img {
  height: 3.4rem;
  display: block;
}

.navbar .logo-text {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--color-black);
  display: flex;
  align-items: center;
}

.categories-link {
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--color-black);
  cursor: pointer;
  padding: 0 1.2rem;
}

.categories-link:hover {
  color: var(--color-primary);
}

/* Search Bar */
.search-container {
  flex-grow: 1;
  position: relative;
  max-width: 60rem;
}

.search-input {
  width: 100%;
  height: 4.8rem;
  /* Tall search bar */
  border: 1px solid var(--color-black);
  border-radius: 9999px;
  /* Pill shape */
  padding: 0 4.8rem 0 4.8rem;
  font-size: 1.4rem;
  background-color: var(--color-gray-100);
  border-color: transparent;
  outline: none;
  transition: all 0.1s;
}

.search-input:focus {
  background-color: var(--color-surface);
  border-color: var(--color-primary);
  /* Focus state */
}

.search-icon-btn {
  position: absolute;
  left: 1.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-gray-500);
  background: none;
  border: none;
  font-size: 1.8rem;
  pointer-events: none;
}

/* Nav Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
}

.nav-link {
  font-size: 1.4rem;
  color: var(--color-black);
  font-weight: 400;
}

.nav-link:hover {
  color: var(--color-primary);
}

/* Hero Section */
.hero {
  position: relative;
  max-width: 1340px;
  margin: 0 auto 4.8rem;
  /* Usually Udemy has a margin top if not full width, but here we keep it standard */
}

.hero-image-wrapper {
  width: 100%;
  height: 400px;
  overflow: hidden;
  position: relative;
}

.hero-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Top alignment often better for people images */
  object-position: top center;
}

.hero-content-box {
  position: absolute;
  top: 6.4rem;
  left: 4.8rem;
  background-color: var(--color-surface);
  padding: 2.4rem;
  width: 44rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
  /* Card shadow */
  border: 1px solid var(--color-border);
}

.hero-title {
  font-family: 'Merriweather', serif;
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.8rem;
}

.hero-desc {
  font-size: 1.6rem;
  margin-bottom: 1.6rem;
}

/* Trusted By */
.trusted-section {
  background-color: var(--color-gray-100);
  padding: 6.4rem 0;
  text-align: center;
  border-bottom: 1px solid var(--color-gray-200);
  margin-bottom: 4.8rem;
  /* Separation */
}

.trusted-title {
  font-size: 1.9rem;
  /* Approx 19px */
  color: var(--color-gray-500);
  margin-bottom: 2.4rem;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
}

.trusted-logos {
  display: flex;
  justify-content: center;
  gap: 4.8rem;
  flex-wrap: wrap;
  opacity: 0.6;
  filter: grayscale(100%);
}

/* Course Grid / Carousel */
.course-section {
  margin-bottom: 4.8rem;
}

.section-headline {
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: 1.6rem;
  font-family: 'Merriweather', serif;
  /* Or bold sans depending on current Udemy A/B test */
}

.course-grid {
  display: flex;
  gap: 1.6rem;
  /* If implement carousel, this changes to scroll container */
  overflow-x: auto;
  padding-bottom: 1.6rem;
  /* Space for scrollbar or shadow cutoff */
  scrollbar-width: none;
}

.course-grid::-webkit-scrollbar {
  display: none;
}

.course-card {
  min-width: 24rem;
  /* Fixed width for standard cards */
  max-width: 24rem;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  background: var(--color-surface);
  transition: opacity 0.1s;
  padding: 1.2rem;
  border-radius: 0.8rem;
  border: 1px solid transparent;
}

.course-card:hover {
  border-color: var(--color-primary);
}

.course-card:hover .course-image img {
  filter: brightness(0.95);
}

.course-image {
  width: 100%;
  aspect-ratio: 16/9;
  border: 1px solid var(--color-gray-300);
  margin-bottom: 0.8rem;
  overflow: hidden;
}

.course-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.2s;
}

.course-title {
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.4;
  color: var(--color-black);
  margin-bottom: 0.4rem;

  /* Line clamp 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 4.4rem;
  /* Approx 2 lines height */
}

.course-author {
  font-size: 1.2rem;
  color: var(--color-gray-500);
  margin-bottom: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-rating {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.rating-number {
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--color-brown-rating-text);
}

.rating-stars {
  font-size: 1.2rem;
  color: var(--color-orange-rating);
  display: flex;
  gap: 1px;
}

.rating-count {
  font-size: 1.2rem;
  color: var(--color-gray-500);
}

.course-price {
  font-weight: 700;
  font-size: 1.6rem;
  /* Large price */
  color: var(--color-black);
}

/* Categories Tags */
.tags-container {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 2.4rem;
}

.tag-pill {
  border-radius: 9999px;
  padding: 1.2rem 2.4rem;
  font-size: 1.6rem;
  font-weight: 700;
  border: 1px solid var(--color-black);
  background-color: var(--color-white);
  color: var(--color-black);
  cursor: pointer;
  transition: background-color 0.1s;
}

.tag-pill:hover,
.tag-pill.active {
  background-color: var(--color-black);
  color: var(--color-white);
}

/* Footer */
footer {
  background-color: var(--color-bg-main);
  /* Dark footer */
  color: var(--color-text-main);
  padding: 3.2rem 2.4rem;
  margin-top: 6.4rem;
  border-top: 1px solid var(--color-border);
}

.footer-logo {
  font-family: 'Merriweather', serif;
  /* or just text */
  font-size: 3.2rem;
  font-weight: 700;
  color: white;
  margin-bottom: 2.4rem;
}

.footer-copyright {
  font-size: 1.2rem;
  color: white;
}
/* Auth Pages */
.auth-container {
  max-width: 40rem;
  margin: 6.4rem auto;
  padding: 0 2.4rem;
}

.auth-container h3 {
  font-family: 'Merriweather', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-black);
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--color-gray-300);
  margin-bottom: 2.4rem;
}

.form-group {
    margin-bottom: 1.6rem;
}

.form-group label {
    display: none; /* Udemy usually hides labels or uses placeholders effectively in simple forms, or floats them. Let's hide for simplicity or basic block */
}

.form-group input {
    width: 100%;
    height: 4.8rem;
    padding: 0 1.6rem;
    font-size: 1.6rem;
    border: 1px solid var(--color-black);
    border-radius: 0; /* Square inputs usually */
    outline: none;
}

.form-group input:focus {
    border-color: var(--color-black-hover); 
}

.btn.full-width {
    width: 100%;
}

.alert {
  padding: 1.6rem;
  background-color: #fca5a5;
  color: #7f1d1d;
  margin-bottom: 1.6rem;
  font-weight: 700;
  text-align: center;
}

.alert-success {
  background-color: #86efac;
  color: #14532d;
}

/* ─── GLOBAL MOBILE RESPONSIVE (Pixel 7 / 768px) ─── */
@media (max-width: 768px) {
    html { font-size: 56.25%; /* 1rem = 9px approx */ }

    .container {
        padding: 0 1.6rem;
    }

    /* Hero Section */
    .hero-image-wrapper {
        height: 200px;
    }

    .hero-content-box {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        padding: 2.4rem 1.6rem;
        box-shadow: none;
        border-bottom: 1px solid var(--color-border);
    }

    .hero-title {
        font-size: 2.4rem;
    }

    /* Course Grid */
    .course-grid {
        gap: 1.2rem;
        overflow-x: auto;
        padding-bottom: 2rem;
        display: flex;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .course-card {
        min-width: 18rem;
        max-width: 18rem;
    }

    /* Trusted Logos */
    .trusted-logos {
        gap: 2.4rem;
    }

    .trusted-logos img {
        height: 2.4rem;
    }

    /* Footer */
    footer {
        padding: 2.4rem 1.6rem;
    }
    
    .footer-logo {
        font-size: 2.4rem;
    }
}

@media (max-width: 412px) {
    /* Pixel 7 Specific Fine-Tuning */
    .hero-title { font-size: 2.2rem; }
    .btn { height: 4.4rem; font-size: 1.4rem; }
}
