/* 在线留言弹窗（公共组件，用弹窗的页面引入本文件；逻辑见 js/message-modal.js）
   设计规范参考 Material Design / Ant Design Modal：分层阴影、焦点环、
   进出场动画、移动端底部抽屉；配色对齐站点品牌（青 #08a9aa → 蓝 #176de0） */

.msg-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 20, 45, 0.55);
  opacity: 0;
  transition: opacity 0.24s ease;
}
.msg-modal.is-open { display: flex; }
.msg-modal.is-visible { opacity: 1; }

.msg-modal-card {
  position: relative;
  width: min(470px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow:
    0 24px 70px -12px rgba(10, 30, 70, 0.38),
    0 4px 14px -2px rgba(10, 30, 70, 0.12);
  transform: translateY(18px) scale(0.96);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.24s ease;
}
.is-visible .msg-modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}
/* 品牌渐变顶条（呼应站点 topline） */
.msg-modal-card::before {
  content: '';
  position: sticky;
  top: 0;
  display: block;
  height: 5px;
  background: linear-gradient(90deg, #00c5b8 0%, #1268dc 53%, #3821bf 88%, #ffd33f 88%);
}

.msg-modal-inner { padding: 26px 30px 30px; }

.msg-modal-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.msg-modal-head h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--ink, #102343);
  font-size: 21px;
  letter-spacing: 0.01em;
}
.msg-modal-head h3::before {
  content: '';
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 3px;
  background: linear-gradient(135deg, #08a9aa, #176de0);
  transform: rotate(45deg);
}
.msg-modal-head p {
  margin: 10px 0 0;
  color: var(--muted, #63748d);
  font-size: 13px;
  line-height: 1.75;
}
.msg-modal-close {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: #f1f5fb;
  color: var(--muted, #63748d);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, transform 0.2s, color 0.15s;
}
.msg-modal-close:hover {
  background: #e6eef8;
  color: var(--ink, #102343);
  transform: rotate(90deg);
}
.msg-modal-close:focus-visible,
.msg-submit:focus-visible,
.msg-field input:focus-visible,
.msg-field textarea:focus-visible {
  outline: 2px solid #176de0;
  outline-offset: 2px;
}

.msg-form { display: grid; gap: 15px; margin-top: 22px; }
.msg-field label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink, #102343);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.msg-field label em { color: #e05656; font-style: normal; margin-left: 3px; }
.msg-field input,
.msg-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line, #dce7f4);
  border-radius: 10px;
  background: #fbfdff;
  color: var(--ink, #102343);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.msg-field input:hover,
.msg-field textarea:hover { border-color: #bcd3ec; }
.msg-field input:focus,
.msg-field textarea:focus {
  border-color: #176de0;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(23, 109, 224, 0.13);
}
.msg-field textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.7;
}
/* 字符计数（textarea 右下角） */
.msg-field { position: relative; }
.msg-count {
  position: absolute;
  right: 2px;
  bottom: -20px;
  color: #a5b4c8;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.msg-error {
  display: none;
  padding: 9px 12px;
  border-radius: 9px;
  background: #fdf0f0;
  border-left: 3px solid #e05656;
  color: #c74444;
  font-size: 13px;
}
.msg-error.is-visible { display: block; }

.msg-submit {
  padding: 14px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(100deg, #08a9aa, #176de0);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 6px 16px -4px rgba(23, 109, 224, 0.42);
  transition: transform 0.16s, box-shadow 0.16s, filter 0.16s;
}
.msg-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -6px rgba(23, 109, 224, 0.5);
  filter: brightness(1.05);
}
.msg-submit:active { transform: translateY(0) scale(0.985); }
.msg-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }

.msg-success { display: none; padding: 22px 6px 6px; text-align: center; }
.msg-success.is-visible { display: block; }
.msg-success-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #d9f7ef, #dcebff);
  color: #0aa07a;
  font-size: 26px;
  font-weight: 900;
  animation: msgPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.msg-success b { display: block; margin-top: 16px; color: var(--ink, #102343); font-size: 19px; }
.msg-success p { margin: 10px 0 20px; color: var(--muted, #63748d); font-size: 13px; line-height: 1.8; }
@keyframes msgPop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 移动端：底部抽屉式 */
@media (max-width: 560px) {
  .msg-modal { padding: 0; align-items: flex-end; }
  .msg-modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.9, 0.4, 1);
  }
  .is-visible .msg-modal-card { transform: translateY(0); }
  .msg-modal-inner { padding: 20px 22px calc(24px + env(safe-area-inset-bottom)); }
  /* 抽屉把手 */
  .msg-modal-card::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    width: 44px;
    height: 4px;
    border-radius: 4px;
    background: rgba(120, 135, 155, 0.25);
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg-modal,
  .msg-modal-card,
  .msg-modal-close,
  .msg-submit,
  .msg-success-icon { transition: none !important; animation: none !important; }
}
