/* ===== SNOW3D 登录页 · 深色现代风格 ===== */

:root {
  --bg: #0e0f13;
  --card: rgba(28, 30, 38, 0.82);
  --card-border: rgba(255, 255, 255, 0.08);
  --input-bg: #171920;
  --input-border: #2b2e38;
  --input-border-focus: #5ab8ff;
  --text: #f2f4f8;
  --text-dim: #9aa0ad;
  --text-faint: #6b7080;
  --accent: #5ab8ff;
  --danger: #ff6b6b;
  --success: #3ddc97;
  --admin: #f5c451;
  --radius: 14px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 背景冷色光晕 */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(620px 420px at 18% -8%, rgba(90, 184, 255, 0.16), transparent 70%),
    radial-gradient(560px 420px at 88% 108%, rgba(90, 140, 255, 0.12), transparent 70%);
}

/* ===== 布局 ===== */

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(90, 184, 255, 0.8);
}

.brand-name {
  font-size: clamp(20px, 5.5vw, 26px);
  font-weight: 700;
  letter-spacing: 4px;
}

/* ===== 卡片 ===== */

.card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 30px 28px 28px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.card-hidden {
  display: none !important;
}

/* ===== 卡片标题 ===== */

.card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--input-border);
}

/* ===== 表单 ===== */

.form {
  display: none;
  flex-direction: column;
}

.form.is-active {
  display: flex;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
}

.input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  font-size: 16px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input::placeholder {
  color: var(--text-faint);
}

.input:focus {
  border-color: var(--input-border-focus);
  box-shadow: 0 0 0 3px rgba(90, 184, 255, 0.14);
}

/* ===== 按钮：扁平、细长、全宽 ===== */

.btn {
  appearance: none;
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, opacity 0.18s ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  margin-top: 8px;
  color: #0e0f13;
  background: var(--accent);
}

.btn-primary:hover {
  background: #7fc8ff;
}

.btn-ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--input-border);
}

.btn-ghost:hover {
  border-color: var(--text-faint);
  background: rgba(255, 255, 255, 0.04);
}

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

/* 注册跳转入口 */
.register-link {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.18s ease;
}

.register-link:hover {
  color: var(--accent);
}

/* ===== 用户界面（登录成功后） ===== */

/* 登录成功后：内容靠页面顶部排列，不再垂直居中 */
.page.is-home {
  justify-content: flex-start;
  align-items: stretch; /* 子元素横向铺满，两侧仅留 page 的内边距 */
  padding-top: max(28px, env(safe-area-inset-top, 0px));
}

/* 用户界面不显示"雪花云创"品牌标题 */
.page.is-home .brand {
  display: none;
}

.home {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* 用户界面：宽度撑满整行（page 内边距即两侧留白） */
.page.is-home .home {
  max-width: none;
}

.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.home-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.welcome-avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, #5ab8ff, #6f7dff);
  color: #0e0f13;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
}

.home-avatar {
  width: 42px;
  height: 42px;
  font-size: 18px;
}

.home-username {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  appearance: none;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 4px;
  flex-shrink: 0;
  transition: color 0.18s ease;
}

.logout-btn:hover {
  color: var(--danger);
}

.home-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 下单按钮：扁平、细长、全宽，带图标 */
.order-btn {
  height: 62px;
  font-size: 17px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.order-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* ===== 下单页面 ===== */

/* 顶栏：返回按钮 + 标题 */
.back-btn {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  padding: 6px 4px;
  flex-shrink: 0;
  transition: color 0.18s ease;
}

.back-btn:hover {
  color: var(--text);
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

.order-page-title {
  font-size: 17px;
  font-weight: 600;
}

.topbar-spacer {
  /* 与返回按钮占位对称，让标题视觉居中 */
  width: 56px;
  flex-shrink: 0;
}

/* 产品类型分段选择 */
.type-group {
  display: flex;
  gap: 10px;
}

.type-option {
  appearance: none;
  flex: 1;
  height: 48px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text-dim);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.type-option:hover {
  border-color: var(--text-faint);
}

.type-option.is-selected {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(90, 184, 255, 0.1);
}

/* ===== 尺寸估价 ===== */

.estimate-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.estimate-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.estimate-input {
  flex: 1;
  text-align: center;
  /* 隐藏 number 输入框的上下箭头 */
  appearance: textfield;
  -moz-appearance: textfield;
}

.estimate-input::-webkit-outer-spin-button,
.estimate-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.estimate-x {
  color: var(--text-faint);
  font-size: 16px;
  flex-shrink: 0;
}

.estimate-result {
  font-size: 14px;
  color: var(--text-faint);
  text-align: center;
}

.estimate-result.has-price {
  color: var(--success);
  font-weight: 600;
}

.estimate-note {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

/* 邀请码输入框：大写字母、居中、间距拉开 */
.invite-input {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 6px;
  font-size: 20px;
  font-weight: 700;
}

/* 文件上传虚线框 */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
  border: 2px dashed var(--input-border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  padding: 20px;
  text-align: center;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.upload-area:hover {
  border-color: var(--accent);
  color: var(--text);
}

.upload-area svg {
  width: 30px;
  height: 30px;
  color: var(--text-faint);
}

.upload-area.has-file {
  border-color: var(--success);
  border-style: solid;
  color: var(--success);
  word-break: break-all;
}

.upload-hint {
  font-size: 12px;
  color: var(--text-faint);
}

/* 多行文本框 */
.textarea {
  height: auto;
  min-height: 110px;
  padding: 12px 16px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

/* ===== 我的订单列表 ===== */

.order-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 订单卡片：比下单按钮更高，显示名称 + 状态 */
.order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 80px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.order-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.order-item-title {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-item-meta {
  font-size: 13px;
  color: var(--text-faint);
}

.order-status {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
}

.status-pending    { color: #f5c451; background: rgba(245, 196, 81, 0.12); }
.status-confirming { color: #ff9f43; background: rgba(255, 159, 67, 0.12); }
.status-accepted   { color: var(--accent); background: rgba(90, 184, 255, 0.12); }
.status-processing { color: #b48bff; background: rgba(180, 139, 255, 0.12); }
.status-completed  { color: var(--success); background: rgba(61, 220, 151, 0.12); }
.status-cancelled  { color: var(--text-faint); background: rgba(255, 255, 255, 0.06); }

/* 用户管理：主管理员金色 */
.is-gold {
  color: #d4af37 !important;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.35);
}

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

/* ===== 联系商家 ===== */

/* 联系商家按钮：与下单按钮同宽的长按钮，幽灵样式区分 */
.contact-btn {
  height: 56px;
  font-size: 16px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 0;
}

.contact-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* 聊天弹窗遮罩 */
.chat-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 9, 12, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* 聊天面板 */
.chat-panel {
  width: min(94vw, 520px);
  height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--input-border);
  flex-shrink: 0;
}

.chat-title {
  font-size: 16px;
  font-weight: 700;
}

.chat-close {
  appearance: none;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  display: flex;
  transition: color 0.18s ease;
}

.chat-close:hover {
  color: var(--text);
}

.chat-close svg {
  width: 20px;
  height: 20px;
}

/* 消息区 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-empty {
  margin: auto;
  color: var(--text-faint);
  font-size: 14px;
  text-align: center;
  line-height: 1.8;
}

/* 消息气泡行 */
.msg-row {
  display: flex;
}

.msg-row.mine {
  justify-content: flex-end;
}

.msg-row.theirs {
  justify-content: flex-start;
}

.msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg-row.mine .msg-bubble {
  background: var(--accent);
  color: #0e0f13;
  border-bottom-right-radius: 4px;
}

.msg-row.theirs .msg-bubble {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

/* 商家标识 */
.msg-sender {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--admin);
  margin-bottom: 3px;
}

/* 图片消息气泡 */
.msg-bubble-img {
  padding: 4px;
}

.msg-bubble-img .msg-sender {
  padding: 6px 10px 0;
}

.msg-img {
  display: block;
  max-width: min(60vw, 260px);
  max-height: 320px;
  border-radius: 10px;
}

/* 已撤回占位 */
.msg-row.is-recalled {
  justify-content: center;
}

.msg-recalled-tip {
  font-size: 12px;
  color: var(--text-faint);
  padding: 2px 10px;
}

/* 可撤回的消息 */
.msg-row.can-recall {
  cursor: pointer;
}

/* 撤回按钮条 */
.recall-bar {
  display: flex;
  align-items: center;
  align-self: center;
}

.recall-btn {
  appearance: none;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.18s ease;
}

.recall-btn:hover {
  border-color: var(--danger);
}

/* 图片发送按钮 */
.chat-img-btn {
  appearance: none;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.18s ease;
}

.chat-img-btn:hover {
  color: var(--accent);
}

.chat-img-btn svg {
  width: 24px;
  height: 24px;
}

/* 输入区 */
.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--input-border);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  height: 46px;
}

.chat-send {
  width: auto;
  height: 46px;
  padding: 0 22px;
  margin-top: 0;
  flex-shrink: 0;
}

.site-notice {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.8;
  max-width: 400px;
  padding: 0 8px;
}

/* ===== 管理员界面 ===== */

.admin-avatar {
  background: linear-gradient(135deg, #f5c451, #ff9f43);
}

.admin-tabs {
  display: flex;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 6px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.admin-tab {
  appearance: none;
  flex: 1;
  height: 42px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.admin-tab:hover {
  color: var(--text);
}

.admin-tab.is-active {
  background: rgba(90, 184, 255, 0.14);
  color: var(--accent);
}

.admin-panel {
  display: flex;
  flex-direction: column;
}

.admin-contact-list,
.admin-order-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 通讯录：用户行 */
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.admin-user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.admin-user-name {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-chat {
  width: auto;
  height: 38px;
  padding: 0 18px;
  font-size: 14px;
  margin-top: 0;
  flex-shrink: 0;
}

/* 管理员订单卡片 */
.admin-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 80px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.admin-order-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.admin-order-title {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-order-meta {
  font-size: 13px;
  color: var(--text-faint);
}

.admin-order-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 状态下拉：复用胶囊样式，select 可点击 */
select.order-status {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  min-width: 86px;
}

select.order-status:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-order-chat {
  width: auto;
  height: 30px;
  padding: 0 14px;
  font-size: 13px;
  margin-top: 0;
  flex-shrink: 0;
}

/* 用户管理：角色下拉 */
.role-select {
  appearance: none;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  height: 30px;
  padding: 0 12px;
  cursor: pointer;
  flex-shrink: 0;
}

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

/* 手机端：订单卡片右侧控件换行 */
@media (max-width: 480px) {
  .admin-order-item {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-order-right {
    justify-content: flex-start;
  }
}

/* ===== Toast 通知（替代弹窗）===== */

.toast-container {
  position: fixed;
  top: calc(20px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
  width: min(92vw, 400px);
}

.toast {
  width: 100%;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  color: var(--text);
  background: rgba(34, 36, 44, 0.96);
  border: 1px solid var(--card-border);
  border-left-width: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.25s ease;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-info    { border-left-color: var(--accent); }

.toast.toast-out {
  animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

/* ===== 多设备自适应 ===== */

/* 普通手机（含安卓套壳 WebView） */
@media (max-width: 420px) {
  .page { padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); gap: 18px; }
  .card { padding: 24px 20px; border-radius: 12px; }
}

/* 超小屏手机（如 320px 宽旧机型） */
@media (max-width: 340px) {
  .page { padding: 16px 10px calc(16px + env(safe-area-inset-bottom, 0px)); gap: 14px; }
  .card { padding: 18px 14px; }
  .card-title { font-size: 18px; margin-bottom: 18px; }
  .input, .btn { height: 46px; font-size: 15px; }
  .field { margin-bottom: 14px; }
  .site-notice { font-size: 11px; }
}

/* 手机横屏 / 矮屏：压缩纵向间距，保证一屏内放得下 */
@media (max-height: 560px) {
  .page { justify-content: flex-start; padding-top: 16px; gap: 12px; }
  .card { padding: 18px 20px; }
  .card-title { font-size: 17px; margin-bottom: 14px; padding-bottom: 8px; }
  .field { margin-bottom: 12px; }
  .input, .btn { height: 44px; }
  .register-link { margin-top: 12px; }
  .site-notice { font-size: 11px; line-height: 1.6; }
}

/* 平板 / 电脑：卡片略放大，观感不局促 */
@media (min-width: 768px) {
  .card { max-width: 420px; padding: 34px 32px 30px; }
  .input, .btn { height: 52px; }
}
