/* 图片字幕生成器 - 样式 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: linear-gradient(160deg, #f0f4f8 0%, #e2e8f0 100%);
  min-height: 100vh;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

.main {
  display: flex;
  flex-direction: row;
  gap: 24px;
  align-items: flex-start;
}

@media (max-width: 768px) {
  .main {
    flex-direction: column;
  }
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: #1e293b;
}

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.panel-operations {
  flex: 0 0 380px;
  min-width: 0;
}

.panel-preview {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .panel-operations {
    flex: none;
    width: 100%;
  }
}

.block {
  margin-bottom: 20px;
}

.block:last-child {
  margin-bottom: 0;
}

.label {
  display: block;
  font-weight: 500;
  color: #475569;
  margin-bottom: 8px;
}

.file-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.file-name {
  color: #64748b;
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.param {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.param label {
  font-size: 12px;
  color: #64748b;
}

.param input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
}

.param input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 2px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
}

.textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.actions-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.05s;
  min-width: 150px;
}

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

.btn-primary {
  background: #059669;
  color: #fff;
}

.btn-primary:hover {
  background: #047857;
}

.btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.actions-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #94a3b8;
}

.actions-divider .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, #cbd5e1, transparent);
}

.actions-divider .text {
  white-space: nowrap;
}

.sub-tip {
  margin: 4px 0 8px;
  color: #64748b;
  font-size: 12px;
  text-align: center;
  max-width: 640px;
}

.hint-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #60a5fa;
  border: none;
  margin-left: 6px;
  cursor: help;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  position: relative;
}

.hint-icon:hover {
  background: #2563eb;
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.hint-icon::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10;
}

.hint-icon::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: #1f2937;
  transform: translateX(-50%) rotate(45deg);
  left: 50%;
  bottom: calc(100% + 4px);
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 9;
}

.hint-icon:hover::after,
.hint-icon:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.message {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  display: none;
}

.message.visible {
  display: block;
}

.message.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.message.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.message.info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* 预览区 */
.panel-preview .label {
  margin-bottom: 12px;
}

.preview-wrap {
  position: relative;
  min-height: 280px;
  flex: 1;
  background: #f1f5f9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
}

.canvas,
.preview-img {
  max-width: 100%;
  height: auto;
  display: none;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.canvas.visible,
.preview-img.visible {
  display: block;
}

.preview-placeholder {
  position: absolute;
  margin: 0;
  color: #94a3b8;
  font-size: 14px;
  text-align: center;
  padding: 16px;
}

.preview-placeholder.hidden {
  display: none;
}
