/* ==========================================================================
   模态框
   ========================================================================== */

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 4, 8, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .18s ease-out;
}
.modal-backdrop.show { opacity: 1; }

.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .7);
  transform: translateY(14px) scale(.98);
  opacity: 0;
  transition: transform .22s cubic-bezier(.22,.61,.36,1), opacity .22s;
}
.modal-backdrop.show .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.modal-wide { max-width: 780px; }

/* ---------- 头部 ---------- */

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-titles { flex: 1; min-width: 0; }

.modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  word-break: break-all;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 3px;
}

.modal-close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-mute);
  font-size: 15px;
  cursor: pointer;
  transition: all .15s;
}
.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ---------- 内容 ---------- */

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  min-height: 0;
}

/* 滚动条 */
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* ---------- 底部 ---------- */

.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-foot .btn { width: auto; min-width: 110px; }

/* ---------- DNS 记录表格 ---------- */

.dns-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dns-row {
  display: grid;
  grid-template-columns: 92px 1fr 1fr 78px 32px;
  gap: 8px;
  align-items: center;
  animation: fadeUp .26s cubic-bezier(.22,.61,.36,1) backwards;
}

.dns-row select,
.dns-row input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--mono);
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s;
}
.dns-row select:focus,
.dns-row input:focus { border-color: var(--neon); }
.dns-row select { font-family: var(--sans); cursor: pointer; }

.dns-del {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text-mute);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.dns-del:hover {
  border-color: rgba(239, 68, 68, .5);
  color: var(--err);
  background: rgba(239, 68, 68, .08);
}

.dns-head {
  display: grid;
  grid-template-columns: 92px 1fr 1fr 78px 32px;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
  padding: 0 1px;
}

.dns-add {
  margin-top: 14px;
  padding: 11px;
  border: 1px dashed var(--border-bright);
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  transition: all .15s;
}
.dns-add:hover {
  border-color: var(--neon);
  color: var(--neon-light);
  background: rgba(124, 58, 237, .06);
}

/* ---------- 模态框内的字段组 ---------- */

.modal-field {
  margin-bottom: 16px;
}
.modal-field label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.modal-field input,
.modal-field textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}
.modal-field input:focus,
.modal-field textarea:focus {
  border-color: var(--neon);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

/* ---------- 模态框内的提示条 ---------- */

.modal-note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  background: var(--bg-input);
}
.modal-note.warn {
  border-color: rgba(245, 158, 11, .3);
  background: rgba(245, 158, 11, .06);
}
.modal-note.info {
  border-color: rgba(6, 182, 212, .3);
  background: rgba(6, 182, 212, .06);
}

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

@media (max-width: 640px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .modal-backdrop.show .modal { transform: translateY(0); }

  .dns-row,
  .dns-head {
    grid-template-columns: 72px 1fr 32px;
    grid-template-areas:
      "type host del"
      "value value value"
      "ttl ttl ttl";
  }
  .dns-row select { grid-area: type; }
  .dns-row .dns-host { grid-area: host; }
  .dns-row .dns-value { grid-area: value; }
  .dns-row .dns-ttl { grid-area: ttl; }
  .dns-row .dns-del { grid-area: del; }
  .dns-head { display: none; }
}
