/* common/style.css — 潘小落落 公共样式 */

:root {
  --bg: #FAEEF0;
  --primary: #6B1F2C;
  --accent: #B54E60;
  --accent-soft: #F6DCDE;
  --danger: #8E1F2E;
  --text: #331B20;
  --muted: #7C5A60;
  --border: #E4C6CA;
  --radius: 8px;
  --radius-sm: 4px;
}

/* ---------------- reset ---------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn:active {
  opacity: 0.75;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: #511722;
  border-color: #511722;
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: #A8495A;
  border-color: #A8495A;
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #781A27;
  border-color: #781A27;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
  border-color: transparent;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ---------------- 输入框 ---------------- */
input, select, textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.input-group {
  margin-bottom: 12px;
}

.input-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------------- tag ---------------- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  background: #F2D8DC;
  color: var(--muted);
}

.tag-on {
  background: rgba(107, 31, 44, 0.1);
  color: var(--primary);
}

.tag-off {
  background: rgba(142, 31, 46, 0.1);
  color: var(--danger);
}

.tag-rented {
  background: rgba(181, 78, 96, 0.16);
  color: var(--accent);
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%);
  padding: 10px 18px;
  border-radius: var(--radius);
  background: rgba(51, 27, 32, 0.9);
  color: #fff;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  max-width: 80%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.toast-success {
  background: rgba(107, 31, 44, 0.92);
}

.toast-error {
  background: rgba(142, 31, 46, 0.92);
}

/* ---------------- 骨架屏 ---------------- */
.skeleton {
  background: linear-gradient(90deg, #F2D8DC 25%, #F7E2E4 37%, #F2D8DC 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton-line {
  height: 12px;
  margin-bottom: 8px;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------------- 空态 ---------------- */
.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border: 2px dashed var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--border);
}

.empty-text {
  font-size: 14px;
}

/* ---------------- 前台底部 Tab 栏 ---------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0 4px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
}

.tabbar-item.active {
  color: var(--accent);
}

.tabbar-item-icon {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

/* 前台页面底部留白，避免被 tabbar 遮挡 */
.page-with-tabbar {
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

/* ---------------- 后台表格 ---------------- */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th {
  background: #F7E2E4;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

/* 后台 640px 以下表格转卡片 */
@media (max-width: 640px) {
  .table-card thead {
    display: none;
  }

  .table-card,
  .table-card tbody,
  .table-card tr,
  .table-card td {
    display: block;
    width: 100%;
  }

  .table-card tr {
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .table-card td {
    padding: 4px 0;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .table-card td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    margin-right: 8px;
    flex-shrink: 0;
  }

  .table-card td:last-child {
    border-bottom: none;
  }
}

/* ---------------- 对话框 ---------------- */
.dialog-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 20px;
}

.dialog {
  width: 100%;
  max-width: 320px;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
}

.dialog-title {
  padding: 16px 16px 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.dialog-body {
  padding: 0 16px 20px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  border-top: 1px solid var(--border);
}

.dialog-actions .btn {
  flex: 1;
  border: none;
  border-radius: 0;
  padding: 12px 0;
  font-size: 15px;
}

.dialog-actions .btn + .btn {
  border-left: 1px solid var(--border);
}

/* ---------------- 工具类 ---------------- */
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }

/* ---------------- ICP 备案页脚 ---------------- */
.icp-footer {
  padding: 24px 16px calc(12px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.icp-footer a {
  color: var(--muted);
  text-decoration: none;
}

.icp-footer a:hover,
.icp-footer a:focus {
  color: var(--primary);
  text-decoration: underline;
}

