/* ===== 全局重置与基础样式 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #e07b39;
  --primary-dark: #c4622a;
  --primary-light: #f5a96a;
  --secondary: #4a7c59;
  --secondary-dark: #355a40;
  --accent: #f0c040;
  --bg: #fdf8f3;
  --bg-card: #fff;
  --text: #2c2c2c;
  --text-light: #666;
  --text-muted: #999;
  --border: #e8ddd0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.14);
  --radius: 10px;
  --radius-lg: 16px;
  --transition: 0.25s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
}

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

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

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

.section-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 15px;
  color: var(--text-light);
  margin-bottom: 36px;
}

.section-header {
  text-align: center;
  margin-bottom: 40px;
}

.section-header .divider {
  width: 50px;
  height: 3px;
  background: var(--primary);
  margin: 12px auto 16px;
  border-radius: 2px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(224,123,57,0.35);
}

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

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

.btn-secondary {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}

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

.btn-sm {
  padding: 7px 16px;
  font-size: 13px;
}

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

/* ===== 导航栏 ===== */
.navbar {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.navbar-brand .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}

.navbar-brand .brand-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
}

.navbar-brand .brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  line-height: 1;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar-nav a {
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--primary);
  background: rgba(224,123,57,0.08);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

/* ===== 页脚 ===== */
.footer {
  background: #2c2c2c;
  color: #ccc;
  padding: 50px 0 20px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .brand-name {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.footer-brand p {
  font-size: 14px;
  line-height: 1.8;
  color: #aaa;
}

.footer h4 {
  color: #fff;
  font-size: 16px;
  margin-bottom: 16px;
  font-weight: 600;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: #aaa;
  font-size: 14px;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--primary-light);
}

.footer-contact li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #aaa;
}

.footer-contact li i {
  color: var(--primary-light);
  margin-top: 3px;
  flex-shrink: 0;
}

.footer-bottom {
  border-top: 1px solid #444;
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #888;
}

/* ===== 宠物卡片 ===== */
.pet-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  border: 1px solid var(--border);
}

.pet-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.pet-card-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.pet-card-body {
  padding: 18px;
}

.pet-card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.pet-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pet-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.pet-tag-species {
  background: #fff3e8;
  color: var(--primary);
}

.pet-tag-gender {
  background: #e8f4f8;
  color: #2980b9;
}

.pet-tag-age {
  background: #edf7ee;
  color: var(--secondary);
}

.pet-tag-status {
  background: #fef9e7;
  color: #d4ac0d;
}

.pet-tag-status.adopted {
  background: #eee;
  color: #999;
}

.pet-card-desc {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pet-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ===== 徽章 ===== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-danger  { background: #f8d7da; color: #721c24; }

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

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(224,123,57,0.12);
}

.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  cursor: pointer;
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 40px;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  font-size: 14px;
  color: var(--text);
  transition: all var(--transition);
  background: #fff;
}

.pagination a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination .active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ===== 通知/提示 ===== */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ===== 响应式 ===== */
@media (max-width: 992px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .navbar-nav, .navbar-actions {
    display: none;
  }
  .navbar-toggle {
    display: block;
  }
  .navbar-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 999;
  }
  .navbar-nav.open + .navbar-actions {
    display: flex;
    padding: 0 20px 12px;
    background: #fff;
    position: absolute;
    top: auto;
    left: 0;
    right: 0;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .section-title {
    font-size: 22px;
  }
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-success { background: var(--secondary); }
.toast-error   { background: #e74c3c; }
.toast-info    { background: #2980b9; }
.toast-warning { background: #e67e22; }

/* ===== 返回顶部按钮 ===== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 14px rgba(224,123,57,0.4);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

/* ===== 导航栏滚动效果 ===== */
.navbar.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

/* ===== 移动端导航 ===== */
@media (max-width: 900px) {
  .navbar-nav {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 16px 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transform: translateY(-110%);
    transition: transform 0.3s ease;
    z-index: 999;
    gap: 0;
  }
  .navbar-nav.open {
    transform: translateY(0);
  }
  .navbar-nav li {
    width: 100%;
  }
  .navbar-nav a {
    display: block;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
  }
  .navbar-actions {
    display: none;
  }
  .navbar-toggle {
    display: flex;
  }
}

/* ===== 通用弹窗（Modal）===== */
/* 遮罩层 */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* 打开状态：通过 class="open" 或直接 display:flex 触发 */
.modal-overlay.open,
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"] {
  display: flex;
}

/* 弹窗容器（.modal-box 用于领养弹窗，.modal 用于发帖弹窗，保持兼容） */
.modal-box,
.modal-overlay > .modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 弹窗头部 */
.modal-box .modal-header,
.modal-overlay > .modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.modal-box .modal-header h3,
.modal-overlay > .modal .modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-box .modal-header h3 i,
.modal-overlay > .modal .modal-header h3 i {
  color: var(--primary);
}

/* 关闭按钮 */
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 14px;
  transition: all var(--transition);
  flex-shrink: 0;
}

.modal-close:hover {
  background: #fee;
  color: #e74c3c;
}

/* 弹窗主体 */
.modal-box .modal-body,
.modal-overlay > .modal .modal-body {
  padding: 24px;
}

/* 弹窗底部操作区 */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* 表单双列布局（弹窗内使用） */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* 复选框组 */
.form-check-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

/* 必填标记 */
.required {
  color: #e74c3c;
  margin-left: 2px;
}

/* 导航栏用户名样式 */
.nav-username {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(224, 123, 57, 0.08);
}

.nav-username i {
  font-size: 16px;
}

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

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
  opacity: 0.4;
}

.empty-state p {
  font-size: 15px;
}

/* 加载状态 */
.loading-wrap {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 15px;
}

.loading-wrap i {
  margin-right: 8px;
  color: var(--primary);
}

/* 响应式：弹窗在小屏幕下铺满 */
@media (max-width: 640px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-box,
  .modal-overlay > .modal {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
