/**
 * 川农就业 · 网页端全局样式
 * 设计：移动优先、清晰层次、可访问焦点、安全区适配
 */

:root {
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", monospace;

  --bg: #f0f2fb;
  --bg-accent: linear-gradient(165deg, #eef1ff 0%, #e8ecff 45%, #f5f3ff 100%);
  --accent: #4f5fe6;
  --accent-hover: #3d4fd4;
  --accent-soft: rgba(79, 95, 230, 0.12);
  --accent2: #7b6fd8;
  --text: #141826;
  --text2: #4a5168;
  --text3: #8b92a8;
  --danger: #e5394b;
  --success: #0d9f6e;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --border: rgba(120, 130, 200, 0.22);
  --border-strong: rgba(79, 95, 230, 0.35);
  --shadow-sm: 0 1px 3px rgba(20, 24, 38, 0.06);
  --shadow: 0 8px 32px rgba(79, 95, 230, 0.1);
  --shadow-lg: 0 16px 48px rgba(45, 55, 120, 0.12);
  --radius: 14px;
  --radius-pill: 999px;
  --space: 16px;
  --topbar-h: 56px;
  --ease: cubic-bezier(0.33, 1, 0.68, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-accent);
  background-color: var(--bg);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* —— 顶栏 —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0);
  background: linear-gradient(135deg, #4f5fe6 0%, #6b5fd8 55%, #7a6fd0 100%);
  color: #fff;
  box-shadow: var(--shadow);
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  min-height: var(--topbar-h);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topbar-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  justify-content: flex-end;
}

.topbar-nav a,
.topbar a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 10px;
  transition: background 0.2s var(--ease);
}

.topbar-nav a:hover,
.topbar a:hover {
  background: rgba(255, 255, 255, 0.15);
}

.topbar-nav a:focus-visible,
.topbar a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.topbar-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.95);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px calc(80px + env(safe-area-inset-bottom, 0));
}

@media (min-width: 900px) {
  .container {
    max-width: 880px;
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* —— 登录页 —— */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.login-hero {
  text-align: center;
  padding: 28px 20px 20px;
  color: var(--text2);
}

.login-hero .brand-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  letter-spacing: -0.05em;
}

.login-hero .login-title {
  margin: 0 0 8px;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.login-hero .login-sub {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text3);
}

.login-body {
  flex: 1;
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  padding: 0 18px 32px;
}

/* 分段控件（登录/注册） */
.segmented {
  display: flex;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}

.segmented button {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s;
}

.segmented button.active {
  background: linear-gradient(135deg, var(--accent), #6b5fd8);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 95, 230, 0.35);
}

.segmented button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* —— 卡片 —— */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.card-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* —— 表单字段 —— */
.field {
  margin-bottom: 16px;
}

.field:last-of-type {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-solid);
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--text3);
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-strong);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* —— 按钮 —— */
.btn {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #6b5fd8);
  box-shadow: 0 8px 24px rgba(79, 95, 230, 0.32);
  transition: transform 0.15s var(--ease), box-shadow 0.2s, opacity 0.2s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(79, 95, 230, 0.38);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(79, 95, 230, 0.2);
}

.btn-danger {
  background: rgba(229, 57, 75, 0.12);
  color: var(--danger);
  box-shadow: none;
}

.btn-sm {
  width: auto;
  padding: 8px 16px;
  font-size: 0.9rem;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-row .btn {
  flex: 1;
  min-width: 120px;
}

/* —— 首页欢迎区 —— */
.welcome-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.welcome-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.welcome-text .page-title {
  margin: 0 0 4px;
}

.welcome-text .page-sub {
  margin: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 0.04em;
}

/* —— 导航网格 —— */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 520px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.grid a.nav-card,
a.nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 108px;
  padding: 18px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
}

.grid a:hover,
a.nav-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.grid a:focus-visible,
a.nav-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.nav-card-icon {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 10px;
  filter: grayscale(0.1);
}

.nav-card-label {
  text-align: center;
  line-height: 1.35;
}

/* 兼容旧 grid 无 nav-card */
.grid a:not(.nav-card) span.ico {
  font-size: 28px;
  margin-bottom: 8px;
}

.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.list-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

.list-item h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
}

.list-item p {
  margin: 0;
  color: var(--text2);
  font-size: 0.88rem;
}

.modal-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 28, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-mask.show {
  display: flex;
}

.modal-box {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom, 0));
  transform: translateX(-50%) translateY(16px);
  padding: 12px 22px;
  max-width: min(90vw, 360px);
  text-align: center;
  background: rgba(28, 32, 48, 0.94);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.err {
  background: rgba(180, 45, 58, 0.96);
}

.page-title {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.page-sub {
  color: var(--text3);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tabs button {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-solid);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}

.tabs button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.page-footer-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text3);
  margin-top: 28px;
  padding: 0 12px;
  line-height: 1.6;
}

/* 列表链接行（我的页等） */
.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.15s;
}

.link-row:last-child {
  border-bottom: none;
}

.link-row:hover {
  color: var(--accent);
}

.link-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 8px;
}

.link-chevron {
  color: var(--text3);
  font-size: 1.1rem;
}

/* 搜索框强调 */
input[type="search"],
.search-input {
  margin-bottom: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
