/* ========================================
   头部导航 & 页脚
   ======================================== */

/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid transparent;
  z-index: 1000;
  transition: all var(--transition);
}

/* 底部微光渐变条 */
.header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(10,102,194,0.08) 20%,
    rgba(0,201,167,0.12) 50%,
    rgba(10,102,194,0.08) 80%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity var(--transition);
}

.header.scrolled {
  background: rgba(255, 255, 255, 0.95);
  border-bottom-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.header.scrolled::after {
  opacity: 1;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 40px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition);
}

.logo:hover {
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(10,102,194,0.25);
  transition: all var(--transition);
}

.logo:hover .logo-icon {
  box-shadow: 0 3px 10px rgba(10,102,194,0.35);
  transform: scale(1.04);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.logo-slogan {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 1px;
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  padding: 8px 16px;
  font-size: 15px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  position: relative;
}

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

/* 当前页面链接底部微光 */
.nav-link.active {
  color: var(--primary);
  font-weight: 500;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: transparent;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition);
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

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

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

/* ---------- Footer ---------- */
.footer {
  background: linear-gradient(180deg, var(--text-primary) 0%, #12122a 100%);
  color: rgba(255, 255, 255, 0.75);
  padding-top: 64px;
  position: relative;
}

/* 页脚顶部装饰光条 */
.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(10,102,194,0.4) 15%,
    rgba(0,201,167,0.6) 50%,
    rgba(10,102,194,0.4) 85%,
    transparent 100%
  );
}

.footer-main {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-brand .logo {
  color: #fff;
  margin-bottom: 16px;
}

.footer-brand .logo-name {
  color: #fff;
}

.footer-brand .logo-slogan {
  color: rgba(255, 255, 255, 0.5);
}

.footer-brand .logo-icon {
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  box-shadow: 0 2px 8px rgba(0,201,167,0.2);
}

.footer-desc {
  font-size: 14px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.5);
  max-width: 280px;
}

.footer-heading {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 10px;
}

.footer-heading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.footer-links a:hover {
  color: #fff;
  transform: translateX(3px);
}

.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  transition: color var(--transition);
}

.footer-contact-item:hover {
  color: rgba(255, 255, 255, 0.8);
}

.footer-contact-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.5;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
}

.footer-bottom a {
  color: rgba(255, 255, 255, 0.35);
}

.footer-bottom a:hover {
  color: rgba(255, 255, 255, 0.7);
}

.footer-icp {
  display: flex;
  gap: 20px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 16px;
    gap: 4px;
    box-shadow: var(--shadow-lg);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
  }

  .nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    padding: 12px 16px;
  }

  .footer-main {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .footer-icp {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .logo-name {
    font-size: 16px;
  }

  .logo-slogan {
    display: none;
  }
}

/* ---------- 管理入口链接 ---------- */
.nav-admin-link {
  font-size: 13px;
  color: var(--text-tertiary) !important;
  border: 1px solid var(--border);
  padding: 5px 12px !important;
  border-radius: 4px;
  margin-left: 8px;
}
.nav-admin-link:hover {
  border-color: var(--primary);
  color: var(--primary) !important;
  background: var(--primary-bg) !important;
}

/* ---------- IoT控制台链接 ---------- */
.nav-iot-link {
  color: var(--primary);
  font-weight: 600;
}
.nav-iot-link::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #00C9A7;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
