/* ========================================
   宜思教育平台 - 全局样式
   响应式设计：移动优先 → 平板 → 桌面
   ======================================== */

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

:root {
  --primary: #2b6cb0;
  --primary-dark: #1a365d;
  --accent: #3182ce;
  --highlight: #fff176;
  --success: #38a169;
  --warning: #d69e2e;
  --danger: #e53e3e;
  --text: #2d3748;
  --text-light: #718096;
  --bg-light: #f7fafc;
  --border: #e2e8f0;
  --shadow: rgba(0, 0, 0, 0.1);
}

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(135deg, #1a365d 0%, #2c5282 50%, #3182ce 100%);
  min-height: 100vh;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  line-height: 1.6;
}

/* ========================================
   顶部导航栏
   ======================================== */
.top-nav {
  background: linear-gradient(135deg, #1a365d 0%, #2d3748 50%, #1a365d 100%);
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px var(--shadow);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  color: white;
}

.nav-brand-icon {
  font-size: 1.5rem;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-menu a {
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s;
  font-size: 0.9rem;
  white-space: nowrap;
}

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

.nav-menu a.active {
  background: rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.nav-user-link:hover {
  opacity: 0.85;
}

.nav-user-info {
  text-align: right;
  font-size: 0.85rem;
}

.nav-user-name {
  font-weight: 600;
}

.nav-user-role {
  opacity: 0.8;
  font-size: 0.75rem;
}

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.nav-notification {
  position: relative;
  cursor: pointer;
  font-size: 1.3rem;
  padding: 6px;
}

.nav-notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  font-weight: 600;
}

/* 移动端菜单按钮 */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 6px;
}

/* ========================================
   主容器
   ======================================== */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* ========================================
   卡片样式
   ======================================== */
.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px var(--shadow);
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.card-action {
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.card-action:hover {
  text-decoration: underline;
}

/* ========================================
   网格布局
   ======================================== */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ========================================
   功能卡片
   ======================================== */
.feature-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s;
  box-shadow: 0 4px 16px var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.feature-icon {
  font-size: 2.5rem;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: white;
}

.feature-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.feature-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.5;
}

/* ========================================
   按钮样式
   ======================================== */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #2f855a;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

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

.btn-block {
  display: block;
  width: 100%;
}

/* ========================================
   表单样式
   ======================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.3s;
  background: white;
}

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

.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: white;
  cursor: pointer;
}

/* ========================================
   表格样式
   ======================================== */
.table-responsive {
  overflow-x: auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 16px var(--shadow);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table thead {
  background: var(--bg-light);
  border-bottom: 2px solid var(--border);
}

.table th {
  padding: 12px;
  text-align: left;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
  background: var(--bg-light);
}

/* ========================================
   标签样式
   ======================================== */
.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-blue {
  background: rgba(49, 130, 206, 0.1);
  color: var(--accent);
}

.tag-green {
  background: rgba(56, 161, 105, 0.1);
  color: var(--success);
}

.tag-amber {
  background: rgba(214, 158, 46, 0.1);
  color: var(--warning);
}

.tag-red {
  background: rgba(229, 62, 62, 0.1);
  color: var(--danger);
}

/* ========================================
   统计卡片
   ======================================== */
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 16px var(--shadow);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ========================================
   消息通知
   ======================================== */
.message-item {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px var(--shadow);
  border-left: 4px solid var(--accent);
}

.message-item.unread {
  border-left-color: var(--danger);
  background: #fff5f5;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.message-title {
  font-weight: 700;
  font-size: 1rem;
}

.message-time {
  font-size: 0.8rem;
  color: var(--text-light);
}

.message-content {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

/* ========================================
   响应式设计 - 平板（768px+）
   ======================================== */
@media (min-width: 768px) {
  .nav-brand {
    font-size: 1.4rem;
  }

  .nav-menu {
    gap: 12px;
  }

  .nav-menu a {
    padding: 10px 20px;
    font-size: 1rem;
  }

  .main-container {
    padding: 24px 24px;
  }

  .card {
    padding: 24px;
  }

  .feature-card {
    padding: 32px;
  }

  .feature-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
  }
}

/* ========================================
   响应式设计 - 桌面（1024px+）
   ======================================== */
@media (min-width: 1024px) {
  .nav-menu {
    gap: 16px;
  }

  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ========================================
   响应式设计 - 移动端（<768px）
   ======================================== */
@media (max-width: 767px) {
  /* 导航栏移动端 */
  .nav-container {
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: block;
  }

  .nav-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
  }

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

  .nav-menu a {
    width: 100%;
    text-align: center;
  }

  .nav-user {
    margin-left: auto;
  }

  .nav-user-info {
    display: none;
  }

  /* 主容器 */
  .main-container {
    padding: 16px 12px;
  }

  /* 卡片 */
  .card {
    padding: 16px;
    margin-bottom: 12px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* 网格 */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  /* 功能卡片 */
  .feature-card {
    padding: 20px;
  }

  .feature-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
  }

  /* 表格 */
  .table {
    font-size: 0.85rem;
  }

  .table th,
  .table td {
    padding: 8px;
  }

  /* 按钮 */
  .btn {
    padding: 12px 20px;
    font-size: 1rem;
  }

  /* 统计卡片 */
  .stat-value {
    font-size: 1.5rem;
  }
}

/* ========================================
   工具类
   ======================================== */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden {
  display: none !important;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.error {
  background: #fff5f5;
  color: var(--danger);
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid var(--danger);
}

.success {
  background: #f0fff4;
  color: var(--success);
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid var(--success);
}
