/* 我的轨迹 - 专属样式 */

/* 分类颜色 */
.category-life { --category-color: #22c55e; }
.category-work { --category-color: #3b82f6; }
.category-travel { --category-color: #f59e0b; }
.category-study { --category-color: #8b5cf6; }
.category-other { --category-color: #6b7280; }

/* 地图瓦片加载优化 - 防止429错误 */
.leaflet-tile {
  /* 平滑加载 */
  transition: opacity 0.2s ease-in-out;
  will-change: transform;
}

/* 瓦片加载中的占位符样式 */
.leaflet-tile-container {
  background-color: #f0f0f0;
}

/* 错误瓦片的回退样式 */
.leaflet-tile.leaflet-tile-error {
  background-color: #e5e7eb !important;
  background-image: none !important;
}

/* 地图加载指示器 */
.map-loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  color: #374151;
  display: none;
}

.map-loading-indicator.visible {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-loading-indicator::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* 头部样式调整 - 使用清晰的亮色背景 */
.header {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95)) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.header .logo {
  color: #1f2937 !important;
}

.header .logo-en {
  font-size: 12px;
  color: #6b7280;
  margin-left: 8px;
}

/* 时间轴样式 - 使用清晰的亮色背景 */
.timeline {
  background: linear-gradient(to top, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95)) !important;
  border-top: 1px solid #e5e7eb !important;
}

.timeline-info {
  color: #374151 !important;
}

.timeline-start,
.timeline-end {
  color: #6b7280 !important;
}

/* 时间轴区域标签 - 精确定位到对应颜色区域中部 */
.slider-zone-labels {
  position: absolute;
  left: 70px;
  right: 70px;
  bottom: -20px;
  height: 20px;
  pointer-events: none;
}

.zone-label {
  position: absolute;
  font-size: 11px;
  font-weight: 600;
  color: #374151 !important;
  padding: 2px 8px;
  border-radius: 4px;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* 五个区域标签精确定位到各自区域中部 */
/* 百年 - 红色区域 0-20%，中部在10% */
.zone-label:nth-child(1) {
  left: 10%;
  background: rgba(239, 68, 68, 0.85);
  color: #ffffff !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 十年 - 橙色区域 20-40%，中部在30% */
.zone-label:nth-child(2) {
  left: 30%;
  background: rgba(245, 158, 11, 0.85);
  color: #ffffff !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 年 - 绿色区域 40-60%，中部在50% */
.zone-label:nth-child(3) {
  left: 50%;
  background: rgba(34, 197, 94, 0.85);
  color: #ffffff !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 月 - 蓝色区域 60-80%，中部在70% */
.zone-label:nth-child(4) {
  left: 70%;
  background: rgba(59, 130, 246, 0.85);
  color: #ffffff !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 日 - 紫色区域 80-100%，中部在90% */
.zone-label:nth-child(5) {
  left: 90%;
  background: rgba(168, 85, 247, 0.85);
  color: #ffffff !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.footer-info {
  color: #6b7280 !important;
}

.footer-info a {
  color: #3b82f6 !important;
}

/* 年份指示器样式 */
.year-indicator {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.year-label {
  color: #6b7280 !important;
}

.year-value {
  color: #1f2937 !important;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-hint {
  font-size: 14px;
  margin-top: 8px;
  color: #9ca3af;
}

/* 表单样式 */
.form-modal-content {
  max-width: 480px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.location-input {
  display: flex;
  gap: 8px;
}

.location-input input {
  flex: 1;
}

.btn-select-location {
  padding: 10px 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-select-location:hover {
  background: #e5e7eb;
}

.btn-select-location.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.btn-secondary {
  padding: 10px 20px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-primary {
  padding: 10px 20px;
  background: #3b82f6;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: white;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-danger {
  padding: 10px 20px;
  background: #ef4444;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: white;
  transition: background 0.2s;
}

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

/* 事件列表项 */
.event-item {
  display: flex;
  align-items: flex-start;
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background 0.2s;
}

.event-item:hover {
  background: #f9fafb;
}

.event-item.active {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
}

.event-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 12px;
  margin-top: 4px;
  flex-shrink: 0;
}

.event-marker.life { background: #22c55e; }
.event-marker.work { background: #3b82f6; }
.event-marker.travel { background: #f59e0b; }
.event-marker.study { background: #8b5cf6; }
.event-marker.other { background: #6b7280; }

.event-info {
  flex: 1;
  min-width: 0;
}

.event-title {
  font-weight: 500;
  color: #111827;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-meta {
  font-size: 12px;
  color: #6b7280;
}

.event-location {
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 详情弹窗 */
.modal-location {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 14px;
}

/* 导入导出弹窗 */
.io-modal-content {
  max-width: 480px;
}

.io-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.io-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.io-section h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: #111827;
}

.io-section p {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* 确认弹窗 */
.confirm-modal-content {
  max-width: 360px;
  text-align: center;
}

.confirm-modal-content .modal-body {
  padding: 20px;
}

.confirm-modal-content .modal-footer {
  justify-content: center;
  gap: 12px;
}

/* 选点模式提示 */
.location-select-hint {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(59, 130, 246, 0.95);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 地图标记样式 */
.personal-marker {
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.personal-marker.life { background: #22c55e; }
.personal-marker.work { background: #3b82f6; }
.personal-marker.travel { background: #f59e0b; }
.personal-marker.study { background: #8b5cf6; }
.personal-marker.other { background: #6b7280; }

/* 底部数据提示 */
.data-local {
  color: #9ca3af;
  font-size: 12px;
  margin-right: 12px;
}

/* 选中位置标记 */
.temp-marker {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

/* 响应式 */
@media (max-width: 768px) {
  .form-modal-content,
  .io-modal-content {
    max-width: 90%;
    margin: 20px;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions button {
    width: 100%;
  }
}

/* ========== 添加事件模式样式 ========== */

/* 地图中心准星（已禁用，改用点击选点） */
.map-crosshair {
  display: none !important;
}

/* 添加模式提示 */
.add-mode-hint {
  position: fixed;
  top: 130px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(59, 130, 246, 0.95);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: fadeInDown 0.3s ease;
}

/* 可拖拽选点标记 */
.drag-marker {
  cursor: grab !important;
}

.drag-marker:active {
  cursor: grabbing !important;
}

.leaflet-marker-icon.drag-marker {
  transition: none;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* 添加事件浮动表单 */
.add-event-form {
  position: fixed;
  bottom: 140px;
  right: 20px;
  left: auto;
  transform: none;
  width: 90%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 10001;
  animation: slideUpRight 0.3s ease;
  will-change: transform, left, top, right;
}

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

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

.add-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  cursor: move !important;
  user-select: none;
  position: relative;
  touch-action: none;
}

.add-form-header:hover {
  background: #f9fafb;
}

.add-form-header::before {
  content: '⠿';
  color: #9ca3af;
  margin-right: 8px;
  font-size: 12px;
}

.add-form-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.add-form-hint {
  padding: 8px 16px;
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  color: #3b82f6;
  font-size: 13px;
  display: none;
}

.btn-close-form {
  width: 28px;
  height: 28px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: #6b7280;
  transition: all 0.2s;
}

.btn-close-form:hover {
  background: #e5e7eb;
  color: #374151;
}

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

.add-form-body .form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.add-form-body .form-row input,
.add-form-body .form-row select {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.add-form-body .form-row input:focus,
.add-form-body .form-row select:focus,
.add-form-body textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.add-form-body .form-row select {
  flex: 0 0 120px;
  cursor: pointer;
}

.add-form-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.location-info {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 12px;
}

.location-info span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 16px;
}

.add-form-body .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

/* Toast 提示 */
.toast {
  position: fixed;
  bottom: 180px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(34, 197, 94, 0.95);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10002;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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