/* ===== 图片反推生成提示词 工作区 ===== */
.ip-container {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(135deg, #0b1220 0%, #111827 50%, #0f172a 100%);
}
[data-theme="light"] .ip-container {
  background: linear-gradient(135deg, #e8ecf4 0%, #dfe6f3 50%, #e5eaf2 100%);
}

/* ===== 顶部标题区 ===== */
.ip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(8px);
}
[data-theme="light"] .ip-header {
  background: rgba(255,255,255,0.7);
  border-bottom-color: rgba(0,0,0,0.06);
}
.ip-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ip-header-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  border-radius: 8px;
  color: #fff;
  flex-shrink: 0;
}
.ip-header-icon svg {
  width: 16px;
  height: 16px;
}
.ip-header-title {
  font-size: 17px;
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: 0.3px;
}
[data-theme="light"] .ip-header-title {
  color: #1e293b;
}
.ip-header-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-top: 1px;
}
[data-theme="light"] .ip-header-subtitle {
  color: rgba(30,41,59,0.45);
}
.ip-guide-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.ip-guide-btn:hover {
  background: rgba(99,102,241,0.2);
  border-color: rgba(99,102,241,0.4);
  color: #fff;
}
[data-theme="light"] .ip-guide-btn {
  color: rgba(30,41,59,0.7);
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.18);
}
[data-theme="light"] .ip-guide-btn:hover {
  background: rgba(99,102,241,0.15);
  color: #1e293b;
}

/* ===== 主内容区（左右两栏）===== */
.ip-body {
  flex: 1;
  display: flex;
  gap: 1px;
  overflow: hidden;
  min-height: 0;
}

/* ===== 左栏：上传图片 ===== */
.ip-left {
  width: 400px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 18px;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.06);
  background: rgba(15,23,42,0.35);
}
[data-theme="light"] .ip-left {
  background: rgba(255,255,255,0.35);
  border-right-color: rgba(0,0,0,0.06);
}
.ip-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #60a5fa;
  flex-shrink: 0;
}
[data-theme="light"] .ip-section-title {
  color: #3b82f6;
}
.ip-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(96,165,250,0.15);
  color: #60a5fa;
  font-size: 12px;
  font-weight: 700;
}
[data-theme="light"] .ip-section-num {
  background: rgba(59,130,246,0.12);
  color: #2563eb;
}

/* --- 上传区域 --- */
.ip-upload-box {
  flex: 1;
  min-height: 200px;
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all .25s;
  background: rgba(255,255,255,0.02);
  padding: 28px 20px;
  position: relative;
}
.ip-upload-box:hover {
  border-color: #8b5cf6;
  background: rgba(139,92,246,0.04);
  transform: translateY(-1px);
}
.ip-upload-box.dragover {
  border-color: #8b5cf6;
  background: rgba(139,92,246,0.08);
  border-style: solid;
  transform: scale(1.01);
}
[data-theme="light"] .ip-upload-box {
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.02);
}
[data-theme="light"] .ip-upload-box:hover {
  border-color: #8b5cf6;
  background: rgba(139,92,246,0.05);
}
.ip-upload-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(139,92,246,0.2) 0%, rgba(99,102,241,0.2) 100%);
  border-radius: 16px;
  margin-bottom: 4px;
}
.ip-upload-icon svg {
  width: 28px;
  height: 28px;
  color: #a78bfa;
}
[data-theme="light"] .ip-upload-icon svg {
  color: #8b5cf6;
}
.ip-upload-text {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
}
[data-theme="light"] .ip-upload-text {
  color: rgba(30,41,59,0.65);
}
.ip-upload-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  text-align: center;
  line-height: 1.5;
}
[data-theme="light"] .ip-upload-hint {
  color: rgba(30,41,59,0.38);
}

/* --- 图片预览 --- */
.ip-preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,0.3);
  min-height: 200px;
  max-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ip-preview.hidden {
  display: none;
}
.ip-preview img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 12px;
}
.ip-preview-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.ip-preview-clear:hover {
  background: rgba(239,68,68,0.9);
  transform: scale(1.1);
}
.ip-upload-stage.hidden {
  display: none;
}
.ip-upload-stage {
  display: block;
}

/* --- 小贴士 --- */
.ip-tips {
  flex-shrink: 0;
  padding: 12px 14px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.15);
  border-radius: 10px;
}
[data-theme="light"] .ip-tips {
  background: rgba(245,158,11,0.06);
  border-color: rgba(245,158,11,0.12);
}
.ip-tips-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #fbbf24;
  margin-bottom: 4px;
}
.ip-tips-text {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  line-height: 1.6;
}
[data-theme="light"] .ip-tips-text {
  color: rgba(30,41,59,0.45);
}

/* ===== 右栏：生成结果 ===== */
.ip-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  gap: 16px;
  overflow: hidden;
  min-width: 0;
}

/* --- 结果头部 --- */
.ip-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
[data-theme="light"] .ip-result-header {
  border-bottom-color: rgba(0,0,0,0.06);
}
.ip-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
}
[data-theme="light"] .ip-result-title {
  color: rgba(30,41,59,0.65);
}
.ip-result-title svg {
  color: #a78bfa;
  width: 15px;
  height: 15px;
}
.ip-result-actions {
  display: flex;
  gap: 6px;
}
.ip-result-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.ip-result-btn:hover {
  border-color: rgba(139,92,246,0.4);
  color: rgba(255,255,255,0.85);
  background: rgba(139,92,246,0.08);
}
[data-theme="light"] .ip-result-btn {
  color: rgba(30,41,59,0.55);
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .ip-result-btn:hover {
  border-color: rgba(139,92,246,0.4);
  color: #1e293b;
  background: rgba(139,92,246,0.06);
}
.ip-result-btn.primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(139,92,246,0.25);
}
.ip-result-btn.primary:hover {
  box-shadow: 0 4px 14px rgba(139,92,246,0.35);
  transform: translateY(-1px);
}

/* --- 结果文本区 --- */
.ip-result-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.ip-result-text {
  width: 100%;
  resize: vertical;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px 16px;
  color: rgba(255,255,255,0.88);
  font-size: 13px;
  line-height: 1.75;
  font-family: inherit;
  outline: none;
  min-height: 120px;
  /* 按内容自适应高度：field-sizing 是新标准，不支持时回退到 min-height */
  field-sizing: content;
}
.ip-result-text:focus {
  border-color: rgba(139,92,246,0.4);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}
.ip-result-text::placeholder {
  color: rgba(255,255,255,0.2);
}
[data-theme="light"] .ip-result-text {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.08);
  color: #1e293b;
}
[data-theme="light"] .ip-result-text::placeholder {
  color: rgba(30,41,59,0.25);
}
.ip-char-count {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  pointer-events: none;
  user-select: none;
}
[data-theme="light"] .ip-char-count {
  color: rgba(30,41,59,0.3);
}

/* --- 关键词标签 --- */
.ip-keywords {
  flex-shrink: 0;
}
.ip-keywords-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  margin-bottom: 10px;
}
[data-theme="light"] .ip-keywords-header {
  color: rgba(30,41,59,0.55);
}
.ip-keywords-header svg {
  width: 14px;
  height: 14px;
  color: #a78bfa;
}
.ip-keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ip-keyword-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(139,92,246,0.85);
  background: transparent;
  border: 1px solid rgba(139,92,246,0.35);
  border-radius: 20px;
  cursor: default;
  transition: all .15s;
}
.ip-keyword-tag:hover {
  background: rgba(139,92,246,0.1);
  border-color: rgba(139,92,246,0.55);
  color: #c4b5fd;
}
[data-theme="light"] .ip-keyword-tag {
  color: rgba(99,102,241,0.8);
  background: transparent;
  border-color: rgba(99,102,241,0.3);
}
[data-theme="light"] .ip-keyword-tag:hover {
  background: rgba(99,102,241,0.08);
  color: #4f46e5;
}
.ip-keywords-empty {
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  font-style: italic;
}
[data-theme="light"] .ip-keywords-empty {
  color: rgba(30,41,59,0.3);
}

/* --- 可选设置 --- */
.ip-settings {
  flex-shrink: 0;
}
.ip-settings-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  margin-bottom: 10px;
}
[data-theme="light"] .ip-settings-header {
  color: rgba(30,41,59,0.55);
}
.ip-settings-header svg {
  width: 14px;
  height: 14px;
  color: rgba(255,255,255,0.4);
}
[data-theme="light"] .ip-settings-header svg {
  color: rgba(30,41,59,0.4);
}
.ip-settings-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ip-setting-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ip-setting-label {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  font-weight: 500;
}
[data-theme="light"] .ip-setting-label {
  color: rgba(30,41,59,0.4);
}
.ip-select {
  padding: 8px 28px 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all .15s;
}
.ip-select:hover {
  border-color: rgba(139,92,246,0.4);
}
.ip-select:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}
.ip-select option {
  background: #161b22;
  color: #f0f6fc;
}
[data-theme="light"] .ip-select {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.1);
  color: #1e293b;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}
[data-theme="light"] .ip-select option {
  background: #ffffff;
  color: #1e293b;
}

/* --- 分段滑块按钮（替代下拉框） --- */
.ip-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 3px;
}
[data-theme="light"] .ip-segmented {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.08);
}
.ip-seg {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: rgba(255,255,255,0.55);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  line-height: 1.2;
}
.ip-seg:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.06);
}
.ip-seg.active {
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  box-shadow: 0 2px 8px rgba(139,92,246,0.3);
}
[data-theme="light"] .ip-seg {
  color: rgba(30,41,59,0.55);
}
[data-theme="light"] .ip-seg:hover {
  color: #1e293b;
  background: rgba(0,0,0,0.05);
}
[data-theme="light"] .ip-seg.active {
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
}

/* --- 生成按钮 --- */
.ip-generate-btn {
  flex-shrink: 0;
  width: 100%;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all .25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(99,102,241,0.3), 0 2px 6px rgba(139,92,246,0.2);
  letter-spacing: 0.3px;
}
.ip-generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(99,102,241,0.4), 0 4px 12px rgba(139,92,246,0.3);
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
}
.ip-generate-btn:active:not(:disabled) {
  transform: translateY(0);
}
.ip-generate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}
.ip-generate-btn .btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ip-spin 0.7s linear infinite;
}
@keyframes ip-spin { to { transform: rotate(360deg); } }

/* ===== 加载状态覆盖 ===== */
.ip-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(11,18,32,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: 10px;
}
.ip-loading-overlay.hidden {
  display: none;
}
.ip-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(139,92,246,0.2);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: ip-spin 0.8s linear infinite;
}
.ip-loading-text {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

/* ===== 使用指南弹窗 ===== */
.ip-guide-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 600);
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ip-guide-modal-overlay.hidden {
  display: none;
}
.ip-guide-modal {
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--bg-card, #21262d);
  border: 1px solid var(--border, #30363d);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.ip-guide-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #30363d);
}
.ip-guide-modal-head h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #f0f6fc);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ip-guide-modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted, #8b949e);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all .15s;
}
.ip-guide-modal-close:hover {
  background: var(--bg-hover, #30363d);
  color: var(--text, #f0f6fc);
}
.ip-guide-modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-muted, #8b949e);
}
.ip-guide-modal-body p {
  margin-bottom: 12px;
}
.ip-guide-modal-body strong {
  color: var(--text, #f0f6fc);
}
.ip-guide-modal-body code {
  background: var(--bg-deep, #0d1117);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--blue, #58a6ff);
}

/* ===== 响应式适配 ===== */
@media (max-width: 900px) {
  .ip-body {
    flex-direction: column;
  }
  .ip-left {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    max-height: 45%;
  }
  [data-theme="light"] .ip-left {
    border-bottom-color: rgba(0,0,0,0.06);
  }
  .ip-right {
    min-height: 0;
  }
  .ip-settings-row {
    grid-template-columns: 1fr;
  }
}
