/* HireVue URL Generator — web 版样式
   沿用桌面版的紫色渐变外观，补上移动端适配（同事可能拿手机开）。 */

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

/* hidden 必须真的隐藏。.hint 等类会设 display:block，压过浏览器默认的
   [hidden]{display:none}，导致 urlCNote 这类挂了 class 的元素永远藏不住、
   上一次的序号报错一直挂在页面上。用这条兜住所有 [hidden]。 */
[hidden] {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-attachment: fixed;
  padding: 20px;
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

h1 {
  color: #333;
  font-size: 26px;
  flex: 1;
  text-align: center;
}

h2 {
  color: #333;
  font-size: 18px;
  margin-bottom: 15px;
}

/* ── 表单 ───────────────────────────────────────────────────────── */
.input-section {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
  font-size: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row select {
  flex: 1;
  min-width: 0;
}

.input-group input,
.input-group select,
.add-company input,
.edit-form input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;              /* 必须 ≥16px，否则 iOS 一点输入框整页就放大且不缩回 */
  font-family: inherit;
  background: #fff;
  transition: border-color 0.2s;
}

.input-group input:focus,
.input-group select:focus,
.add-company input:focus,
.edit-form input:focus {
  outline: none;
  border-color: #667eea;
}

.input-group small,
.hint {
  display: block;
  color: #888;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
}

.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fdecea;
  border: 1px solid #f5c2c0;
  border-radius: 6px;
  color: #a4211b;
  font-size: 13px;
  line-height: 1.5;
}

.confirm-text {
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: #555;
}

/* ── 按钮 ───────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary-small {
  padding: 10px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn-primary-small:hover { opacity: 0.9; }

.btn-small {
  padding: 10px 16px;
  background: #667eea;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-small:hover { background: #5568d3; }

.btn-secondary {
  padding: 10px 24px;
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-secondary:hover { background: #5a6268; }

.btn-danger {
  padding: 10px 24px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-danger:hover { background: #c82333; }

.btn-ghost {
  padding: 8px 14px;
  background: transparent;
  color: #888;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-ghost:hover { background: #f1f1f1; color: #555; }

/* ── 结果区 ─────────────────────────────────────────────────────── */
.output-section { margin-top: 20px; }

.url-group { margin-bottom: 22px; }

.url-group h3 {
  color: #555;
  margin-bottom: 8px;
  font-size: 14px;
}

.url-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.url-group-head h3 { margin-bottom: 0; }

.count-badge {
  color: #888;
  font-weight: 400;
  font-size: 13px;
}

.url-box {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: stretch;
}

.url-box input {
  flex: 1;
  min-width: 0;
  padding: 9px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  background: #f8f9fa;
  color: #333;
}

.btn-copy {
  padding: 8px 15px;
  background: #28a745;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-copy:hover { background: #218838; }
.btn-copy.copied { background: #1e7e34; }

.btn-open {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #f1f3f5;
  color: #495057;
  border: 1px solid #dee2e6;
  border-radius: 5px;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-open:hover { background: #e9ecef; }

/* ── 使用方法（折叠块）─────────────────────────────────────────── */
.usage {
  margin-top: 24px;
  background: #f8f9fa;
  border: 1px solid #e6e8eb;
  border-radius: 10px;
  overflow: hidden;
}

.usage > summary {
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  list-style: none;          /* 去掉默认三角，换成自绘箭头 */
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  transition: background 0.2s;
}

.usage > summary::-webkit-details-marker { display: none; }   /* Safari 的默认三角 */

/* 自绘箭头：展开时转 90° */
.usage > summary::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 6px solid #8a8f98;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.usage[open] > summary::before { transform: rotate(90deg); }

.usage > summary:hover { background: #f1f3f5; }

/* 键盘 Tab 到时要看得见（去掉 list-style 后别把可达性也去掉） */
.usage > summary:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: -2px;
}

.usage-steps {
  margin: 0;
  padding: 0 18px 16px 40px;
  color: #555;
  font-size: 13px;
  line-height: 1.75;
}

.usage-steps li { margin-bottom: 8px; }
.usage-steps li:last-child { margin-bottom: 0; }

/* ── 弹窗 ───────────────────────────────────────────────────────── */
.modal {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal[hidden] { display: none; }

.modal-content,
.modal-content-small {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-content { max-width: 560px; }
.modal-content-small { max-width: 420px; }

.modal-content h2,
.modal-content-small h2 { margin-bottom: 12px; }

#companyList {
  max-height: 320px;
  overflow-y: auto;
  margin: 16px 0;
}

.company-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 10px;
  gap: 10px;
}

.company-controls,
.company-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.company-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  word-break: break-all;
}

.btn-move {
  padding: 6px 10px;
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background 0.2s;
}

.btn-move:hover:not(:disabled) { background: #5a6268; }
.btn-move:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-edit {
  padding: 6px 12px;
  background: #17a2b8;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.btn-edit:hover { background: #138496; }

.btn-delete {
  padding: 6px 12px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s;
}

.btn-delete:hover { background: #c82333; }

.add-company {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #eee;
}

.add-company input { flex: 1; min-width: 0; }

.modal-footer {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.edit-form .input-group:last-child { margin-bottom: 0; }

/* ── 登录页 ─────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 36px 30px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card h1 {
  font-size: 20px;
  margin-bottom: 8px;
}

.login-card .hint {
  text-align: center;
  margin-bottom: 24px;
}

/* ── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: rgba(33, 37, 41, 0.94);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  max-width: calc(100vw - 40px);
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.toast[hidden] { display: none; }

/* 复制兜底用的隐藏输入框 */
.copy-helper {
  position: fixed;
  top: -1000px;
  left: -1000px;
  opacity: 0;
}

/* ── 移动端 ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  body { padding: 12px; }

  .container { padding: 20px 16px; border-radius: 12px; }

  h1 { font-size: 19px; }

  .page-head { margin-bottom: 18px; }

  .input-section { padding: 16px; }

  .row { flex-wrap: wrap; }
  .row select { flex: 1 1 100%; }
  .row .btn-small { flex: 1 1 100%; }

  .url-box { flex-wrap: wrap; }
  .url-box input { flex: 1 1 100%; font-size: 11px; }
  .btn-copy, .btn-open { flex: 1; justify-content: center; text-align: center; }

  .modal { padding: 12px; }
  .modal-content, .modal-content-small { padding: 20px 16px; }

  .company-item { flex-wrap: wrap; }
  .company-text { flex: 1 1 100%; order: -1; }

  /* 手机上「编辑/删除/上移/下移」要好按：撑开触控目标、拉开间距 */
  .company-controls, .company-actions { gap: 10px; }
  .company-actions { flex: 1; }
  .btn-edit, .btn-delete {
    flex: 1;
    min-height: 40px;
    padding: 10px 12px;
    font-size: 14px;
  }
  .btn-move {
    min-width: 44px;
    min-height: 40px;
    font-size: 16px;
  }

  /* 手机屏幕本就小，公司列表别再套一个 320px 的内层滚动条，直接顺着页面滚 */
  #companyList { max-height: none; overflow: visible; }

  .add-company { flex-wrap: wrap; }
  .add-company input { flex: 1 1 100%; }
  .add-company .btn-small { flex: 1 1 100%; min-height: 44px; }

  .modal-footer { flex-direction: column-reverse; }
  .modal-footer button { width: 100%; min-height: 44px; }

  /* 手机上折叠条要好点，正文缩进收一点免得太挤 */
  .usage > summary { padding: 14px; min-height: 48px; }
  .usage-steps { padding: 0 14px 14px 32px; }
}
