/* ===== CSS Variables & Reset ===== */
:root {
  --primary: #1a365d;
  --primary-light: #2c5282;
  --primary-dark: #0f2240;
  --accent: #3182ce;
  --accent-light: #63b3ed;
  --bg: #f7fafc;
  --bg-white: #ffffff;
  --bg-section: #edf2f7;
  --text: #2d3748;
  --text-light: #718096;
  --text-dark: #1a202c;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 8px;
  --transition: all 0.3s ease;
  --max-width: 1100px;
  --nav-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 20px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary);
  text-decoration: underline;
}

img { max-width: 100%; height: auto; }

/* ===== Navigation ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--primary);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.nav-container {
  max-width: var(--max-width);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
  position: relative;
}

.nav-brand {
  position: absolute;
  left: 20px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
}

.nav-links a {
  color: rgba(255,255,255,0.85);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,0.15);
  text-decoration: none;
}

.nav-lang {
  position: absolute;
  right: 20px;
}

.nav-lang a {
  color: rgba(255,255,255,0.85);
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-lang a:hover {
  color: #fff;
  border-color: #fff;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

/* ===== Hero Section ===== */
.hero {
  margin-top: var(--nav-height);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 60px 20px 50px;
}

.hero-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 40px;
}

.hero-photo {
  flex-shrink: 0;
}

.hero-photo img {
  width: 180px;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 3px solid rgba(255,255,255,0.3);
  box-shadow: var(--shadow-lg);
}

.hero-info {
  flex: 1;
}

.hero-info h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.hero-info .title {
  font-size: 17px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.hero-info .affiliation {
  font-size: 15px;
  opacity: 0.8;
  margin-bottom: 16px;
}

.hero-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.hero-contact a {
  color: rgba(255,255,255,0.9);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.2);
  transition: var(--transition);
}

.hero-contact a:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
  text-decoration: none;
}

/* ===== Main Content ===== */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Section Styles ===== */
.section {
  padding: 40px 0;
}

.section:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 24px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 24px;
  background: var(--accent);
  margin-right: 12px;
  vertical-align: middle;
  border-radius: 2px;
}

/* ===== Bio Section ===== */
.bio-text {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
  text-align: justify;
}

.bio-text p {
  margin-bottom: 12px;
}

/* ===== Research Fields ===== */
.research-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.research-list li {
  padding: 12px 16px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
  font-size: 14px;
  transition: var(--transition);
}

.research-list li:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ===== Publications ===== */
.year-group {
  margin-bottom: 24px;
}

.year-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  margin-bottom: 12px;
  user-select: none;
  transition: var(--transition);
}

.year-header:hover {
  background: var(--primary-light);
}

.year-header h3 {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}

.year-header .paper-count {
  font-size: 13px;
  opacity: 0.8;
  margin-right: 12px;
}

.year-header .toggle-icon {
  font-size: 18px;
  transition: transform 0.3s ease;
}

.year-header.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.year-content {
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.year-content.collapsed {
  max-height: 0 !important;
  overflow: hidden;
}

.pub-subsection {
  margin-bottom: 16px;
}

.pub-subsection h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 3px solid var(--accent-light);
}

.pub-item {
  padding: 10px 14px;
  margin-bottom: 6px;
  background: var(--bg-white);
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  line-height: 1.7;
  transition: var(--transition);
  position: relative;
  padding-left: 42px;
}

.pub-item:hover {
  box-shadow: var(--shadow-md);
}

.pub-num {
  position: absolute;
  left: 12px;
  top: 10px;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  min-width: 22px;
}

.pub-item .pub-title {
  font-weight: 600;
  color: var(--text-dark);
}

.pub-item .pub-venue {
  font-style: italic;
  color: var(--accent);
}

.pub-item .pub-note {
  color: var(--text-light);
  font-size: 12.5px;
}

.pub-item .pub-tag {
  display: inline-block;
  padding: 1px 8px;
  background: #ebf8ff;
  color: var(--accent);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}

.pub-item .pub-tag.top {
  background: #fff5f5;
  color: #e53e3e;
}

.pub-item .pub-tag.award {
  background: #fefcbf;
  color: #d69e2e;
}

/* ===== Patents ===== */
.patent-item {
  padding: 10px 14px;
  margin-bottom: 6px;
  background: var(--bg-white);
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  line-height: 1.7;
  position: relative;
  padding-left: 42px;
}

.patent-item .patent-num {
  position: absolute;
  left: 12px;
  top: 10px;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}

/* ===== Awards ===== */
.award-item {
  padding: 12px 16px;
  margin-bottom: 8px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid #ecc94b;
  font-size: 14px;
  line-height: 1.7;
  transition: var(--transition);
  position: relative;
  padding-left: 44px;
}

.award-item:hover {
  box-shadow: var(--shadow-md);
}

.award-num {
  position: absolute;
  left: 14px;
  top: 12px;
  color: #d69e2e;
  font-weight: 700;
  font-size: 13px;
}

/* ===== Services ===== */
.service-list {
  list-style: none;
}

.service-list li {
  padding: 8px 12px;
  margin-bottom: 4px;
  font-size: 14px;
  position: relative;
  padding-left: 24px;
}

.service-list li::before {
  content: '>';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}

/* ===== Footer ===== */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 24px 20px;
  font-size: 13px;
}

.footer a {
  color: rgba(255,255,255,0.85);
}

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
}

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
}

.stat-item .stat-number {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.stat-item .stat-label {
  font-size: 12px;
  opacity: 0.8;
}

/* ===== Search Box ===== */
.search-box {
  margin-bottom: 20px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
  background: var(--bg-white);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49,130,206,0.1);
}

.search-box::before {
  content: '\1F50D';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
}

/* ===== Global Search ===== */
.global-search-section {
  background: var(--bg-section);
  padding: 20px 20px;
  border-bottom: 1px solid var(--border);
}

.global-search-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.global-search-box {
  display: flex;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #fff;
}

.global-search-box input[type="text"] {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-right: none;
  font-size: 15px;
  border-radius: var(--radius) 0 0 var(--radius);
  transition: var(--transition);
}

.global-search-box input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.global-search-box select {
  padding: 12px 12px;
  border: 2px solid var(--border);
  border-left: none;
  border-right: none;
  font-size: 14px;
  background: var(--bg-section);
  color: var(--text);
  cursor: pointer;
}

.global-search-box select:focus {
  outline: none;
}

.global-search-box button {
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: var(--transition);
  white-space: nowrap;
}

.global-search-box button:hover {
  background: var(--primary-light);
}

/* Search Results */
.search-results {
  margin-top: 16px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 600px;
  overflow-y: auto;
}

.search-results-header {
  padding: 14px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-results-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.search-results-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
}

.search-results-close:hover {
  color: #fff;
}

.search-group {
  padding: 12px 20px;
}

.search-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.search-result-item {
  padding: 10px 14px;
  margin-bottom: 6px;
  background: var(--bg-section);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
  transition: var(--transition);
}

.search-result-item:hover {
  background: #ebf8ff;
}

.search-result-item .result-type {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}

.result-type.pub { background: #ebf8ff; color: var(--accent); }
.result-type.pat { background: #f0fff4; color: #38a169; }
.result-type.awd { background: #fefcbf; color: #d69e2e; }

.search-result-item .result-year {
  display: inline-block;
  font-size: 11px;
  color: var(--text-light);
  margin-left: 4px;
}

.search-result-item mark {
  background: #fefcbf;
  padding: 0 2px;
  border-radius: 2px;
}

.search-no-results {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 15px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-brand { display: none; }
  .nav-lang { position: static; }

  .nav-container {
    flex-direction: column;
    gap: 0;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    padding: 8px 0;
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links a {
    text-align: center;
    padding: 10px;
  }

  .nav-toggle {
    display: block;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
  }

  .nav-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .navbar {
    height: auto;
    min-height: var(--nav-height);
    flex-wrap: wrap;
  }

  .hero-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero-contact {
    justify-content: center;
  }

  .hero-info h1 { font-size: 26px; }

  .stats-bar {
    justify-content: center;
  }

  .research-list {
    grid-template-columns: 1fr;
  }

  .section-title { font-size: 20px; }

  .global-search-box {
    flex-wrap: wrap;
  }
  .global-search-box input[type="text"] {
    border-radius: var(--radius) var(--radius) 0 0;
    border-right: 2px solid var(--border);
    border-bottom: none;
  }
  .global-search-box select {
    flex: 1;
    border-left: 2px solid var(--border);
    border-radius: 0 0 0 var(--radius);
  }
  .global-search-box button {
    border-radius: 0 0 var(--radius) 0;
  }
}

@media (max-width: 480px) {
  .hero { padding: 40px 16px 30px; }
  .hero-photo img { width: 140px; height: 170px; }
  .pub-item, .patent-item { padding-left: 36px; font-size: 13px; }
  .section { padding: 30px 0; }
}

/* ===== Print Styles ===== */
@media print {
  .navbar, .back-to-top, .search-box, .nav-toggle { display: none !important; }
  .hero { margin-top: 0; }
  .year-content.collapsed { max-height: none !important; }
  body { font-size: 12px; }
}

/* ===== Admin Styles ===== */
.admin-container {
  max-width: 900px;
  margin: calc(var(--nav-height) + 30px) auto 30px;
  padding: 0 20px;
}

.admin-login {
  max-width: 400px;
  margin: calc(var(--nav-height) + 80px) auto;
  padding: 40px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.admin-login h2 {
  color: var(--primary);
  margin-bottom: 24px;
  font-size: 22px;
}

.admin-login input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  margin-bottom: 16px;
  transition: var(--transition);
}

.admin-login input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  background: var(--primary-light);
}

.btn-accent {
  background: var(--accent);
}

.btn-accent:hover {
  background: var(--primary-light);
}

.btn-danger {
  background: #e53e3e;
}

.btn-danger:hover {
  background: #c53030;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.admin-section {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.admin-section-header {
  padding: 14px 20px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-section-body {
  padding: 20px;
}

.admin-section textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: var(--transition);
}

.admin-section textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  justify-content: flex-end;
}

.msg-success {
  color: #38a169;
  background: #f0fff4;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid #c6f6d5;
}

.msg-error {
  color: #e53e3e;
  background: #fff5f5;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid #fed7d7;
}
