/* ================================
   Header & Footer Components
   ================================ */

/* ================
   HEADER / NAVIGATION
   ================ */

.header {
  position: sticky;
  top: 1rem;
  z-index: 1000;
  margin: 1rem auto;
  max-width: var(--container-width);
  min-height: 72px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  will-change: transform, box-shadow;
  transform: translateZ(0);
}

.header.scrolled {
  box-shadow: var(--shadow-lg);
  background: rgba(255, 255, 255, 0.98);
  top: 0.5rem;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--container-padding);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.logo:hover {
  opacity: 0.8;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--color-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: var(--weight-bold);
  font-size: 1.125rem;
}

.logo-image {
  height: 36px;
  width: auto;
  display: block;
  object-fit: contain;
  max-width: 180px;
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  position: relative;
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
  font-size: var(--text-base);
  text-decoration: none;
  transition: color var(--transition-fast);
  padding: var(--space-sm) 0;
}

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

.nav-link.active {
  color: var(--color-text-primary);
  font-weight: var(--weight-semibold);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-gradient);
  border-radius: 2px;
}

/* Dropdown indicator */
.has-dropdown > .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.has-dropdown > .nav-link::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--transition-fast);
  margin-top: -3px;
}

.has-dropdown:hover > .nav-link::after,
.has-dropdown.active > .nav-link::after {
  transform: rotate(-135deg);
  margin-top: 1px;
}

/* Dropdown */
.nav-item {
  position: relative;
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: var(--space-md);
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
  padding: var(--space-lg);
  min-width: 480px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base), margin-top var(--transition-base);
  transition-delay: 0.35s;
  pointer-events: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* Create hover bridge to prevent dropdown from closing */
.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -16px;
  left: 0;
  right: 0;
  height: 16px;
  background: transparent;
}

.nav-item:hover .nav-dropdown,
.nav-dropdown:hover {
  opacity: 1;
  visibility: visible;
  margin-top: var(--space-sm);
  pointer-events: all;
  transition-delay: 0s;
}

.nav-dropdown-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--space-lg);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: 12px;
  transition: all var(--transition-fast);
  font-size: var(--text-sm);
  background: var(--color-background);
  border: 2px solid transparent;
}

.nav-dropdown-item:hover {
  background: white;
  border-color: var(--color-primary-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Product-specific hover colors */
.nav-dropdown-item[href="meshlist"]:hover {
  border-color: #52d1a0;
  box-shadow: 0 4px 12px rgba(82, 209, 160, 0.2);
}

.nav-dropdown-item[href="meshfeed"]:hover {
  border-color: #419fec;
  box-shadow: 0 4px 12px rgba(65, 159, 236, 0.2);
}

.nav-dropdown-item[href="meshads"]:hover {
  border-color: #ff7547;
  box-shadow: 0 4px 12px rgba(255, 117, 71, 0.2);
}

.nav-dropdown-item[href="meshmedia"]:hover {
  border-color: #6E22B3;
  box-shadow: 0 4px 12px rgba(110, 34, 179, 0.2);
}

.nav-dropdown-item img {
  height: 32px;
  width: auto;
  margin-bottom: var(--space-sm);
}

.nav-dropdown-item strong {
  display: block;
  color: var(--color-text-primary);
  margin-bottom: 0.375rem;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

.nav-dropdown-item span {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  z-index: 1001;
  width: 44px;
  height: 44px;
  position: relative;
}

.mobile-menu-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text-primary);
  transition: all var(--transition-base);
  border-radius: 2px;
  position: absolute;
}

.mobile-menu-btn span:nth-child(1) {
  top: calc(50% - 6px);
}

.mobile-menu-btn span:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
}

.mobile-menu-btn span:nth-child(3) {
  top: calc(50% + 4px);
}

.mobile-menu-btn.active span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}

/* Hide nav close button on desktop */
.nav-close {
  display: none;
}

/* Nav Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-login {
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* ================
   FOOTER
   ================ */

.footer {
  background: var(--color-text-primary);
  color: rgba(255, 255, 255, 0.8);
  padding: var(--space-4xl) 0 var(--space-xl);
  margin-top: var(--space-4xl);
}

.footer-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: var(--space-3xl);
  margin-bottom: var(--space-3xl);
}

.footer-column h4 {
  color: white;
  font-size: var(--text-lg);
  margin-bottom: var(--space-lg);
  font-weight: var(--weight-semibold);
}

.footer-column p {
  color: rgba(255, 255, 255, 0.7);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-md);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color var(--transition-fast);
  font-size: var(--text-base);
}

.footer-links a:hover {
  color: white;
}

/* Footer Brand */
.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.footer-brand .logo-icon {
  width: 40px;
  height: 40px;
}

.footer-brand span {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: white;
}

.footer-logo-image {
  height: 50px;
  width: auto;
  display: block;
}

/* Newsletter */
.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
  
.newsletter-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 16px; /* Prevents zoom on iOS */
  outline: none;
  transition: all var(--transition-fast);
}

.newsletter-btn {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--text-sm);
}

.newsletter-input:focus {
  border-color: var(--color-primary-blue);
  background: rgba(255, 255, 255, 0.15);
}

.newsletter-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.newsletter-btn:hover {
  background: transparent;
  border-color: #129ed9;
  color: #129ed9;
}

/* Social Links */
.social-links {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.social-link {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  transition: all var(--transition-fast);
  font-size: 1.125rem;
}

.social-link:hover {
  background: var(--color-gradient);
  transform: translateY(-2px);
}

/* Footer App Button */
.footer .btn-primary {
  color: white;
}

.footer .btn-primary:hover {
  color: white;
}

/* Footer Bottom */
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.6);
}

.footer-legal {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-legal a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-legal a:hover {
  color: white;
}

/* ================
   RESPONSIVE
   ================ */

@media (max-width: 1024px) {
  .footer-content {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

@media (max-width: 768px) {
  body.nav-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 900;
  }

  /* Header adjustments */
  .header {
    top: 0;
    margin: 0.5rem 1rem;
  }
  
  .header-container {
    padding: 0 var(--space-lg);
  }
  
  .logo-image {
    max-width: 140px;
  }
  
  /* Mobile Navigation */
  .mobile-menu-btn {
    display: flex;
    min-width: 44px;
    min-height: 44px;
  }
  
  .nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100dvh;
    max-height: 100dvh;
    background: white;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: calc(var(--header-height) + 2rem) var(--space-xl) var(--space-2xl);
    transform: translateY(-12px);
    transition: transform var(--transition-base), opacity var(--transition-base);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  }

  .nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  
  .nav-links {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0;
    position: relative;
    z-index: 1;
    margin-top: var(--space-lg);
  }
  
  .nav-item {
    width: 100%;
    border-bottom: 1px solid var(--color-border-light);
  }
  
  .nav-link {
    display: block;
    padding: var(--space-md) 0;
    width: 100%;
  }
  
  .has-dropdown > .nav-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  /* Ensure chevron animates properly on mobile */
  .has-dropdown.active > .nav-link::after {
    transform: rotate(-135deg);
    margin-top: 1px;
  }
  
  .has-dropdown:not(.active) > .nav-link::after {
    transform: rotate(45deg);
    margin-top: -3px;
  }
  
  .nav-dropdown {
    position: static;
    transform: none;
    margin-top: 0;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--color-border-light);
    border-radius: 0;
    padding: var(--space-sm) 0 var(--space-sm) var(--space-md);
    display: none;
    grid-template-columns: 1fr;
    gap: var(--space-sm);
    min-width: auto;
  }
  
  .nav-item:hover .nav-dropdown {
    margin-top: 0;
  }
  
  .nav-item.active .nav-dropdown {
    display: grid;
    opacity: 1;
    visibility: visible;
  }
  
  .nav-dropdown-item {
    background: white;
    border: 1px solid var(--color-border);
  }
  
  .nav-dropdown-item:hover {
    transform: none;
  }
  
  .nav-close {
    display: block;
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--color-text-primary);
    z-index: 1002;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .nav-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin-top: var(--space-lg);
    position: relative;
    z-index: 1;
  }
  
  .nav-login {
    padding: var(--space-md) 0;
    text-align: center;
  }
  
  .nav-actions .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Hide floating cards on mobile */
  .float-animation {
    display: none !important;
  }
  
  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }
  
  .footer-legal {
    flex-direction: column;
    gap: var(--space-sm);
  }
}

/* Show floating cards on desktop */
@media (min-width: 769px) {
  .float-animation {
    display: flex !important;
  }

/* Body padding for sticky header */
body {
  padding-top: 0;
}
