/* 地址管理系统 - 统一样式 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --ok: #16a34a;
  --error: #dc2626;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ---------- 登录页 ---------- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 40px 36px;
}

.login-card h1 {
  font-size: 24px;
  text-align: center;
  margin-bottom: 4px;
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 28px;
}

/* ---------- 顶部栏 ---------- */

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
}

.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 18px;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.welcome {
  color: var(--text-light);
  font-size: 14px;
}

/* 保证 hidden 属性始终生效（避免被 display 样式覆盖） */
[hidden] {
  display: none !important;
}

/* ---------- 列表头部（标题 + 右上角添加按钮） ---------- */

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.list-header h2 {
  margin-bottom: 0;
}

/* ---------- 悬浮窗 ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 28px;
}

.modal h2 {
  font-size: 18px;
  margin-bottom: 18px;
}

.modal-actions {
  justify-content: flex-end;
}

/* ---------- 布局 ---------- */

.container {
  max-width: 860px;
  margin: 24px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.card h2 {
  font-size: 17px;
  margin-bottom: 18px;
}

.count {
  color: var(--text-light);
  font-size: 14px;
  font-weight: normal;
}

/* ---------- 表单 ---------- */

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field input.invalid {
  border-color: var(--error);
}

/* ---------- 校验提醒 ---------- */

.hint {
  margin-top: 6px;
  font-size: 13px;
  min-height: 20px;
}

.hint-ok {
  color: var(--ok);
}

.hint-error {
  color: var(--error);
}

.hint-warn {
  color: #b45309;
}

.error-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ---------- 按钮 ---------- */

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

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

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 16px;
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

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

.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

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

.btn-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #fff;
  color: var(--text-light);
  border-color: var(--border);
}

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

/* ---------- 地址列表 ---------- */

.address-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.address-item:first-child {
  padding-top: 4px;
}

.address-item:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.item-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
}

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

.item-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  word-break: break-all;
}

.item-address {
  font-size: 13px;
  color: var(--text-light);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  word-break: break-all;
  margin-bottom: 4px;
}

/* 异常地址：文字加粗并标红 */
.item-address.invalid {
  color: var(--error);
  font-weight: 700;
}

/* 不符合标准格式的地址：名称后标注提示，地址文字加粗标红 */
.warn-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--error);
  color: #fff;
  font-size: 12px;
  line-height: 1.7;
  font-family: inherit;
  vertical-align: middle;
}

.item-ops {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.empty {
  color: var(--text-light);
  text-align: center;
  padding: 24px 0;
  font-size: 14px;
}

/* ---------- 移动端 ---------- */

@media (max-width: 600px) {
  .container {
    margin: 14px auto;
    padding: 0 12px;
    gap: 14px;
  }

  .card {
    padding: 16px 14px;
  }

  .list-header {
    margin-bottom: 10px;
  }

  .topbar {
    padding: 10px 12px;
  }

  /* 移动端：序号圆点改为绝对定位，不占地址行宽度，地址行可占满整行 */
  .address-item {
    position: relative;
    padding: 9px 0 9px 0;
  }

  .item-num {
    position: absolute;
    left: 0;
    top: 12px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 10px;
  }

  /* 名称行让出左侧空间给序号圆点 */
  .item-name {
    font-size: 14px;
    margin-bottom: 1px;
    padding-left: 28px;
  }

  /* 地址行占满整行宽度，34 位单行 */
  .item-address {
    font-size: 11px;
    margin-bottom: 0;
    letter-spacing: -0.2px;
  }

  .item-ops {
    width: 100%;
    justify-content: flex-end;
    margin-top: 4px;
    gap: 6px;
  }

  .btn-secondary,
  .btn-danger {
    padding: 5px 12px;
    font-size: 12px;
  }
}
