/* ========================================
   后台管理系统样式
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
  font-size: 14px;
  color: #333;
  background: #f0f2f5;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* ========================================
   登录页
   ======================================== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 30%, #7dd3fc 60%, #38bdf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  top: -150px;
  right: -100px;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  bottom: -100px;
  left: -80px;
}

.login-container {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 0 25px 80px rgba(14, 165, 233, 0.2);
  overflow: hidden;
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.login-header {
  padding: 40px 40px 20px;
  text-align: center;
}

.login-header .logo-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid #0ea5e9;
  object-fit: cover;
  margin-bottom: 16px;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}

.login-header h1 {
  font-size: 22px;
  color: #262626;
  margin-bottom: 8px;
}

.login-header p {
  font-size: 13px;
  color: #8c8c8c;
}

.login-form {
  padding: 20px 40px 40px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #595959;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.3s;
  outline: none;
}

.form-group input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.login-btn {
  width: 100%;
  height: 46px;
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 4px;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.35);
}

.login-btn:hover {
  opacity: 0.95;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.45);
}

.login-btn:active {
  transform: translateY(0);
}

.login-tips {
  margin-top: 20px;
  padding: 12px;
  background: #e6f7ff;
  border-radius: 6px;
  font-size: 12px;
  color: #1890ff;
  line-height: 1.6;
}

/* ========================================
   后台布局
   ======================================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* 水印 */
.watermark {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99999;
}

/* 侧边栏 */
.sidebar {
  width: 220px;
  background: #001529;
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #002140;
  border-bottom: 1px solid #000;
  padding: 0 12px;
}

.sidebar-logo-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-right: 10px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.sidebar-logo-text {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-menu {
  padding: 10px 0;
}

.menu-item {
  position: relative;
}

.menu-item > a {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  color: rgba(255, 255, 255, 0.75);
  transition: all 0.3s;
  cursor: pointer;
}

.menu-item > a:hover,
.menu-item.active > a {
  color: #fff;
  background: #1890ff;
}

.menu-item .menu-icon {
  width: 20px;
  margin-right: 10px;
  font-size: 16px;
}

.menu-item .menu-text {
  flex: 1;
}

.submenu {
  background: #000c17;
  display: none;
}

.menu-item.open .submenu {
  display: block;
}

.submenu li a {
  display: block;
  padding: 10px 24px 10px 54px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  transition: all 0.3s;
}

.submenu li a:hover,
.submenu li.active a {
  color: #fff;
  background: #1890ff;
}

/* 主内容区 */
.main-wrapper {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 顶部栏 */
.header-bar {
  height: 60px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 99;
}

.header-left {
  font-size: 16px;
  font-weight: 500;
  color: #262626;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1890ff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.user-name {
  font-size: 14px;
  color: #595959;
}

.logout-btn {
  color: #ff4d4f;
  cursor: pointer;
  font-size: 14px;
}

.logout-btn:hover {
  opacity: 0.8;
}

/* 内容区 */
.content-wrapper {
  flex: 1;
  padding: 24px;
}

.page-title {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 20px;
  color: #262626;
}

/* 卡片 */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 24px;
  margin-bottom: 20px;
}

/* 统计卡片 */
.stat-card {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 20px;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: #262626;
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: #8c8c8c;
  margin-top: 4px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.card-title {
  font-size: 16px;
  font-weight: 500;
  color: #262626;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.3s;
}

.btn-primary {
  background: #1890ff;
  color: #fff;
  border-color: #1890ff;
}

.btn-primary:hover {
  background: #40a9ff;
  border-color: #40a9ff;
}

.btn-default {
  background: #fff;
  color: #595959;
  border-color: #d9d9d9;
}

.btn-default:hover {
  color: #1890ff;
  border-color: #1890ff;
}

.btn-danger {
  background: #ff4d4f;
  color: #fff;
  border-color: #ff4d4f;
}

.btn-danger:hover {
  background: #ff7875;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}

/* 数据统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.stat-icon.blue { background: #e6f7ff; color: #1890ff; }
.stat-icon.green { background: #f6ffed; color: #52c41a; }
.stat-icon.orange { background: #fff7e6; color: #fa8c16; }
.stat-icon.purple { background: #f9f0ff; color: #722ed1; }

.stat-info h3 {
  font-size: 28px;
  font-weight: 600;
  color: #262626;
  margin-bottom: 4px;
}

.stat-info p {
  font-size: 13px;
  color: #8c8c8c;
}

/* 表格 */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table th {
  background: #fafafa;
  font-weight: 500;
  color: #595959;
  font-size: 13px;
}

.data-table td {
  color: #262626;
  font-size: 14px;
}

.data-table tbody tr:hover {
  background: #fafafa;
}

.table-actions {
  display: flex;
  gap: 8px;
}

/* 搜索表单 */
.search-form {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-form .form-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-form label {
  font-size: 14px;
  color: #595959;
  white-space: nowrap;
}

.search-form input,
.search-form select {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
  min-width: 160px;
}

.search-form input:focus,
.search-form select:focus {
  border-color: #1890ff;
}

/* 表单弹窗 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 16px;
  font-weight: 500;
}

.modal-close {
  cursor: pointer;
  font-size: 20px;
  color: #8c8c8c;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f0f0f0;
  text-align: right;
}

.modal-footer .btn {
  margin-left: 8px;
}

/* 表单 */
.form-row {
  margin-bottom: 20px;
}

.form-row label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #595959;
}

.form-row label .required {
  color: #ff4d4f;
  margin-right: 4px;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: #1890ff;
}

.form-row textarea {
  min-height: 100px;
  resize: vertical;
}

.form-row-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* 分页 */
.pagination-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

.pagination-bar .total {
  font-size: 13px;
  color: #8c8c8c;
  margin-right: 10px;
}

.pagination-bar button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.pagination-bar button.active {
  background: #1890ff;
  border-color: #1890ff;
  color: #fff;
}

.pagination-bar button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* 状态标签 */
.status-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.status-tag.success {
  background: #f6ffed;
  color: #52c41a;
  border: 1px solid #b7eb8f;
}

.status-tag.warning {
  background: #fffbe6;
  color: #faad14;
  border: 1px solid #ffe58f;
}

.status-tag.error {
  background: #fff2f0;
  color: #ff4d4f;
  border: 1px solid #ffccc7;
}

.status-tag.info {
  background: #e6f7ff;
  color: #1890ff;
  border: 1px solid #91d5ff;
}

/* 富文本编辑器区域 */
.editor-toolbar {
  border: 1px solid #d9d9d9;
  border-bottom: none;
  padding: 8px 12px;
  background: #fafafa;
  border-radius: 4px 4px 0 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-toolbar button {
  padding: 4px 8px;
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
}

.editor-toolbar button:hover {
  background: #1890ff;
  border-color: #1890ff;
  color: #fff;
}

.editor-toolbar .toolbar-divider {
  width: 1px;
  height: 20px;
  background: #d9d9d9;
  margin: 0 4px;
}

.editor-content {
  min-height: 300px;
  padding: 12px;
  border: 1px solid #d9d9d9;
  border-radius: 0 0 4px 4px;
  outline: none;
  line-height: 1.6;
}

.editor-content:focus {
  border-color: #1890ff;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.schedule-table th,
.schedule-table td {
  border: 1px solid #d9d9d9;
  padding: 8px;
  text-align: center;
}

.schedule-table th {
  background: #f5f5f5;
  font-weight: 600;
  font-size: 13px;
}

.schedule-table td:first-child {
  background: #fafafa;
  font-weight: 500;
}

.schedule-table .schedule-cell {
  min-height: 60px;
  vertical-align: top;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.schedule-table .schedule-cell:hover {
  background: #fffbe6;
}

.schedule-table .schedule-cell.has-course {
  background: #e6f7ff;
  border-color: #91d5ff;
}

.schedule-table .schedule-cell .course-name {
  font-weight: 600;
  font-size: 12px;
  color: #1890ff;
}

.schedule-table .schedule-cell .teacher-name {
  font-size: 11px;
  color: #666;
  margin-top: 2px;
}

.schedule-table .schedule-cell .classroom {
  font-size: 10px;
  color: #999;
  margin-top: 2px;
}

.schedule-table .schedule-cell.empty:hover {
  background: #e6f7ff;
  cursor: pointer;
}

.schedule-table .schedule-cell.status-danger {
  background: #fff7e6;
  border-color: #ffd591;
}

.schedule-table .schedule-cell.status-danger .course-name {
  color: #fa8c16;
}

/* 宿舍表格样式 */
#dormViewContainer .schedule-table {
  min-width: 900px;
}

#dormViewContainer .schedule-table th {
  min-width: 70px;
}

/* 宿舍卡片样式 */
.dorm-room-card {
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}

.dorm-room-card:hover {
  border-color: #1890ff;
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

.dorm-room-card .room-header {
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  margin-bottom: 8px;
  color: #333;
}

.dorm-room-card .room-beds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.dorm-room-card .bed {
  width: 100%;
  height: 30px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
}

.dorm-room-card .bed.occupied {
  background: #e6f7ff;
  color: #1890ff;
  border: 1px solid #91d5ff;
}

.dorm-room-card .bed.empty {
  background: #f6ffed;
  color: #52c41a;
  border: 1px dashed #b7eb8f;
}

.dorm-room-card .room-footer {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin-top: 8px;
}

/* 教职工宿舍卡片样式优化 */
#teacherDormFloorContainer .dorm-room-card {
  min-width: 160px;
}

#teacherDormFloorContainer .bed {
  cursor: pointer;
  transition: all 0.2s;
}

#teacherDormFloorContainer .bed:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* 学生列表项样式 */
.student-item {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.student-item:hover {
  background: #e6f7ff;
}

.student-item:last-child {
  border-bottom: none;
}

/* 值班表格样式 */
#dutyViewContainer .schedule-table {
  min-width: 900px;
}

#dutyViewContainer .schedule-table th {
  min-width: 100px;
}

#dutyViewContainer .schedule-table .duty-type-cell {
  cursor: pointer;
  background: #f5f5f5;
  position: relative;
}

#dutyViewContainer .schedule-table .duty-type-cell:hover {
  background: #e8f4fd;
}

#dutyViewContainer .schedule-table .duty-type-cell .duty-type-edit {
  float: right;
  font-size: 12px;
  color: #999;
  opacity: 0;
  transition: opacity 0.2s;
}

#dutyViewContainer .schedule-table .duty-type-cell:hover .duty-type-edit {
  opacity: 1;
}

.duty-type-menu {
  position: fixed;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 150px;
  padding: 4px 0;
}

.duty-type-menu div {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
}

.duty-type-menu div:hover {
  background: #f0f0f0;
}

/* 状态标签 */
.status-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.status-pending {
  background: #fff7e6;
  color: #fa8c16;
}

.status-processing {
  background: #e6f7ff;
  color: #1890ff;
}

.status-completed {
  background: #f6ffed;
  color: #52c41a;
}

/* 上传区域 */
.upload-area {
  border: 2px dashed #d9d9d9;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.upload-area:hover {
  border-color: #1890ff;
  background: #e6f7ff;
}

.upload-area .upload-icon {
  font-size: 48px;
  color: #8c8c8c;
  margin-bottom: 12px;
}

.upload-area p {
  color: #8c8c8c;
  font-size: 14px;
}

.upload-preview {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.upload-preview .preview-item {
  width: 100px;
  height: 100px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  border: 1px solid #d9d9d9;
}

.upload-preview .preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-preview .preview-item .remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}

/* 汉堡菜单按钮 */
.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-right: 8px;
  flex-direction: column;
  justify-content: space-between;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 3px;
  background: #262626;
  border-radius: 2px;
  transition: all 0.3s;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* 移动端遮罩层 */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

/* 响应式 */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .header-bar {
    padding: 0 16px;
  }

  .header-left {
    font-size: 15px;
  }

  .user-name {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row-inline {
    grid-template-columns: 1fr;
  }

  .content-wrapper {
    padding: 16px;
  }
}
