:root {
  --primary-color: #ff6d34;
  --top-header-bg: #745ae3;
  --nav-bg: #fffef0;
  --nav-text: #1b1b1b;
  --blue-dark: #123e7e;
  --logo-width: 220px;
}

.top-header {
  background: var(--top-header-bg);
  color: #ffffff;
  padding: 30px 0 25px; /* Extra padding for wave */
  font-size: 0.9rem;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1001;
  transition: transform 0.3s ease-in-out;
}

.top-header-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 10px;
}

.top-left {
  display: none;
}

.top-left a {
  color: #ffffff;
  text-decoration: underline;
  margin-left: 5px;
  font-weight: 700;
}

.top-right {
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
  row-gap: 8px;
  justify-content: center;
  width: 100%;
}

.top-right i {
  margin-right: 5px;
}

.wavy-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 25px;
  line-height: 0;
}

.wavy-bottom svg {
  width: 100%;
  height: 25px;
}

.wavy-bottom path {
  fill: #ffffff;
}

.site-header {
  background: #fff;
  position: fixed;
  top: 45px; /* Aligned with top header */
  width: 100%;
  z-index: 1000;
  padding: 10px 0;
  transition: transform 0.3s ease-in-out, top 0.3s ease-in-out;
}

.nav-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  position: relative;
}

.nav-logo-mobile {
  display: none;
  align-items: center;
  line-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  line-height: 0;
}

.brand img {
  height: 78px;
  width: auto;
  max-width: var(--logo-width);
  object-fit: contain;
  display: block;
}

.btn-categories {
  background: none;
  border: 1px solid #123e7e44;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  color: var(--blue-dark);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-left: auto;
  flex: 1;
  position: relative;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 26px;
  flex-wrap: wrap;
  row-gap: 10px;
}

.nav-links-wrap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  gap: 90px;
}

.nav-links-left,
.nav-links-right {
  flex: 0 0 auto;
  justify-content: center;
}

.nav-links-left {
  justify-content: flex-end;
  justify-self: end;
}

.nav-links-right {
  justify-content: flex-start;
}

.nav-right-group .nav-links-right {
  justify-self: end;
}

.nav-center {
  display: flex;
  justify-content: center;
  align-items: center;
  justify-self: center;
  pointer-events: none;
}

.nav-center .brand {
  pointer-events: auto;
}

.nav-right-group {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-self: start;
}

.nav-link {
  text-decoration: none;
  color: var(--nav-text);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-link i {
  font-size: 0.7rem;
  color: #888;
}

.has-dropdown {
  position: relative;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: -20px;
  background: #ffffff;
  min-width: 220px;
  display: none;
  padding: 25px;
  list-style: none;
  z-index: 10;
  border-radius: 20px;
  box-shadow: 0 15px 45px rgba(116, 90, 227, 0.12);
  border-bottom: 4px solid var(--top-header-bg);
  animation: navFadeIn 0.3s ease forwards;
}

@keyframes navFadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.has-dropdown:hover .dropdown {
  display: block;
}

.dropdown li {
  margin-bottom: 15px;
  position: relative;
  padding-left: 28px;
  transition: transform 0.2s ease;
}

.dropdown li:last-child {
  margin-bottom: 0;
}

.dropdown li:hover {
  transform: translateX(8px);
}

.dropdown li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border: 2px solid #745ae3;
  border-radius: 50%;
  transition: all 0.3s;
}

.dropdown li:hover::before {
  background: #745ae3;
  transform: translateY(-50%) scale(1.2);
}

.dropdown a {
  display: block;
  text-decoration: none;
  color: #666;
  font-weight: 600;
  font-size: 1.05rem;
  transition: color 0.3s;
}

.dropdown li:hover a {
  color: #745ae3;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.action-btn {
  background: #ffffff;
  border: 1px solid #eee;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--nav-text);
  cursor: pointer;
  transition: all 0.3s;
}

.action-btn:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.btn-start-learning {
  background: var(--primary-color);
  color: #ffffff;
  text-decoration: none;
  padding: 15px 35px;
  border-radius: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s;
}

.btn-start-learning:hover {
  background: #e6561e;
  transform: translateY(-2px);
}

/* Scroll Utilities - Simplified to prevent flickering */
.nav-hidden {
  transform: translateY(-100%);
}

.top-header, .site-header {
  transition: transform 0.4s ease-in-out, top 0.4s ease-in-out;
}

body.scrolled .top-header {
  transform: translateY(-100%);
}

body.scrolled .site-header {
  top: 0; /* Keep navbar visible when scrolling */
}

body {
  padding-top: 140px; /* Fixed padding to prevent layout shifts */
  background-color: var(--nav-bg);
}

/* Mobile Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.nav-toggle .bar {
  width: 25px;
  height: 3px;
  background: var(--nav-text);
  transition: transform 0.25s ease, opacity 0.2s ease;
  transform-origin: center;
}

.nav-toggle.is-open .bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open .bar:nth-child(3) {
  transform: translateY(8px) rotate(45deg);
}

.nav-toggle.is-open .bar:nth-child(4) {
  transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 1100px) {
  .top-header,
  .site-header {
    transform: none;
    transition: none;
  }

  body.scrolled .top-header {
    transform: none;
  }

  body.scrolled .site-header {
    top: 0;
  }

  .nav-logo-mobile {
    display: flex;
  }

  .nav-center {
    display: none;
  }

  .nav-links-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .nav-right-group {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 16px;
  }

  .brand img {
    height: 64px;
    max-width: 200px;
  }
  .nav-right {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .nav-right.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-toggle {
    display: flex;
  }
  
  .nav-links {
    flex-direction: column;
    width: 100%;
  }

  .nav-actions {
    margin-top: 20px;
    width: 100%;
    justify-content: space-between;
  }

  .nav-links li.is-open .dropdown {
    display: block;
    position: static;
    box-shadow: none;
    padding: 15px 0 0 20px;
    border-bottom: none;
    animation: none;
  }

  .nav-right:not(.is-open) .dropdown {
    display: none;
  }

  .has-dropdown:hover .dropdown {
    display: none;
  }
}

@media (max-width: 768px) {
  .top-header {
    display: none;
  }

  .site-header {
    top: 0;
  }

  body {
    padding-top: 90px;
  }
}

@media (max-width: 1200px) {
  .top-header-inner {
    align-items: flex-start;
  }

  .top-right {
    width: 100%;
    justify-content: flex-start;
    gap: 16px;
  }

  .nav-right {
    gap: 24px;
  }

  .nav-links {
    gap: 20px;
  }
}
