/* ======================================
   物电学院设备工具借用管理系统 - 全局样式
   ====================================== */

/* --- 字体 & 根变量 --- */
:root {
  --primary:       #0B6B4E;
  --primary-light: #E8F5F0;
  --primary-dark:  #084D38;
  --accent:        #F59E0B;
  --danger:        #DC2626;
  --success:       #16A34A;
  --bg-page:       #F4F7F6;
  --card-shadow:   0 2px 12px rgba(0,0,0,0.08);
  --radius:        12px;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC", "Microsoft YaHei", "Helvetica Neue",
               Arial, sans-serif;
  background-color: var(--bg-page);
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- 导航栏 --- */
.navbar-custom {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  padding: clamp(0.2rem, 1.2vh, 0.75rem) 0;
  min-height: clamp(38px, 7vh, 60px);
}

.navbar-custom .navbar-brand {
  font-size: clamp(0.85rem, 2vw, 1.1rem);
  letter-spacing: 0.02em;
}

/* --- 底部 --- */
.footer-custom {
  background: #fff;
  border-top: 1px solid #E5EAE8;
  margin-top: auto;
  padding: clamp(0.2rem, 0.8vh, 0.75rem) 0;
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
}

/* --- 卡片通用样式 --- */
.card-custom {
  background: #fff;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.card-custom .card-header-custom {
  background: var(--primary-light);
  border-bottom: 2px solid var(--primary);
  padding: clamp(0.4rem, 1.5vh, 1rem) clamp(0.6rem, 2vw, 1.25rem);
  font-weight: 700;
  font-size: clamp(0.85rem, 1.5vw, 1.05rem);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- 首页大按钮 --- */
.home-btn-card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 2vh, 2.5rem) clamp(0.75rem, 2vw, 1.5rem);
  min-height: clamp(90px, 18vh, 200px);
}

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

.home-btn-card:active {
  transform: translateY(-1px);
}

.home-btn-card.btn-borrow {
  background: linear-gradient(135deg, #0B6B4E 0%, #1D9E75 100%);
  color: #fff;
}

.home-btn-card.btn-return {
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
  color: #fff;
}

.home-btn-card.btn-admin {
  background: linear-gradient(135deg, #374151 0%, #6B7280 100%);
  color: #fff;
}

.home-btn-card .btn-icon {
  font-size: clamp(2rem, 6vw, 3.5rem);
  margin-bottom: clamp(0.3rem, 1vh, 1rem);
  opacity: 0.95;
}

.home-btn-card .btn-title {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.home-btn-card .btn-desc {
  font-size: clamp(0.7rem, 1.2vw, 0.9rem);
  opacity: 0.8;
  text-align: center;
}

/* --- 表单样式 --- */
.form-label {
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.3rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(11, 107, 78, 0.2);
}

.form-control, .form-select {
  border-radius: 8px;
  padding: clamp(0.35rem, 1vh, 0.6rem) clamp(0.5rem, 1.5vw, 0.9rem);
  font-size: clamp(0.85rem, 1.5vw, 1rem);
}

@media (max-width: 768px) {
  .form-control, .form-select {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    padding: clamp(0.5rem, 1.5vh, 0.75rem) clamp(0.75rem, 2vw, 1rem);
    min-height: clamp(40px, 8vh, 52px);
  }
}

/* --- 按钮 --- */
.btn-primary-custom {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.15s;
}

.btn-primary-custom:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

/* --- 页面标题区 --- */
.page-header {
  background: #fff;
  border-radius: var(--radius);
  padding: clamp(0.5rem, 2vh, 1.25rem) clamp(0.75rem, 2vw, 1.5rem);
  margin-bottom: clamp(0.5rem, 2vh, 1.5rem);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-header .page-icon {
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  color: var(--primary);
}

.page-header h2 {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 700;
  color: var(--primary-dark);
}

.page-header p {
  margin: 0.1rem 0 0;
  color: #6B7280;
  font-size: clamp(0.7rem, 1.2vw, 0.9rem);
}

/* --- 工具状态徽章 --- */
.badge-status {
  padding: 0.35em 0.7em;
  border-radius: 6px;
  font-size: clamp(0.68rem, 1.1vw, 0.82rem);
  font-weight: 600;
}

.badge-available  { background: #D1FAE5; color: #065F46; }
.badge-borrowed   { background: #DBEAFE; color: #1E40AF; }
.badge-repair     { background: #FEF3C7; color: #92400E; }
.badge-disabled   { background: #F3F4F6; color: #6B7280; }
.badge-lost       { background: #FEE2E2; color: #991B1B; }
.badge-pending    { background: #FEF3C7; color: #92400E; }
.badge-overdue    { background: #FEE2E2; color: #991B1B; }
.badge-returned   { background: #D1FAE5; color: #065F46; }
.badge-active     { background: #DBEAFE; color: #1E40AF; }

/* --- 表格 --- */
.table-custom {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.table-custom thead th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  border: none;
  padding: clamp(0.35rem, 1vh, 0.85rem) clamp(0.5rem, 1.5vw, 1rem);
  font-size: clamp(0.75rem, 1.2vw, 0.9rem);
}

.table-custom tbody tr:hover {
  background-color: var(--primary-light);
}

.table-custom tbody td {
  padding: clamp(0.35rem, 1vh, 0.8rem) clamp(0.5rem, 1.5vw, 1rem);
  vertical-align: middle;
  border-color: #E5EAE8;
  font-size: clamp(0.75rem, 1.2vw, 0.9rem);
}

/* --- 工具列表卡片 (借用选择) --- */
.tool-select-card {
  border: 2px solid #E5EAE8;
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
  position: relative;
}

.tool-select-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.tool-select-card input[type="radio"] {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.tool-select-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.tool-select-card .tool-name {
  font-weight: 700;
  font-size: 1rem;
  color: #1a1a1a;
}

.tool-select-card .tool-meta {
  font-size: 0.82rem;
  color: #6B7280;
  margin-top: 0.2rem;
}

/* --- 管理员侧边栏 --- */
.admin-sidebar {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  min-height: clamp(200px, 40vh, 300px);
}

.admin-sidebar .sidebar-header {
  background: var(--primary);
  color: #fff;
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.admin-sidebar .nav-link {
  color: #374151;
  padding: 0.75rem 1.25rem;
  border-radius: 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid #F3F4F6;
  transition: all 0.1s;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

/* --- 统计卡片 --- */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: clamp(0.5rem, 2vh, 1.25rem) clamp(0.75rem, 2vw, 1.5rem);
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1.5vw, 1rem);
}

.stat-card .stat-icon {
  width: clamp(36px, 7vh, 52px);
  height: clamp(36px, 7vh, 52px);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  flex-shrink: 0;
}

.stat-card .stat-num {
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  font-weight: 700;
  line-height: 1;
  color: #1a1a1a;
}

.stat-card .stat-label {
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
  color: #6B7280;
  margin-top: 0.2rem;
}

/* --- 登录页 --- */
.login-wrapper {
  min-height: calc(100vh - clamp(38px, 7vh, 60px));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.5rem, 2vh, 2rem) clamp(0.5rem, 2vw, 1rem);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  padding: clamp(1.5rem, 5vh, 2.5rem) clamp(1rem, 3vw, 2rem);
  width: 100%;
  max-width: 420px;
}

.login-card .login-logo {
  text-align: center;
  margin-bottom: clamp(0.75rem, 2vh, 1.5rem);
}

.login-card .login-logo i {
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--primary);
}

.login-card .login-logo h3 {
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 0.5rem;
}

/* --- 摄像头区域 --- */
.camera-box {
  background: #F9FAFB;
  border: 2px dashed #D1D5DB;
  border-radius: 8px;
  overflow: hidden;
}

.camera-box video {
  background: #000;
}
.camera-box img {
  max-height: clamp(120px, 30vh, 300px);
  object-fit: contain;
}
.camera-box [id$="Preview"] {
  min-height: clamp(80px, 18vh, 150px) !important;
}
#toolList {
  max-height: clamp(200px, 50vh, 500px) !important;
}
.review-photo {
  max-height: clamp(90px, 20vh, 160px) !important;
}

/* --- 公共弹窗样式 --- */
.custom-modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.custom-modal-box {
  background: #fff; border-radius: 12px; width: 90%; max-width: 550px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2); overflow: hidden;
}
.custom-modal-header {
  background: var(--primary-light); padding: 1rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 2px solid var(--primary);
}
.custom-modal-header h5 { margin:0; font-weight:700; color:var(--primary-dark); }
.custom-modal-body { padding: clamp(0.75rem, 1.5vh, 1.5rem); max-height: 65vh; overflow-y: auto; }
.custom-modal-footer {
  padding: clamp(0.5rem, 1vh, 1rem) clamp(0.75rem, 1.5vw, 1.5rem);
  display: flex; justify-content: flex-end; gap: 0.75rem;
  border-top: 1px solid #E5EAE8;
}
.fw-500 { font-weight: 500; }

/* --- 步骤指示器 --- */
.step-indicator {
  display: flex; align-items: center; justify-content: center; gap: 0;
  padding: clamp(0.3rem, 1vh, 0.75rem) 0;
}
.step-item { display: flex; align-items: center; gap: 0.4rem; opacity: 0.5; }
.step-item .step-dot {
  width: clamp(26px, 4vh, 32px); height: clamp(26px, 4vh, 32px);
  border-radius: 50%; background: #D1D5DB; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: clamp(0.8rem, 1.5vw, 0.95rem);
  transition: background 0.2s;
}
.step-item span { font-size: clamp(0.7rem, 1.2vw, 0.85rem); color: #6B7280; }
.step-item.active { opacity: 1; }
.step-item.active .step-dot { background: var(--primary); }
.step-item.active span { color: var(--primary-dark); font-weight: 600; }
.step-item.done { opacity: 1; }
.step-item.done .step-dot { background: var(--success); }
.step-item.done span { color: var(--success); }
.step-line {
  width: clamp(40px, 8vw, 80px); height: 2px; background: #D1D5DB;
  margin: 0 clamp(0.3rem, 1vw, 0.75rem); transition: background 0.2s;
}
.step-line.done { background: var(--success); }

