/* ===========================
   1. Variables - My Theme Colors
   =========================== */
:root {
  /* personal colors */
  --primary: #006C66;   /* MPI Green - used for sidebar and headings */
  --secondary: #4B5563; /* Cool Grey - used for secondary text */
  --accent: #3B82F6;    /* Bright Blue - used for highlights and progress bars */
  --bg: #f9f9f9;        /* Overall page background */
  --text: #111;         /* Main text color */
  
  /* TypeIt cursor color (using Accent color here for consistency) */
  --ti-cursor-color: var(--accent);
}

/* ===========================
   2. Reset & Basics
   =========================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', sans-serif; /* Your specified font */
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: var(--primary); /* Links in main text use primary color by default */
  transition: all 0.2s ease;
}

a:hover {
  color: var(--accent); /* Turns blue on hover */
  text-decoration: underline;
}

/* ===========================
   3. Layout Structure
   =========================== */
.layout {
  display: flex;       /* Enable left-right columns */
  min-height: 100vh;   /* Full screen height */
}

/* ===========================
   4. Sidebar - Using your --primary green
   =========================== */
.sidebar {
  width: 300px;
  background-color: var(--primary); /* Key change: sidebar becomes MPI green */
  color: white;        /* White text on green background */
  padding: 40px 30px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  text-align: left;    /* Left-align sidebar text for professionalism */
}

.sidebar .avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 20px;
  border: 4px solid rgba(255, 255, 255, 0.2); /* Semi-transparent border */
}

.sidebar h2 {
  color: white; /* Override global h2 color, must be white here */
  font-size: 1.8rem;
  margin-bottom: 5px;
}

.sidebar .subtitle {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8); /* Slightly transparent white */
  margin-bottom: 30px;
  font-weight: 300;
}

/* Sidebar links */
.sidebar a {
  color: white;
  opacity: 0.7;
  text-decoration: none;
}
.sidebar a:hover {
  color: white;
  opacity: 1;
  text-decoration: none; /* Sidebar links don't need underline, highlight only */
}

/* Sidebar navigation */
.sidebar-extra nav a {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Divider line */
  font-size: 1.1rem;
}

.sidebar .personal-info {
  list-style: none;
  font-size: 0.9rem;
  margin-bottom: 40px;
}
.sidebar .personal-info li {
  margin-bottom: 8px;
}

/* ===========================
   5. Content Area  
   =========================== */
.content-area {
  flex-grow: 1;
  background-color: white; /* Content area remains white for cleanliness */
  padding: 60px 80px;
}

/* Content area headings */
h1, h2, h3 {
  color: var(--primary); /* Using MPI green */
  font-weight: 700;
}

h2 {
  border-bottom: 2px solid var(--bg); /* Add a light gray line under headings */
  padding-bottom: 10px;
  margin-top: 40px;
  margin-bottom: 20px;
}

/* ===========================
   6. Components Styles (Cards & Skills)
   =========================== */
/* Card style optimization */
.card {
  border: 1px solid #e5e7eb;
  border-left: 4px solid var(--primary); /* Add a green bar on the left for design */
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
  background: white;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Skill Bar */
.skill {
  margin: 15px 0;
}
.skill-name {
  font-weight: bold;
  color: var(--secondary);
}
.skill-bar {
  height: 8px;
  background-color: #e5e7eb; /* Track color */
  border-radius: 4px;
  overflow: hidden;
  margin-top: 5px;
}
.skill-bar-fill {
  display: block;
  height: 100%;
  background-color: var(--accent); /* Using your blue Accent */
  width: 0; /* JS controls width */
  transition: width 1.5s ease-in-out;
}

/* ===========================
   7. Typewriter Area (TypeIt)
   =========================== */
#type-text {
  min-height: 120px;
  font-size: 1.1rem;
  color: var(--secondary); /* Self-introduction in dark gray, not glaring */
}
/* Your CSS defines ti-cursor-color, TypeIt will automatically read it */

/* ===========================
   8. Responsive Adaptation (Mobile)
   =========================== */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    text-align: center;
    padding: 30px 20px;
    align-items: center; /* Center content on mobile */
  }

  .sidebar-extra nav a {
    display: inline-block; /* Arrange navigation horizontally on mobile */
    margin: 0 10px;
    border-bottom: none;
  }

  .content-area {
    padding: 30px 20px;
  }
}

/* ===========================
   3. 侧边栏 (Sidebar) - 固定 + 动画
   =========================== */
.sidebar {
  width: 300px;
  background-color: var(--primary);
  color: white;
  padding: 40px 30px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  text-align: left;
  
  /* --- 新增的核心代码 --- */
  position: sticky; /* 关键：让它固定在窗口 */
  top: 0;           /* 紧贴顶部 */
  height: 100vh;    /* 占满全屏高度 */
  overflow-y: auto; /* 如果侧边栏内容太多，允许内部滚动 */
  
  /* 动画过渡效果 */
  transition: margin-left 0.3s ease-in-out; 
  z-index: 100;     /* 保证它在层级上方 */
}

/* 当侧边栏被收起时的样式 */
.sidebar.collapsed {
  margin-left: -300px; /* 通过负边距把它藏到屏幕左边去 */
}

/* ===========================
   新增：折叠切换按钮 (Toggle Button)
   =========================== */
#sidebar-toggle {
  position: fixed; /* 固定在屏幕左上角 */
  top: 15px;
  left: 15px;
  z-index: 200;    /* 必须比 sidebar 层级高，否则点不到 */
  
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--primary);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  
  transition: left 0.3s ease-in-out, background 0.2s;
}

#sidebar-toggle:hover {
  background: white;
  color: var(--accent);
}

/* ===========================
   学术主页组件升级包
   =========================== */
/* ===========================
   主页美化专用样式 (Home Polish)
   =========================== */

/* 调整每个 Section 的间距 */
.section-group {
  margin-bottom: 50px;
}

/* 统一标题样式 */
.section-group h2 {
  font-size: 1.5rem;
  color: var(--primary, #006C66); /* 使用主色 */
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f1f5f9; /* 标题下加一条淡淡的线 */
}

/* ---------------------------
   1. News 列表样式 (通知条)
   --------------------------- */
/* 选中 id="news" 后面的 ul */
h2#news + ul {
  list-style: none;
  padding-left: 0;
}

h2#news + ul li {
  position: relative;
  background-color: #f0fdfa; /* 极淡的绿色背景 */
  border-left: 4px solid var(--primary, #006C66); /* 左侧强调线 */
  padding: 12px 18px;
  margin-bottom: 10px;
  border-radius: 4px; /* 轻微圆角 */
  font-size: 0.95rem;
  color: #333;
  transition: transform 0.2s ease;
}

h2#news + ul li:hover {
  transform: translateX(5px); /* 鼠标悬停时右移 */
  background-color: #e6fffa;  /* 颜色稍微变深 */
}

h2#news + ul li strong {
  color: var(--primary, #006C66);
  margin-right: 8px;
}

/* ---------------------------
   2. Publications 卡片样式
   --------------------------- */
.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-left: 4px solid var(--primary, #006C66); /* 左侧绿线呼应 */
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px); /* 悬停上浮 */
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08); /* 投影 */
  border-color: var(--primary, #006C66);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.4;
}

.card p {
  margin-bottom: 15px;
  color: #555;
  font-size: 0.95rem;
}

/* 会议名称小标签 (Badge) */
.badge {
  display: inline-block;
  background-color: var(--primary, #006C66);
  color: white;
  padding: 4px 10px;
  border-radius: 20px; /* 胶囊形状 */
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-right: 10px;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.card-links a {
  font-size: 0.9rem;
  color: var(--primary, #006C66);
  font-weight: 600;
  margin-right: 12px;
  text-decoration: none;
  transition: color 0.2s;
}

.card-links a:hover {
  text-decoration: underline;
  color: #004d49;
}

/* ---------------------------
   3. Service 列表样式 (清单)
   --------------------------- */
h2#service + ul {
  list-style: none;
  padding-left: 10px;
}

h2#service + ul li {
  position: relative;
  padding-left: 28px; /* 给图标留位置 */
  margin-bottom: 12px;
  color: #444;
  line-height: 1.6;
}

/* 使用 FontAwesome 的对勾图标 */
h2#service + ul li::before {
  content: "\f00c"; /* check 图标代码 */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--primary, #006C66);
  position: absolute;
  left: 0;
  top: 3px;
  font-size: 1rem;
}

/* ===========================
   侧边栏地图挂件样式
   =========================== */
.sidebar-map {
  margin-top: auto; /* 关键：这会让地图自动被推到侧边栏的最底部 */
  padding-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.1); /* 加一条淡淡的分割线 */
  text-align: center; /* 让地图居中 */
  width: 100%;
  overflow: hidden; /* 防止地图太大撑破布局 */
}

/* 针对 RevolverMaps 的 Canvas 进行强制缩放适配 */
.sidebar-map canvas {
  max-width: 100% !important;
  height: auto !important;
}
