:root {
  --primary: #0f62fe;
  --primary-hover: #0353e9;
  --bg-light: #f9f9f9;
  --bg-dark: #ffffff;
  --text-color: #202124;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

body.dark-theme {
  --bg-light: #202124;
  --bg-dark: #303134;
  --text-color: #e8eaed;
}

/* Общие стили */
body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg-light);
  color: var(--text-color);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  scroll-behavior: smooth;
}

/* Контейнер */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 20px;
}

/* Шапка сайта */
header {
  background: var(--bg-dark);
  padding: 1rem 2rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
}

nav h1 {
  font-size: 1.8rem;
  color: var(--primary);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 0;
  margin: 0;
}

nav ul li a,
nav ul li button {
  text-decoration: none;
  color: #5f6368;
  font-weight: 500;
  transition: 0.2s;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
}

nav ul li a:hover,
nav ul li button:hover {
  color: var(--primary);
}

/* Search input in nav */
#courseSearch {
  padding: 6px 10px;
  border-radius: 20px;
  border: 1.5px solid #ccc;
  font-size: 1rem;
  width: 180px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

#courseSearch:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 5px var(--primary);
}

/* Theme toggle button */
.theme-toggle {
  background: linear-gradient(135deg, var(--primary), #2b84fb);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.4s ease;
  font-weight: bold;
  box-shadow: 0 5px 15px rgba(15, 98, 254, 0.3);
}

.theme-toggle:hover {
  background: linear-gradient(135deg, var(--primary-hover), #1a73e8);
  transform: scale(1.05);
}

/* Главный баннер */
#hero {
  background: linear-gradient(120deg, var(--primary), #1a73e8);
  color: white;
  padding: 80px 20px;
  text-align: center;
  animation: fadeIn 1s ease-in;
  border-radius: 10px;
  margin: 20px 0;
}

#hero h2 {
  font-size: 2.8rem;
  margin-bottom: 15px;
}

#hero p {
  font-size: 1.2rem;
  margin-bottom: 30px;
}

.cta-btn {
  background: white;
  color: var(--primary);
  padding: 12px 25px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.3s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.cta-btn:hover {
  background: #e0e0e0;
}

/* Карточки курсов */
.courses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}

.courses.dragging {
  cursor: grabbing;
}

.course-card {
  background: var(--bg-dark);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.3s;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease-in-out forwards;
  min-width: 280px;
  user-select: none;
}

.course-card:hover {
  transform: translateY(-5px);
}

.course-card img {
  width: 100%;
  height: auto;
}

.course-card p {
  padding: 1rem;
  font-size: 0.95rem;
  flex-grow: 1;
  color: var(--text-color);
}

.buy-btn {
  padding: 15px;
  background: var(--primary);
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 0 0 14px 14px;
  cursor: pointer;
  transition: background 0.3s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.buy-btn:hover {
  background: var(--primary-hover);
}

/* О нас */
#about {
  background-color: var(--bg-dark);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 40px;
  display: flex;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeIn 1.5s ease-in-out forwards;
}

#about img {
  max-width: 500px;
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

#about .about-text {
  flex: 1;
}

#about h2 {
  font-size: 2rem;
  margin-bottom: 15px;
  color: var(--text-color);
}

#about p {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-color);
}

/* Видео оверлей */
#video-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#video-overlay.active {
  display: flex;
}

#video-container {
  position: relative;
  width: 90%;
  max-width: 800px;
}

#course-video {
  width: 100%;
  height: 450px;
  border: none;
  border-radius: 10px;
}

/* Закрывающая кнопка */
#close-video {
  position: absolute;
  top: -15px;
  right: -15px;
  background: red;
  color: white;
  font-size: 1.5rem;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  text-align: center;
  line-height: 40px;
  cursor: pointer;
  user-select: none;
}

/* Анимации */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Медиа-запросы */
@media (max-width: 768px) {
  nav ul {
    flex-wrap: wrap;
    gap: 1rem;
  }
  #about {
    flex-direction: column;
    text-align: center;
  }
  .courses {
    grid-template-columns: unset;
    overflow-x: auto;
    cursor: grab;
  }
}

/* Fix image sizes for interactive tests */
#interactive-courses .course-card img {
  width: 320px;
  height: 180px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 15px;
}
