/* 在线改简历 - 工具页 */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bg: #0f0f14;
  --bg-card: #18181f;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(255,255,255,0.08);
  --radius: 12px;
}

.tool-page {
  min-height: 100vh;
  padding: 5rem 1rem 3rem;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.tool-container {
  max-width: 720px;
  margin: 0 auto;
}

.tool-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

.tool-back:hover {
  color: var(--primary);
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.tool-card h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.remaining-badge {
  font-size: 0.8rem;
  color: #f59e0b;
  font-weight: 600;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1rem;
}

.upload-zone:hover {
  border-color: var(--primary);
  background: rgba(99,102,241,0.05);
}

.upload-zone.has-file {
  border-color: #22c55e;
  background: rgba(34,197,94,0.05);
}

#pdfFileInput {
  display: none;
}

.btn-parse {
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
}

.btn-parse .btn-parse-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

.btn-parse.is-loading .btn-parse-text {
  visibility: hidden;
}

.btn-parse.is-loading .btn-parse-loading {
  display: inline-flex;
}

/* 圆环旋转 loading */
.parse-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: parse-spin 0.7s linear infinite;
}

@keyframes parse-spin {
  to { transform: rotate(360deg); }
}

/* “解析中” 后三点跳动 */
.parse-loading-text {
  font-weight: 600;
}

.loading-dots::after {
  content: '';
  animation: loading-dots 1.4s steps(4, end) infinite;
}

@keyframes loading-dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
  100% { content: ''; }
}

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

.btn-parse.is-loading:disabled {
  opacity: 1;
  cursor: wait;
}

.chat-section {
  margin-top: 1rem;
  display: none;
}

.chat-section.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chat-messages {
  max-height: 280px;
  overflow-y: auto;
  padding: 0.75rem;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.msg {
  max-width: 90%;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.msg.user {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
}

.msg.ai {
  background: var(--bg);
  border: 1px solid var(--border);
}

.msg.msg-loading {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.msg.msg-loading::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: chat-loading-dot 0.8s ease-in-out infinite;
}
@keyframes chat-loading-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
}

.chat-input-row input {
  flex: 1;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.chat-input-row input::placeholder {
  color: var(--text-muted);
}

.chat-send {
  padding: 0.65rem 1.2rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-preview, .btn-download, .btn-pay {
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-preview {
  background: rgba(99,102,241,0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.4);
}

.btn-download {
  background: linear-gradient(135deg, #22c55e, #10b981);
  color: #fff;
}

.btn-download:disabled, .btn-download.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-pay {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
}

.modal-content canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}

.payment-panel {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius);
}

.payment-panel h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.payment-panel p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.order-monthly {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.order-monthly h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.success-license {
  padding: 1rem;
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.4);
  border-radius: var(--radius);
  margin-top: 0.75rem;
  word-break: break-all;
  font-family: monospace;
  font-size: 0.95rem;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-msg {
  color: #f87171;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

@media (max-width: 600px) {
  .tool-page { padding: 4rem 0.75rem 2rem; }
  .chat-input-row { flex-direction: column; }
}
