/* ===========================
   中华小学新生报名系统 - 全局样式 v3.12
   =========================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #c0392b;
  --primary-dark: #96281b;
  --primary-light: #f5e6e4;
  --gold: #d4a017;
  --gold-light: #f9f0d8;
  --text-primary: #2c2c2c;
  --text-secondary: #666;
  --text-muted: #999;
  --border: #e8e8e8;
  --bg-light: #f7f7f7;
  --bg-white: #fff;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #2980b9;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  overscroll-behavior-y: contain;
  background: var(--bg-light);
  -webkit-font-smoothing: antialiased;
}

/* ===========================
   顶部导航栏
   =========================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(192, 57, 43, 0.3);
}

.navbar-back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

.navbar-back:active {
  background: rgba(255,255,255,0.2);
}

.navbar-back svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.navbar-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.navbar-right {
  width: 32px;
  text-align: right;
  font-size: 13px;
  cursor: pointer;
}

/* ===========================
   页面容器
   =========================== */
.page {
  min-height: 100vh;
  padding-bottom: 80px;
}

.page-with-nav {
  padding-top: 56px;
}

.page-content {
  padding: 16px;
}

/* ===========================
   底部导航栏
   =========================== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  height: 60px;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: color 0.2s;
  color: var(--text-muted);
  text-decoration: none;
}

.tabbar-item.active {
  color: var(--primary);
}

.tabbar-item svg {
  width: 22px;
  height: 22px;
}

.tabbar-item span {
  font-size: 11px;
  font-weight: 500;
}

/* ===========================
   卡片
   =========================== */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
}

.card-body {
  padding: 16px;
}

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

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

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-control {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

.form-control:disabled,
.form-control[readonly] {
  background: var(--bg-light);
  color: var(--text-muted);
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

textarea.form-control {
  height: auto;
  min-height: 80px;
  padding: 10px 12px;
  resize: none;
}

/* ===========================
   按钮
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-appearance: none;
  outline: none;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(192, 57, 43, 0.35);
}

.btn-primary:active {
  box-shadow: 0 1px 6px rgba(192, 57, 43, 0.3);
}

.btn-default {
  background: #fff;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-success {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(39, 174, 96, 0.35);
}

.btn-warning {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(231, 76, 60, 0.35);
}

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

.btn-lg {
  height: 50px;
  font-size: 16px;
  border-radius: var(--radius-sm);
}

.btn-sm {
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
}

/* ===========================
   列表行
   =========================== */
.list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-label {
  width: 90px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.list-item-value {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  text-align: right;
}

/* ===========================
   徽章 / 标签
   =========================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: #e8f8f0;
  color: var(--success);
}

.badge-warning {
  background: #fef6e7;
  color: var(--warning);
}

.badge-danger {
  background: #fdecea;
  color: var(--danger);
}

.badge-info {
  background: #e8f4fd;
  color: var(--info);
}

.badge-default {
  background: #f0f0f0;
  color: var(--text-muted);
}

/* ===========================
   通知单样式
   =========================== */
.notice-card {
  background: linear-gradient(135deg, #fffdf5 0%, #fff8e8 100%);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.notice-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--gold));
}

/* ===========================
   签名画布
   =========================== */
.signature-area {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fafafa;
  position: relative;
  overflow: hidden;
}

.signature-canvas {
  display: block;
  width: 100%;
  cursor: crosshair;
  touch-action: none;
}

/* ===========================
   状态提示
   =========================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.alert-info {
  background: #e8f4fd;
  color: var(--info);
  border-left: 3px solid var(--info);
}

.alert-warning {
  background: #fef6e7;
  color: #856404;
  border-left: 3px solid var(--warning);
}

.alert-success {
  background: #e8f8f0;
  color: #155724;
  border-left: 3px solid var(--success);
}

.alert-danger {
  background: #fdecea;
  color: #721c24;
  border-left: 3px solid var(--danger);
}

/* ===========================
   加载动画
   =========================== */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ===========================
   弹窗
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  width: 100%;
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 16px 40px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
}

/* ===========================
   Toast 提示
   =========================== */
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
}

.toast.show {
  opacity: 1;
}

/* ===========================
   分割线
   =========================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.section-gap {
  height: 8px;
  background: var(--bg-light);
}

/* ===========================
   固定底部操作栏
   =========================== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  gap: 12px;
  z-index: 50;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.bottom-bar .btn {
  flex: 1;
}

/* ===========================
   表单卡片
   =========================== */
.form-card {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}

.form-card-header {
  background: linear-gradient(135deg, #f8f0ee, #fdecea);
  padding: 12px 16px;
  border-bottom: 1px solid #f0d8d8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-card-header-icon {
  font-size: 18px;
}

.form-card-header-title {
  font-size: 14px;
  font-weight: 600;
  color: #c0392b;
}

.form-card-body {
  padding: 16px;
}

/* 两列表单 */
.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* 表单分区标题 */
.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

/* ===========================
   签名区域组件
   =========================== */
.signature-section {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}

.signature-header {
  background: linear-gradient(135deg, #c0392b, #96281b);
  padding: 14px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.signature-title {
  font-size: 15px;
  font-weight: 600;
}

.signature-sub {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 2px;
}

.sig-clear-btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.signature-canvas-wrap {
  padding: 12px;
  background: #fafafa;
}

.sig-canvas {
  display: block;
  width: 100%;
  height: 140px;
  background: #fff;
  border: 1.5px dashed #ddd;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}

.signature-hint-text {
  text-align: center;
  font-size: 12px;
  color: #bbb;
  padding: 8px 0 4px;
}

.signed-display {
  padding: 12px;
  display: none;
}

.signed-display.show { display: block; }

.signed-display img {
  max-width: 100%;
  border: 1px solid #eee;
  border-radius: 8px;
  display: block;
}

.signed-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #27ae60;
  margin-top: 8px;
  font-weight: 500;
}

/* ===========================
   空状态
   =========================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

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

.empty-state-text {
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state-hint {
  font-size: 13px;
}

/* ===========================
   登录页特殊样式
   =========================== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 40%, #1a1a2e 100%);
  overflow: hidden;
}

/* ===========================
   响应式适配
   =========================== */
@media (min-width: 480px) {
  .page-content {
    max-width: 480px;
    margin: 0 auto;
  }
  .tabbar {
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  .navbar {
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  .bottom-bar {
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  body {
    background: #ddd;
  }
}
