/* AI全景创作页 */
.aipano-workspace {
  display: grid;
  grid-template-columns: 310px minmax(300px, 1fr) 230px;
  height: var(--aipano-height, calc(100vh - 150px));
  min-height: 500px;
  max-height: calc(100vh - 86px);
  gap: 1px;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05);
  box-sizing: border-box;
}

.aipano-panel {
  background: #fff;
  padding: 20px;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}

.aipano-history {
  background: #fff;
  padding: 18px 14px;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* 独立且精致的侧边栏滚动条 */
.aipano-panel::-webkit-scrollbar,
.aipano-history-list::-webkit-scrollbar {
  width: 6px;
}
.aipano-panel::-webkit-scrollbar-track,
.aipano-history-list::-webkit-scrollbar-track {
  background: transparent;
}
.aipano-panel::-webkit-scrollbar-thumb,
.aipano-history-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
.aipano-panel::-webkit-scrollbar-thumb:hover,
.aipano-history-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.aipano-panel h1 {
  display: none;
}

.aipano-label {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin: 18px 0 8px;
}

.aipano-label-ref {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0;
}

.aipano-ref-count-wrap {
  color: #059669;
  font-weight: 600;
  font-size: 13px;
}

.aipano-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.aipano-references {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
}

.aipano-reference {
  position: relative;
  width: 76px;
  height: 76px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}

.aipano-reference img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aipano-reference button {
  position: absolute;
  top: 0;
  width: 22px;
  height: 22px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease;
  z-index: 2;
}

.aipano-reference:hover button {
  opacity: 1;
}

.aipano-reference .aipano-reference-zoom {
  left: 0;
  border-radius: 0 0 6px 0;
}

.aipano-reference .aipano-reference-zoom i {
  font-size: 13px;
  line-height: 1;
}

.aipano-reference .aipano-reference-zoom:hover {
  background: rgba(0, 155, 117, 0.9);
}

.aipano-reference .aipano-reference-remove {
  right: 0;
  border-radius: 0 0 0 6px;
  font-size: 14px;
}

.aipano-reference .aipano-reference-remove:hover {
  background: rgba(239, 68, 68, 0.9);
}

.aipano-upload {
  width: 76px;
  height: 76px;
  border: 2px dashed #10b981;
  background: #f0fdf9;
  border-radius: 10px;
  color: #059669;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.aipano-upload:hover {
  background: #e6f9f3;
  border-color: #047857;
}

.aipano-upload-plus {
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  margin-bottom: 4px;
  color: #059669;
}

.aipano-upload-title {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: #059669;
}

.aipano-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 8px;
}

.aipano-label-prompt {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
}

.aipano-prompt-req {
  color: #d97706;
  font-size: 12px;
  font-weight: normal;
}

.aipano-prompt-textarea {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: #1e293b;
  line-height: 1.5;
  transition: all 0.2s;
}

.aipano-prompt-textarea::placeholder {
  color: #94a3b8;
  font-size: 12px;
}

.aipano-prompt-textarea:focus {
  background: #ffffff;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.aipano-styles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.aipano-style {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  color: #334155;
  padding: 9px 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.aipano-style:hover:not(.is-active) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.aipano-style.is-active {
  background: #059669 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.aipano-style-input-wrap {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 8px;
}

.aipano-style-input {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 30px 8px 12px;
  font-size: 12px;
  color: #334155;
  margin-top: 8px;
  transition: all 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.aipano-style-input-wrap .aipano-style-input {
  margin-top: 0;
}

.aipano-style-input::placeholder {
  color: #94a3b8;
}

.aipano-style-input:focus {
  background: #ffffff;
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.aipano-style-input-clear {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #ffffff;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  border: none;
  padding: 0;
  margin: 0;
  transition: background-color 0.15s ease, opacity 0.15s ease;
  user-select: none;
  z-index: 2;
  box-sizing: border-box;
}

.aipano-style-input-clear:hover {
  background: #94a3b8;
  color: #ffffff;
}

.aipano-style-input-clear:active {
  background: #64748b;
}

.aipano-sizes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.aipano-size {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  color: #1e293b;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.aipano-size .aipano-size-res {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.aipano-size .aipano-size-cost,
.aipano-size small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  margin-top: 4px;
  line-height: 1.2;
}

.aipano-size:hover:not(.is-active) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.aipano-size.is-active {
  background: #f0fdf9 !important;
  border: 2px solid #059669 !important;
}

.aipano-size.is-active .aipano-size-res {
  color: #059669;
}

.aipano-size.is-active .aipano-size-cost,
.aipano-size.is-active small {
  color: #059669;
}

.aipano-charge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 14px;
  font-size: 13px;
  color: #475569;
}

.aipano-charge strong {
  font-size: 16px;
  font-weight: 700;
  color: #059669;
}

.aipano-submit {
  width: 100%;
  border: 0;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  color: white;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.aipano-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.45);
  transform: translateY(-1px);
}

.aipano-submit::before {
  content: "✨";
  font-size: 14px;
}

.aipano-submit:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.aipano-notice {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 10px;
  text-align: center;
  min-height: 18px;
}

.aipano-view {
  position: relative;
  background: radial-gradient(ellipse at top,#264e50,#29364c 75%);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.aipano-view:before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(#ffffff06 1px,transparent 1px),linear-gradient(90deg,#ffffff06 1px,transparent 1px);
  background-size: 100px 100px;
  pointer-events: none;
}

.aipano-view-tabs {
  display: none !important;
}

.aipano-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aipano-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.aipano-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #c9dedb;
  text-align: center;
  padding: 30px;
  pointer-events: none;
}

@keyframes aipano-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.aipano-stage-spinner {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aipano-stage-spinner svg {
  width: 44px;
  height: 44px;
  color: #10b981;
  animation: aipano-spin 1.2s linear infinite;
  filter: drop-shadow(0 2px 8px rgba(16, 185, 129, 0.3));
}

.aipano-empty strong {
  font-size: 20px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.aipano-empty span {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.6;
  max-width: 420px;
}

.aipano-actions {
  position: absolute;
  bottom: 18px;
  right: 18px;
  left: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  z-index: 3;
}

.aipano-actions button {
  border: 0;
  border-radius: 8px;
  padding: 10px 15px;
  background: #fff;
  color: #304654;
  font-size: 13px;
}

.aipano-actions button:last-child {
  background: #009b75;
  color: #fff;
}

.aipano-actions button:disabled {
  opacity: .5;
}

.aipano-history-head {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.aipano-history-list {
  flex: 1 1 auto;
  height: 0;
  min-height: 100px;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.aipano-history-footer {
  flex-shrink: 0;
  padding-top: 6px;
}

.aipano-card {
  position: relative;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: border-color 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.aipano-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

html,
body {
  height: 100%;
  overflow: hidden;
}

.content {
  min-height: 0 !important;
  height: calc(100vh - 58px) !important;
  padding-bottom: 0 !important;
  overflow: hidden !important;
}

.aipano-card.is-selected,
.aipano-card.is-selected:hover {
  border: 2px solid #009b75 !important;
  background: #fff;
  box-shadow: none !important;
}

.aipano-card.is-selected::before {
  content: "✓";
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: 22px;
  height: 22px;
  background: #009b75;
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: bold;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.aipano-history-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 18px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.15s ease;
  pointer-events: none;
}

.aipano-card:hover .aipano-history-delete,
.aipano-card:focus-within .aipano-history-delete {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.aipano-history-delete:hover {
  background: #ef4444;
  transform: scale(1.08);
}

.aipano-history-delete:disabled {
  background: rgba(0, 0, 0, 0.35);
  cursor: not-allowed;
}

@media (hover: none) {
  .aipano-history-delete {
    opacity: 1;
    pointer-events: auto;
  }
}

.aipano-card img {
  width: 100%;
  aspect-ratio: 2 / 1;
  height: auto;
  max-height: 110px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: #f1f5f9;
}

.aipano-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin: 7px 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.aipano-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #64748b;
  font-size: 11px;
  margin-top: 3px;
}

.aipano-card-state {
  font-size: 11px;
  margin-top: 6px;
  color: #0284c7;
  line-height: 1.4;
}

.aipano-card-state.is-error {
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  display: inline-block;
  word-break: break-all;
}

.aipano-card-state.is-saved {
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  display: inline-block;
}

.aipano-card progress {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  accent-color: #009b75;
  background-color: #e2e8f0;
  border: 0;
  overflow: hidden;
}

.aipano-progress {
  width: 100%;
  margin-top: 6px;
}

.aipano-progress-label {
  display: block;
  text-align: right;
  font-size: 11px;
  color: #059669;
  margin-top: 2px;
}

.aipano-edit-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.aipano-edit-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  outline: none;
}

.aipano-edit-action:hover:not(.is-active) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.aipano-edit-action.is-active {
  background: #f0fdf9 !important;
  border: 2px solid #059669 !important;
  color: #059669 !important;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(5, 150, 105, 0.12);
}

.aipano-edit-action:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.aipano-edit-description {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  background: #f0fdf9;
  color: #065f46;
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.05);
}

.aipano-edit-mode [hidden] {
  display: none !important;
}



.aipano-progress progress {
  display: block;
  width: 100%;
  height: 8px;
  accent-color: #00ac82;
}

.aipano-empty .aipano-progress {
  width: min(320px, 80%);
}

.aipano-progress .aipano-progress-label {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: #008969;
}

.aipano-notice {
  font-size: 12px;
  line-height: 1.6;
  color: #637987;
  margin-top: 10px;
}

.aipano-history button {
  font-size: 12px;
}

.aipano-poll-message {
  font-size: 12px;
  color: #946d30;
  margin-top: 12px;
}

.aipano-stage #aipano-sphere {
  height: 100%;
  width: 100%;
}

@media(max-width:1200px) {
  .aipano-workspace {
    grid-template-columns: 260px minmax(250px,1fr);
    height: auto !important;
    max-height: none !important;
  }

  .aipano-panel {
    height: auto;
    max-height: 600px;
  }

  .aipano-history {
    grid-column: 1/-1;
    height: auto;
    overflow: visible;
  }

  .aipano-history-list {
    display: flex;
    gap: 10px;
    height: auto;
    max-height: 250px;
  }

  .aipano-card {
    min-width: 180px;
    max-width: 220px;
  }

}

@media(max-width:760px) {
  .aipano-workspace {
    grid-template-columns: 1fr;
    height: auto !important;
    max-height: none !important;
  }

  .aipano-view {
    min-height: 420px;
  }

  .aipano-panel {
    padding: 16px;
    max-height: none;
  }

  .aipano-history {
    grid-column: auto;
  }

  .aipano-actions {
    left: 10px;
    right: 10px;
    gap: 6px;
  }

  .aipano-actions button {
    padding: 9px;
    font-size: 12px;
  }

}

/* 一键保存作品弹窗样式 */
.layui-layer.aipano-save-layer {
  border-radius: 14px !important;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2), 0 4px 12px rgba(15, 23, 42, 0.08) !important;
  border: 1px solid rgba(226, 232, 240, 0.95) !important;
  background: #ffffff !important;
  overflow: hidden !important;
  padding: 0 !important;
}

.layui-layer.aipano-save-layer .layui-layer-content {
  padding: 30px 28px 26px !important;
  text-align: center !important;
  box-sizing: border-box !important;
  color: #1e293b !important;
}

.aipano-save-dialog {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.aipano-save-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.aipano-save-icon-wrap.is-loading {
  background: #ecfdf5;
  color: #059669;
}

.aipano-save-icon-wrap.is-loading .aipano-spin-svg {
  width: 32px;
  height: 32px;
  animation: aipano-spin 1.2s linear infinite;
}

.aipano-save-icon-wrap.is-success {
  background: #ecfdf5;
  color: #059669;
}

.aipano-save-icon-wrap.is-success svg {
  width: 30px;
  height: 30px;
}

.aipano-save-icon-wrap.is-fail {
  background: #fef2f2;
  color: #ef4444;
}

.aipano-save-icon-wrap.is-fail svg {
  width: 28px;
  height: 28px;
}

.aipano-save-title {
  font-size: 17px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.4;
}

.aipano-save-desc {
  font-size: 13px;
  color: #64748b;
  line-height: 1.6;
  max-width: 360px;
  margin-bottom: 22px;
}

.aipano-save-btns {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.aipano-save-btns button {
  flex: 1;
  max-width: 160px;
  height: 38px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  transition: all 0.2s;
}

.aipano-save-btn-stay {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
}

.aipano-save-btn-stay:hover {
  background: #e2e8f0 !important;
  color: #1e293b !important;
}

.aipano-save-btn-edit {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3) !important;
}

.aipano-save-btn-edit:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%) !important;
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.4) !important;
}

/* 换风格仅有一张2:1输入，上传区和缩略图占满面板宽度。 */
.aipano-style-mode .aipano-upload {
  width: 100%;
  height: 96px;
}
.aipano-style-mode .aipano-references:not(:empty) {
  width: 100%;
}
.aipano-style-mode .aipano-reference {
  width: 100%;
  height: 120px;
}
.aipano-style-mode .aipano-reference img {
  object-fit: contain;
}

/* 高清放大自定义尺寸，沿用现有面板的字体与边框。 */
.aipano-upscale-mode .aipano-sizes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.aipano-custom-dimensions { display: flex; align-items: center; gap: 8px; }
.aipano-custom-dimensions label { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.aipano-custom-dimensions input { width: 100%; min-width: 0; padding: 6px; border: 1px solid #dce4ed; border-radius: 5px; }
