/* ==================== 全局样式 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --red: #c41e3a;
  --red-dark: #a0182d;
  --gold: #d4a574;
  --gold-light: #f5e6d3;
  --bg: #faf6f1;
  --bg-dark: #f0ebe3;
  --text: #2c1810;
  --text-light: #6b5a4e;
  --white: #ffffff;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.25s ease;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ==================== 导航栏 ==================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 16px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.3);
  position: relative;
  z-index: 1000;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo {
  font-size: 24px;
}

.nav-title {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 2px;
}

.nav-center {
  flex: 1;
  max-width: 420px;
  margin: 0 20px;
}

.search-box {
  display: flex;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.3);
  transition: var(--transition);
}

.search-box:focus-within {
  background: rgba(255,255,255,0.95);
  border-color: var(--gold);
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 16px;
  color: white;
  font-size: 14px;
  outline: none;
}

.search-box:focus-within input {
  color: var(--text);
}

.search-box input::placeholder {
  color: rgba(255,255,255,0.7);
}

.search-box button {
  border: none;
  background: transparent;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}

.search-box button:hover {
  background: rgba(255,255,255,0.2);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--red-dark);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: var(--transition);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.7);
  color: white;
}

.btn-outline:hover {
  background: rgba(255,255,255,0.15);
  border-color: white;
}

.btn-primary {
  background: var(--red);
  color: white;
}

.btn-primary:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.35);
}

.btn-success {
  background: #2d8c4a;
  color: white;
}

.btn-success:hover {
  background: #236b39;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-icon:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 返回按钮 */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--gold);
  background: var(--gold-light);
  color: var(--red-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.back-btn:hover {
  background: var(--gold);
  color: white;
  border-color: var(--red);
}

/* ==================== 主容器 ==================== */
.main-container {
  display: flex;
  height: calc(100vh - 56px);
  position: relative;
}

#map {
  flex: 1;
  z-index: 1;
  position: relative;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
  width: 400px;
  max-width: 100%;
  background: var(--white);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(100%);
  width: 0;
  min-width: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fdf2f4, var(--bg));
  border-bottom: 1px solid var(--gold-light);
}

.sidebar-header h2 {
  font-size: 17px;
  color: var(--red-dark);
  letter-spacing: 1px;
}

/* 位置信息 */
.location-info {
  padding: 10px 16px;
  background: var(--bg-dark);
  border-bottom: 1px solid #e8e0d5;
  font-size: 13px;
  color: var(--text-light);
}

.location-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Tab 切换 */
.sidebar-tabs {
  display: flex;
  border-bottom: 2px solid #eee;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-light);
  transition: var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab-btn.active {
  color: var(--red);
  border-bottom-color: var(--red);
  font-weight: 600;
}

.tab-btn:hover {
  color: var(--red);
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.tab-content.active {
  display: block;
}

/* ==================== 地点列表 ==================== */
.places-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.placeholder-text {
  text-align: center;
  color: var(--text-light);
  padding: 40px 20px;
  font-size: 14px;
}

.place-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--red-dark);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--gold-light);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.place-card {
  background: white;
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.place-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.place-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.place-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.place-card-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.badge-attraction {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-food {
  background: #fff3e0;
  color: #e65100;
}

.place-card-location {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.place-card-desc {
  font-size: 13px;
  color: #555;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.place-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #e0e0e0;
  background: white;
  padding: 4px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
  font-family: inherit;
}

.like-btn:hover {
  border-color: var(--red);
  background: #fff5f5;
}

.like-btn.liked {
  background: #ffe5e5;
  border-color: var(--red);
  color: var(--red);
}

.delete-btn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.delete-btn:hover {
  background: #fee;
  color: #dc3545;
}

/* ==================== 上传表单 ==================== */
.upload-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.coord-inputs {
  display: flex;
  gap: 8px;
}

.coord-inputs input {
  flex: 1;
}

.form-hint {
  color: #999;
  font-size: 11px;
}

.error-msg {
  color: #dc3545;
  font-size: 13px;
  padding: 8px;
  background: #fff5f5;
  border-radius: var(--radius-sm);
}

.success-msg {
  color: #2d8c4a;
  font-size: 13px;
  padding: 8px;
  background: #f0fff4;
  border-radius: var(--radius-sm);
}

/* ==================== 弹窗 ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  z-index: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

/* 详情弹窗 */
.detail-modal {
  width: 420px;
  max-width: 95vw;
  padding: 24px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.detail-name {
  font-size: 20px;
  font-weight: bold;
  color: var(--red-dark);
}

.detail-location {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.detail-desc {
  font-size: 14px;
  line-height: 1.8;
  color: #444;
  margin-bottom: 16px;
}

.detail-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

/* 认证弹窗 */
.auth-modal {
  width: 380px;
  max-width: 95vw;
  padding: 32px 28px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid #eee;
}

.auth-tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}

.auth-tab-btn.active {
  color: var(--red);
  border-bottom-color: var(--red);
  font-weight: 600;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form h3 {
  text-align: center;
  margin-bottom: 4px;
  color: var(--text);
  font-weight: 600;
}

/* ==================== 侧边栏切换按钮 ==================== */
.sidebar-toggle {
  position: fixed;
  right: 10px;
  bottom: 30px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 20px;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  display: none;
}

.sidebar-toggle:hover {
  background: var(--red-dark);
  transform: scale(1.05);
}

/* ==================== 地图自定义 ==================== */

/* 审图号标注 */
.map-approval {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  color: #999;
  z-index: 2;
  pointer-events: none;
}

/* 图例控件 */
.map-legend {
  position: absolute;
  bottom: 24px;
  left: 10px;
  z-index: 100;
  pointer-events: auto;
}

/* 高德 InfoWindow 内容 */
.amap-info-content {
  padding: 0 !important;
  font-family: inherit !important;
}

.map-popup h4 {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--red-dark);
}

.map-popup p {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-light);
}

.map-popup .popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* 自定义标记样式 */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  font-size: 16px;
}

.custom-marker span {
  transform: rotate(45deg);
}

.marker-attraction {
  background: #1976d2;
}

.marker-food {
  background: #e65100;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    right: 0;
    top: 56px;
    bottom: 0;
    width: 100%;
    max-width: 400px;
    border-radius: 14px 0 0 0;
  }

  .sidebar.collapsed {
    transform: translateX(100%);
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-center {
    max-width: 200px;
  }

  .detail-modal {
    width: 95vw;
  }
}

@media (max-width: 480px) {
  .nav-title {
    font-size: 16px;
    letter-spacing: 1px;
  }

  .nav-center {
    max-width: 140px;
  }

  .search-box input {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d0c8bc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b0a89c;
}

/* ==================== 加载动画 ==================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-light);
  gap: 8px;
}

.loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--gold);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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