/* ============================================================
   宏璞成绩管理系统 - 公共样式
   ============================================================ */

:root {
  --c-primary:       #FF5722;
  --c-primary-light: #FF8A65;
  --c-primary-dark:  #E64A19;
  --c-primary-bg:    #FFF3EF;
  --c-accent:        #1976D2;
  --c-accent-light:  #42A5F5;
  --c-success:       #43A047;
  --c-warning:       #FB8C00;
  --c-error:         #E53935;
  --c-male:          #1565C0;
  --c-male-light:    #E3F2FD;
  --c-female:        #C2185B;
  --c-female-light:  #FCE4EC;

  --c-bg:            #F4F6F9;
  --c-surface:       #FFFFFF;
  --c-border:        #E0E4EA;
  --c-text-primary:  #1A1E2D;
  --c-text-secondary:#64748B;
  --c-text-muted:    #9AA5B4;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --shadow-xs:  0 1px 3px rgba(0,0,0,.06);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.08);
  --shadow-md:  0 6px 20px rgba(0,0,0,.10);
  --shadow-lg:  0 12px 36px rgba(0,0,0,.13);

  --transition: .22s cubic-bezier(.4,0,.2,1);

  --font: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
}

/* ============================================================
   基础重置
   ============================================================ */

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

html, body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--c-primary);
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition);
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  outline: none;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: var(--transition);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--c-primary);
}

/* ============================================================
   布局
   ============================================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   导航栏
   ============================================================ */

.navbar {
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--c-primary);
}

.navbar-brand .logo {
  width: 36px;
  height: 36px;
  background: var(--c-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

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

.navbar-username {
  color: var(--c-text-secondary);
  font-size: 14px;
}

.navbar-role {
  background: var(--c-primary-bg);
  color: var(--c-primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   按钮
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

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

.btn-primary:hover {
  background: var(--c-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  color: var(--c-primary);
  border: 1.5px solid var(--c-primary);
}

.btn-outline:hover {
  background: var(--c-primary-bg);
}

.btn-secondary {
  background: var(--c-bg);
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border);
}

.btn-secondary:hover {
  background: var(--c-border);
}

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

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

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

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

/* ============================================================
   卡片
   ============================================================ */

.card {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text-primary);
}

/* ============================================================
   表格
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
}

th {
  background: var(--c-bg);
  font-weight: 600;
  color: var(--c-text-secondary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:hover {
  background: var(--c-bg);
}

/* ============================================================
   表单
   ============================================================ */

.form-group {
  margin-bottom: 16px;
}

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

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.1);
}

.form-error {
  color: var(--c-error);
  font-size: 12px;
  margin-top: 4px;
}

/* ============================================================
   成绩展示
   ============================================================ */

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.score-item {
  background: var(--c-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.score-item-name {
  font-size: 12px;
  color: var(--c-text-secondary);
  margin-bottom: 4px;
}

.score-item-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text-primary);
}

.score-item-total {
  font-size: 12px;
  color: var(--c-text-muted);
}

.score-item.full .score-item-value {
  color: var(--c-success);
}

.score-item.partial .score-item-value {
  color: var(--c-warning);
}

/* ============================================================
   Tabs
   ============================================================ */

.tabs {
  display: flex;
  gap: 4px;
  background: var(--c-bg);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 10px 16px;
  text-align: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-secondary);
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  border: none;
}

.tab.active {
  background: var(--c-surface);
  color: var(--c-primary);
  box-shadow: var(--shadow-xs);
}

.tab:hover:not(.active) {
  color: var(--c-text-primary);
}

/* ============================================================
   空状态
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--c-text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state-text {
  font-size: 16px;
  margin-bottom: 20px;
}

/* ============================================================
   登录页
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
  padding: 20px;
}

.login-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  background: var(--c-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
  margin: 0 auto 12px;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--c-text-primary);
}

.login-subtitle {
  font-size: 14px;
  color: var(--c-text-muted);
  margin-top: 4px;
}

.role-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.role-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.role-btn.active {
  border-color: var(--c-primary);
  background: var(--c-primary-bg);
  color: var(--c-primary);
}

/* ============================================================
   移动端适配
   ============================================================ */

@media (max-width: 768px) {
  .container {
    padding: 0 12px;
  }

  .card {
    padding: 16px;
  }

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

  .table-wrapper {
    overflow-x: scroll;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 8px 10px;
  }

  .login-card {
    padding: 24px;
  }
}

/* ============================================================
   工具类
   ============================================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--c-text-muted); }
.text-success { color: var(--c-success); }
.text-warning { color: var(--c-warning); }
.text-error { color: var(--c-error); }

.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; }

.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* 加载动画 */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--c-text-secondary);
  cursor: pointer;
  border: none;
}

.modal-close:hover {
  background: var(--c-border);
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}
