/** ============================================
 * 天津港阳光智采平台 — Header 样式表
 * 基于 header.pen 设计稿 1:1 还原
 * ============================================ */

/* CSS Variables */
:root {
  --color-primary: #1f6de8;
  --color-primary-light: #5199ff;
  --color-primary-dark: #0068b7;
  --color-accent-red: #e60012;
  --color-text-primary: #333333;
  --color-text-secondary: #999999;
  --color-border: #d7d7d7;
  --color-white: #ffffff;

  --shadow-header: 0 4px 3.5px rgba(0, 0, 0, 0.25);

  --font-title: "Alimama ShuHeiTi", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Source Han Sans CN", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  min-width: 320px;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ============================================
 * Header
 * ============================================ */
.header {
  position: relative;
  width: 100%;
  height: 80px;
  background: var(--color-white);
  border-bottom: 1px solid transparent;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1920px;
  height: 100%;
  margin: 0 auto;
  padding: 0 360px;
}

/* Brand */
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  width: 367px;
  height: 35.33px;
  transform: translateX(-50px);
}

.brand-divider {
  width: 1px;
  height: 28px;
  background: #E8E3E3;
  flex-shrink: 0;
  align-self: flex-end;
}

.brand-logo {
  width: 184px;
  height: 35.33px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  width: 162px;
  height: 32px;
  display: flex;
  align-items: flex-end;
}

.site-title {
  width: 162px;
  height: 32px;
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: 1.12px;
  line-height: 1;
  white-space: nowrap;
}

/* Navigation */
.header-nav {
  display: flex;
  align-items: center;
  gap: 40px;
  height: 48px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: normal;
  color: var(--color-text-primary);
  padding: 0 4px;
  transition: color 0.25s ease;
}

.nav-item::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s ease;
}

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

.nav-item:hover::after {
  transform: scaleX(1);
}

.nav-item--active {
  font-weight: 700;
  color: var(--color-primary);
}

.nav-item--active::after {
  transform: scaleX(1);
}

/* Mobile Toggle */
.mobile-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 4px;
}

.mobile-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-text-primary);
  border-radius: 1px;
  transition: all 0.3s ease;
}

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

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

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

/* Auth Buttons */
.header-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5714;
  border-radius: 2px;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.btn--login {
  width: 64px;
  height: 32px;
  padding: 0 12px;
  color: var(--color-white);
  background: #5199FF;
  border: none;
}

.btn--login:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(81, 153, 255, 0.35);
}

.btn--register {
  padding: 5px 18px;
  color: var(--color-text-secondary);
  background: var(--color-white);
  border: 1px solid var(--color-border);
}

.btn--register:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ============================================
 * Responsive — Tablet (768px ~ 1439px)
 * ============================================ */
@media (max-width: 1439px) {
  .header-inner {
    padding: 0 48px;
  }

  .site-title {
    font-size: 22px;
  }

  .header-nav {
    gap: 24px;
  }
}

/* ============================================
 * Responsive — Mobile (< 768px)
 * ============================================ */
@media (max-width: 767px) {
  .header {
    height: 64px;
  }

  .header-inner {
    padding: 0 16px;
  }

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

  .site-title {
    font-size: 16px;
    letter-spacing: 0.5px;
  }

  .header-nav {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    height: auto;
    background: var(--color-white);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s ease;
    z-index: 99;
  }

  .header-nav.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-item {
    height: 48px;
    justify-content: flex-start;
    padding: 0 24px;
    font-size: 15px;
  }

  .nav-item::after {
    left: 16px;
    right: 16px;
    width: auto;
    height: 1px;
    background: #eee;
    transform: none;
  }

  .nav-item:hover::after,
  .nav-item--active::after {
    transform: none;
    height: 2px;
    background: var(--color-primary);
  }

  .mobile-toggle {
    display: flex;
  }

  .header-auth {
    gap: 8px;
  }

  .btn--login {
    width: auto;
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
  }

  .btn--register {
    padding: 4px 12px;
    font-size: 12px;
  }
}
