/* Add spacing for fixed navigation */
body {
  padding-top: var(--nav-height);
}

/* Navigation styles */
.site-nav {
  background: rgba(5, 8, 15, 0.98) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  padding: var(--space-3) 0;
  position: fixed;
  width: 100%;
  left: 0;
  top: 0;
  z-index: var(--nav-z-index);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0;
  overflow: visible;
  border-radius: 0 !important;
  border-bottom: none !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

/* Bottom sharp shine */
.site-nav::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(59, 130, 246, 0.2) 10%,
    rgba(59, 130, 246, 0.6) 50%,
    rgba(59, 130, 246, 0.2) 90%,
    transparent 100%
  );
  box-shadow: 
    0 0 10px rgba(59, 130, 246, 0.4),
    0 0 20px rgba(59, 130, 246, 0.2);
  pointer-events: none;
  z-index: 1;
}

.site-nav.nav-hidden {
  transform: translateY(-100%);
}

.nav-inner {
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  position: relative;
  z-index: 1;
}

.nav-logo {
  display: flex;
  align-items: center;
  margin-left: var(--space-2);
}

.nav-logo svg {
  height: 40px;
  width: auto;
  transition: 0.2s ease;
}

.nav-logo .normal-state {
  fill: url(#nav-gradient);
}

.nav-logo .hover-state {
  fill: url(#nav-gradient-hover);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-logo:hover .hover-state {
  opacity: 1;
}

.nav-logo .logo-paths {
  position: relative;
}

.nav-logo .normal-state,
.nav-logo .hover-state {
  position: absolute;
  top: 0;
  left: 0;
}

.nav-links {
  margin-left: 75px;
}

.nav-links ul {
  display: flex;
  gap: calc(var(--space-4) + 25px);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-user {
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: color 0.2s ease;
}

.nav-user-desktop {
  margin-left: auto;
  margin-right: var(--space-4);
}

.nav-user-mobile {
  display: none;
}

.nav-user svg {
  width: 32px;
  height: 32px;
}

.nav-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.nav-user-avatar:hover {
  border-color: var(--color-primary);
  transform: scale(1.05);
}

/* Visually hide the site title but keep it in the DOM for accessibility and OAuth review */
.nav-site-title {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.nav-user:hover {
  color: var(--color-primary);
}

.nav-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 0;
  position: relative;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 1px;
  background: rgba(59, 130, 246, 0.8);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-links a:hover {
  color: #ffffff;
}

.nav-links a:hover::after {
  width: 80%;
}

/* Mobile navigation */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: var(--space-2);
  margin-left: auto;
  margin-right: var(--space-2);
  z-index: 20;
  transition: color 0.3s ease;
}

.nav-toggle:hover {
  color: rgba(59, 130, 246, 0.8);
}

.hamburger {
  display: block;
  width: 24px;
  height: 20px;
  position: relative;
}

.hamburger-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  transition: transform 0.3s ease, opacity 0.2s ease;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.hamburger-line:nth-child(1) {
  top: 0;
}

.hamburger-line:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
}

.hamburger-line:nth-child(3) {
  bottom: 0;
}

/* Animated X state */
.site-nav.expanded .hamburger-line:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.site-nav.expanded .hamburger-line:nth-child(2) {
  opacity: 0;
}

.site-nav.expanded .hamburger-line:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-inner {
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    width: 100%;
  }

  .site-nav {
    transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .site-nav::after {
    transition: opacity 0.3s ease;
  }

  .site-nav.expanded {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
  }

  .site-nav.expanded::after {
    opacity: 0;
  }

  .site-nav.expanded .nav-logo {
    opacity: 0;
    pointer-events: none;
  }

  .nav-logo {
    margin-left: var(--space-4);
    transition: opacity 0.3s ease;
  }

  .nav-toggle {
    display: block;
    margin: 0;
    position: fixed;
    left: calc(100vw - 56px);
    top: 1rem;
    z-index: 10000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .site-nav.expanded .nav-toggle {
    left: 224px;
  }

  .nav-user-desktop {
    display: none;
  }

  .nav-user-mobile {
    display: block;
    transition: opacity 0.3s ease;
  }

  .nav-inner .nav-user-mobile {
    /* Only hide the nav-user-mobile in the header, not in sidebar */
  }

  .site-nav.expanded .nav-inner .nav-user-mobile {
    opacity: 0;
    pointer-events: none;
  }

  /* Account link in sidebar should be visible and clickable */
  .nav-links .nav-user-mobile {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .nav-links {
    position: fixed;
    top: 0 !important;
    left: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    background: rgba(5, 8, 15, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0;
    margin: 0;
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease;
    border-right: 2px solid rgba(59, 130, 246, 0.6);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    overflow-y: auto;
    will-change: transform;
  }

  /* Prevent sidebar from being affected by header scroll-hide */
  .site-nav.nav-hidden .nav-links {
    transform: translateX(-100%) !important;
  }

  .site-nav.nav-hidden.expanded .nav-links {
    transform: translateX(0) !important;
  }

  .site-nav.expanded .nav-links {
    transform: translateX(0) !important;
  }
  .nav-links a[href="/"],
  .nav-links a[href="/index.html"] {
    padding: var(--space-4);
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    min-height: 60px;
    font-size: 0;
    line-height: 0;
    position: relative;
  }

  .nav-links a[href="/"]::before,
  .nav-links a[href="/index.html"]::before {
    content: '';
    display: block;
    width: 80px;
    height: 40px;
    background-image: url('../images/logo.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left center;
    font-size: 1rem;
    line-height: normal;
  }

  .nav-links a[href="/"]:hover,
  .nav-links a[href="/index.html"]:hover {
    background: rgba(59, 130, 246, 0.05);
    border-left: none;
    padding-left: var(--space-4);
  }

  .site-nav.expanded .nav-links {
    transform: translateX(0);
  }

  .nav-links ul {
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    padding: var(--space-4) 0;
    height: auto;
    justify-content: flex-start;
    padding-top: var(--space-4);
    width: 100%;
  }

  .nav-links li {
    width: 100%;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    padding: 0;
  }

  .nav-links a {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .nav-links a::after {
    display: none;
  }

  .nav-links a:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #ffffff;
    border-left: 3px solid rgba(59, 130, 246, 0.8);
    padding-left: calc(1.5rem - 3px);
  }

  .site-nav.expanded .nav-links li {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.1s;
  }

  .site-nav.expanded .nav-links li:nth-child(1) { transition-delay: 0.15s; }
  .site-nav.expanded .nav-links li:nth-child(2) { transition-delay: 0.2s; }
  .site-nav.expanded .nav-links li:nth-child(3) { transition-delay: 0.25s; }
  .site-nav.expanded .nav-links li:nth-child(4) { transition-delay: 0.3s; }
  .site-nav.expanded .nav-links li:nth-child(5) { transition-delay: 0.35s; }
  .site-nav.expanded .nav-links li:nth-child(6) { transition-delay: 0.4s; }
}

/* Footer */
.site-footer {
  background: var (--color-bg);
  color: rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--grad-new-end), transparent);
  opacity: 0.3;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.footer-main {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  padding: 4rem 0 2rem 0;
}

.footer-section {
  display: flex;
  flex-direction: column;
}

.footer-brand {
  max-width: 350px;
}

.footer-logo {
  width: 120px;
  height: auto;
  margin-bottom: 1.5rem;
}

.footer-logo svg {
  width: 100%;
  height: auto;
}

.footer-description {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2rem;
}

.footer-social {
  display: flex;
  gap: 1rem;
}

.social-link {
  width: 44px;
  height: 44px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.social-link:hover {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border-color: var(--grad-new-end);
  color: var(--grad-new-end);
  transform: translateY(-2px);
}

.footer-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: all 0.3s ease;
  display: inline-block;
  position: relative;
}

.footer-links a:hover {
  color: var(--grad-new-end);
  transform: translateX(4px);
}

.footer-links a::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 1px;
  background: var(--grad-new-end);
  transition: width 0.3s ease;
}

.footer-links a:hover::before {
  width: 8px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2rem 0;
}

.footer-bottom-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-legal {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-legal p {
  margin: 0;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
}

.footer-legal-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-legal-links a {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-legal-links a:hover {
  color: var(--grad-new-end);
}

.footer-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-powered {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  position: relative;
}

.footer-powered::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--grad-new-end));
}

/* Footer Responsive Design */
@media (max-width: 1024px) {
  .footer-main {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
  
  .footer-brand {
    grid-column: span 2;
    max-width: none;
    margin-bottom: 1rem;
  }
}

@media (max-width: 768px) {
  .footer-container {
    padding: 0 1rem;
  }
  
  .footer-main {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 3rem 0 2rem 0;
  }
  
  .footer-brand {
    grid-column: span 1;
    text-align: center;
  }
  
  .footer-logo {
    margin-left: auto;
    margin-right: auto;
  }
  
  .footer-social {
    justify-content: center;
  }
  
  .footer-section {
    text-align: center;
  }
  
  .footer-bottom-content {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .footer-legal {
    flex-direction: column;
    gap: 1rem;
  }
  
  .footer-legal-links {
    justify-content: center;
  }
  
  .footer-powered::before {
    display: none;
  }
}