/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* 全局样式 */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(to right, #eff6ff, #e0e7ff);
  min-height: 100vh;
  color: #1f2937;
}

/* 容器样式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* 头部样式 */
header {
  background-color: #4f46e5;
  color: white;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.875rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.cursor-pointer {
  cursor: pointer;
}

/* 按钮样式 */
.btn {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-yellow {
  background-color: #eab308;
  color: white;
}

.btn-yellow:hover {
  background-color: #ca8a04;
  transform: scale(1.05);
}

.btn-gray {
  background-color: #6b7280;
  color: white;
}

.btn-gray:hover {
  background-color: #4b5563;
}

.btn-indigo {
  background-color: #4f46e5;
  color: white;
}

.btn-indigo:hover {
  background-color: #4338ca;
}

.btn-green {
  background-color: #10b981;
  color: white;
}

.btn-green:hover {
  background-color: #059669;
}

.btn-red {
  background-color: #ef4444;
  color: white;
}

.btn-red:hover {
  background-color: #dc2626;
}

/* 主内容区 */
main {
  padding: 1.5rem;
}

/* 标题样式 */
h2 {
  font-size: 1.5rem;
  font-weight: bold;
  color: #1e40af;
  margin-bottom: 1rem;
}

/* 搜索和排序栏 */
.search-sort-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .search-sort-bar {
    flex-direction: row;
  }
  
  .search-sort-bar > div:first-child {
    flex: 1;
  }
}

/* 搜索框 */
.search-container {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
}

/* 排序选择器 */
select {
  width: 100%;
  max-width: 180px;
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  outline: none;
  transition: all 0.2s;
  background-color: white;
}

select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 记录容器 */
.records-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* 记录卡片 */
.record-card {
  background-color: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  border-left: 4px solid #e5e7eb;
}

.record-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-left-color: #4f46e5;
}

.record-card-content {
  padding: 1rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* 卡片头部：房源名称 + 评价等级 + 操作按钮 */
.record-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.record-card-header-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.record-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-card-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* 评价等级样式 */
.rating {
  padding: 0.2rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.025em;
}

.rating-hang {
  background-color: #ef4444;
  color: white;
}

.rating-dingji {
  background-color: #f97316;
  color: white;
}

.rating-renshangren {
  background-color: #eab308;
  color: white;
}

.rating-npc {
  background-color: #fde047;
  color: #333;
}

.rating-la {
  background-color: #e5e7eb;
  color: #6b7280;
}

/* 信息行：地址 */
.record-address {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.4;
}
.record-address i {
  color: #ef4444;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* 信息行：价格/户型/面积 横排 */
.record-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.record-meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #475569;
  font-size: 0.875rem;
  white-space: nowrap;
}
.record-meta-item i {
  color: #6366f1;
  font-size: 0.8rem;
  width: 1rem;
  text-align: center;
}

.record-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ef4444;
  margin: 0;
}

/* 信息行：联系人/通勤 */
.record-extra-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
}

.record-extra-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #64748b;
  font-size: 0.8125rem;
}
.record-extra-item i {
  color: #94a3b8;
  font-size: 0.75rem;
  width: 1rem;
  text-align: center;
}

/* 备注样式 */
.record-note-text {
  color: #64748b;
  font-size: 0.8125rem;
  font-style: italic;
  white-space: pre-wrap;
  line-height: 1.4;
  padding: 0.375rem 0;
  border-top: 1px dashed #e5e7eb;
  margin-top: 0.25rem;
}

/* 链接通用样式 - 圆角标签 */
.record-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}
.record-links-label {
  color: #94a3b8;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* 链接背景色类 - 红橙黄绿蓝靛紫顺序 */
.link-bg-1 { background-color: #ef4444; color: white; } /* 红 */
.link-bg-2 { background-color: #f97316; color: white; } /* 橙 */
.link-bg-3 { background-color: #eab308; color: white; } /* 黄 */
.link-bg-4 { background-color: #22c55e; color: white; } /* 绿 */
.link-bg-5 { background-color: #3b82f6; color: white; } /* 蓝 */
.link-bg-6 { background-color: #6366f1; color: white; } /* 靛 */
.link-bg-7 { background-color: #8b5cf6; color: white; } /* 紫 */

.record-links a {
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.record-links a:hover {
  opacity: 0.85;
  text-decoration: none;
}

/* 操作按钮 - 放在头部右侧 */
.action-btn-sm {
  background: none;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  white-space: nowrap;
}

.action-btn-sm-edit {
  color: #4f46e5;
  border-color: #c7d2fe;
  background: #eef2ff;
}

.action-btn-sm-edit:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
}

.action-btn-sm-delete {
  color: #ef4444;
  border-color: #fecaca;
  background: #fef2f2;
}

.action-btn-sm-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

/* 模态框关闭按钮 */
.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
  z-index: 10;
}
.modal-close-btn:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* 模态框 */
.modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-content {
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  transform: scale(0.95);
  opacity: 0;
  transition: all 0.2s;
}

.modal-content.show {
  transform: scale(1);
  opacity: 1;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #4f46e5;
  margin-bottom: 1rem;
}

/* 表单样式 */
.form-group {
  margin-bottom: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.price-range {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
}

.price-input {
  width: 100%;
  min-width: 60px;
  text-align: center;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
}

.price-separator {
  font-weight: bold;
  color: #666;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .price-range {
    justify-content: center;
  }
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #374151;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.375rem 0.625rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  outline: none;
  transition: all 0.2s;
  font-size: 0.875rem;
}
/* 表单标签 */
.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: #374151;
  font-size: 0.875rem;
}

/* 小型表单标签 */
.form-label-sm {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: #374151;
  font-size: 0.75rem;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

/* 表单操作区 */
.form-actions {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  margin-top: 0.75rem;
}

/* 表单单位 */
.form-unit {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.625rem;
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  min-width: auto;
  width: fit-content;
}

/* 双列表单行 */
.form-row.two-col {
  grid-template-columns: 1fr 1fr;
}

/* 确保通勤距离的flex布局正常工作 */
.form-group > .flex {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

/* 链接项样式调整 */
.link-item {
  margin-bottom: 0.25rem;
}

.link-item > .flex {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
}

.link-item > .flex > div:first-child {
  flex: 0 0 100px;
}

.link-item > .flex > div:nth-child(2) {
  flex: 1;
}

.link-label-input {
  width: 100% !important;
  min-width: auto !important;
  max-width: 100% !important;
}

.link-url-input {
  width: 100% !important;
}

/* 添加案例按钮样式调整 */
#addLinkBtn {
  font-size: 0.75rem !important;
  padding: 0.125rem 0.375rem !important;
  height: auto !important;
  align-self: center !important;
  margin-top: -0.125rem !important;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 3rem;
  background-color: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.empty-state-icon {
  font-size: 4rem;
  color: #c7d2fe;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.empty-state-text {
  color: #6b7280;
}

/* 搜索空状态 */
.search-empty-state {
  text-align: center;
  padding: 3rem;
  background-color: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* 加载状态 */
.loading-state {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.loading-content {
  background-color: white;
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.loading-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #e5e7eb;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-weight: 600;
  color: #4f46e5;
}

/* 页脚样式 */
footer {
  background-color: #312e81;
  color: white;
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
}

/* 响应式调整 */
@media (max-width: 640px) {
  /* 整体容器 */
  .container {
    padding: 0 0.5rem;
  }
  
  /* 头部样式 */
  header {
    padding: 1rem 0.5rem;
  }
  
  header .container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  header h1 {
    font-size: 1.5rem;
  }
  
  .header-actions {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .header-actions .btn {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }
  
  /* 主内容区 */
  main {
    padding: 1rem 0.5rem;
  }
  
  /* 搜索排序栏 */
  .search-sort-bar {
    flex-direction: column;
    gap: 1rem;
  }
  
  /* 记录容器 */
  .records-container {
    gap: 0.5rem;
  }
  
  /* 记录卡片 */
  .record-card {
    margin: 0 auto;
    max-width: 100%;
  }
  
  .record-card-content {
    padding: 0.75rem 1rem;
  }
  
  /* 卡片头部 - 移动端换行 */
  .record-card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .record-card-header-left {
    flex: 1;
    min-width: 0;
  }
  
  .record-card-title {
    font-size: 1rem;
  }
  
  .record-card-header-right {
    width: 100%;
    justify-content: flex-end;
  }
  
  /* 价格 */
  .record-price {
    font-size: 1.1rem;
  }
  
  /* 模态框 */
  .modal-content {
    width: 95%;
    padding: 1rem;
    margin: 1rem;
  }
  
  /* 表单样式 */
  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .form-row.two-col {
    grid-template-columns: 1fr;
  }
  
  /* 价格范围等flex布局 */
  .price-range {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .price-input {
    width: 100%;
    max-width: 100%;
  }
  
  /* 链接项样式 */
  .link-item > .flex {
    flex-direction: column;
    gap: 1rem;
  }
  
  .link-item > .flex > div:first-child {
    flex: 1;
  }
  
  /* 按钮样式 */
  .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }
}