/* ==========================================
   家庭火灾安全科普网页 · 共享样式
   暗色科技风 · 青蓝霓虹 · 响应式
   ========================================== */

/* --- CSS 自定义属性 (主题色) --- */
:root {
  --fire-bg: #0a0e17;
  --fire-bg-card: rgba(14, 20, 33, 0.85);
  --fire-primary: #00e5ff;
  --fire-primary-glow: rgba(0, 229, 255, 0.35);
  --fire-accent: #ff6d3a;
  --fire-danger: #ff3860;
  --fire-safe: #00e676;
  --fire-warn: #ffab00;
  --fire-text: #d0d6e0;
  --fire-text-dim: #8892a4;
  --fire-border: rgba(0, 229, 255, 0.25);
  --fire-radius: 12px;
  --fire-radius-sm: 8px;
  --fire-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --fire-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --fire-grid-color: rgba(0, 229, 255, 0.06);
  --fire-grid-size: 40px;
}

/* 大字模式 */
body.large-text {
  font-size: 1.25rem;
}
body.large-text h1 { font-size: 2.5rem; }
body.large-text h2 { font-size: 2rem; }
body.large-text h3 { font-size: 1.5rem; }
body.large-text button,
body.large-text .btn { font-size: 1.15rem; padding: 0.8em 1.6em; }

/* --- 基础重置 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--fire-font);
  background: var(--fire-bg);
  color: var(--fire-text);
  line-height: 1.6;
  min-height: 100vh;
  /* 深色网格背景 */
  background-image:
    linear-gradient(var(--fire-grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--fire-grid-color) 1px, transparent 1px);
  background-size: var(--fire-grid-size) var(--fire-grid-size);
  background-attachment: fixed;
}

/* --- 语义化布局 --- */
header, nav, main, article, section, footer {
  display: block;
}

/* --- 导航栏 --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: rgba(10, 14, 23, 0.92);
  border-bottom: 1px solid var(--fire-border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar .logo {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--fire-primary), #40c9ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}
.navbar .nav-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  list-style: none;
}
.navbar .nav-links a {
  color: var(--fire-text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.35em 0.75em;
  border-radius: var(--fire-radius-sm);
  transition: var(--fire-transition);
}
.navbar .nav-links a:hover,
.navbar .nav-links a.active {
  color: var(--fire-primary);
  background: rgba(0, 229, 255, 0.08);
}
.navbar .nav-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* --- 霓虹发光卡片 --- */
.card {
  background: var(--fire-bg-card);
  border: 1px solid var(--fire-border);
  border-radius: var(--fire-radius);
  padding: 1.5rem;
  transition: var(--fire-transition);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.06);
}
.card:hover {
  border-color: var(--fire-primary);
  box-shadow: 0 0 20px var(--fire-primary-glow), 0 0 40px rgba(0, 229, 255, 0.08);
  transform: translateY(-2px);
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font-family: var(--fire-font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6em 1.4em;
  border: 1px solid var(--fire-border);
  border-radius: var(--fire-radius-sm);
  background: rgba(0, 229, 255, 0.08);
  color: var(--fire-primary);
  cursor: pointer;
  transition: var(--fire-transition);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}
.btn:hover {
  background: rgba(0, 229, 255, 0.16);
  border-color: var(--fire-primary);
  box-shadow: 0 0 16px var(--fire-primary-glow);
  transform: translateY(-1px);
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled,
.btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.5);
}
.btn-primary {
  background: linear-gradient(135deg, #00b8d4, #00e5ff);
  color: #0a0e17;
  border-color: transparent;
  font-weight: 700;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #00e5ff, #40c9ff);
  box-shadow: 0 0 24px var(--fire-primary-glow);
}
.btn-danger {
  background: rgba(255, 56, 96, 0.12);
  color: var(--fire-danger);
  border-color: rgba(255, 56, 96, 0.3);
}
.btn-danger:hover {
  background: rgba(255, 56, 96, 0.22);
  border-color: var(--fire-danger);
  box-shadow: 0 0 16px rgba(255, 56, 96, 0.3);
}
.btn-safe {
  background: rgba(0, 230, 118, 0.12);
  color: var(--fire-safe);
  border-color: rgba(0, 230, 118, 0.3);
}
.btn-safe:hover {
  background: rgba(0, 230, 118, 0.22);
  border-color: var(--fire-safe);
  box-shadow: 0 0 16px rgba(0, 230, 118, 0.3);
}
.btn-sm {
  font-size: 0.82rem;
  padding: 0.4em 1em;
}
.btn-lg {
  font-size: 1.15rem;
  padding: 0.8em 2em;
}

/* --- 标题渐变 --- */
.gradient-title {
  font-weight: 800;
  background: linear-gradient(135deg, var(--fire-primary) 0%, #40c9ff 50%, #7b61ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- 页面容器 --- */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* --- 网格卡片布局 --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* --- 模态弹窗 --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-box {
  background: var(--fire-bg-card);
  border: 1px solid var(--fire-border);
  border-radius: var(--fire-radius);
  padding: 2rem;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.15);
  animation: slideUp 0.3s ease;
}
.modal-box h2 {
  margin-bottom: 1rem;
}
.modal-box .modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* --- Toast 提示 --- */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 300;
  padding: 0.75rem 1.25rem;
  border-radius: var(--fire-radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  animation: slideInRight 0.3s ease;
  pointer-events: none;
}
.toast-success {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid rgba(0, 230, 118, 0.4);
  color: var(--fire-safe);
}
.toast-error {
  background: rgba(255, 56, 96, 0.15);
  border: 1px solid rgba(255, 56, 96, 0.4);
  color: var(--fire-danger);
}
.toast-info {
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.35);
  color: var(--fire-primary);
}

/* --- 进度条 --- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--fire-primary), #40c9ff);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* --- 表单 --- */
input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
  font-family: var(--fire-font);
  font-size: 0.95rem;
  padding: 0.6em 0.9em;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--fire-border);
  border-radius: var(--fire-radius-sm);
  color: var(--fire-text);
  transition: var(--fire-transition);
  width: 100%;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--fire-primary);
  box-shadow: 0 0 10px var(--fire-primary-glow);
}
label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35em;
  color: var(--fire-text-dim);
  font-size: 0.9rem;
}

/* --- 动画关键帧 --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(60px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px var(--fire-primary-glow); }
  50% { box-shadow: 0 0 24px var(--fire-primary-glow), 0 0 48px rgba(0,229,255,0.12); }
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  25% { opacity: 0.7; }
  50% { opacity: 0.9; }
  75% { opacity: 0.6; }
}

/* --- 弹窗动画增强 --- */
@keyframes popBounce {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
.popup-box { animation: popBounce 0.35s ease; }

/* --- 按钮圆角卡通样式 --- */
.btn { border-radius: 50px; font-weight: 700; }
.btn-lg { border-radius: 50px; padding: 0.9em 2.2em; font-size: 1.2rem; }
.btn-sm { border-radius: 50px; }

/* --- 大字模式增强：弹窗文字也放大 --- */
body.large-text .popup-box { font-size: 1.2rem; }
body.large-text .popup-box h3 { font-size: 1.5rem; }
body.large-text .popup-box p { font-size: 1.1rem; }
body.large-text .popup-box .popup-btn { font-size: 1.2rem; padding: 0.8em 2em; }

/* --- 图例高饱和度 --- */
.legend-safe { color:#00e676; background:rgba(0,230,118,0.2); font-weight:700; }
.legend-danger { color:#ff3860; background:rgba(255,56,96,0.2); font-weight:700; }
.legend-shelter { color:#ffab00; background:rgba(255,171,0,0.2); font-weight:700; }
.legend-stair { color:#d0d6e0; background:rgba(255,255,255,0.1); font-weight:700; }
.legend-elevator { color:#ff3860; background:rgba(255,56,96,0.15); font-weight:700; text-decoration:line-through; }

/* --- 火势阶段标识 --- */
.fire-badge { display:inline-block; padding:0.2em 0.8em; border-radius:20px; font-size:0.8rem; font-weight:700; margin:0.25rem; }
.fire-badge.s1 { background:rgba(255,171,0,0.2); color:#ffab00; border:1px solid rgba(255,171,0,0.4); }
.fire-badge.s2 { background:rgba(255,56,96,0.2); color:#ff3860; border:1px solid rgba(255,56,96,0.4); }
.fire-badge.s3 { background:rgba(255,56,96,0.35); color:#ff6d3a; border:1px solid rgba(255,56,96,0.6); }

/* --- 响应式 --- */
@media (max-width: 768px) {
  .navbar {
    padding: 0.6rem 1rem;
    gap: 0.5rem;
  }
  .navbar .nav-links {
    gap: 0.3rem;
  }
  .navbar .nav-links a {
    font-size: 0.82rem;
    padding: 0.3em 0.5em;
  }
  .page-container {
    padding: 1rem;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .modal-box {
    padding: 1.25rem;
    width: 95%;
  }
}

@media (max-width: 480px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .btn-lg {
    font-size: 1rem;
    padding: 0.65em 1.5em;
  }
}
