/* ========== ai-logo-design.html - Logo设计 ========== */

/* ========== Logo Page Layout ========== */
.logo-page-layout {
  display: flex;
  gap: 28px;
}

/* ========== Design Panel (Left) ========== */
.design-panel {
  width: 340px;
  flex-shrink: 0;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 48px);
  position: sticky;
  top: 24px;
}

.design-panel-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.design-panel-body::-webkit-scrollbar {
  width: 4px;
}

.design-panel-body::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* 返回Logo灵感按钮（默认隐藏，仅移动端设计面板内展示） */
.mobile-panel-back {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 0 14px;
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.mobile-panel-back svg {
  stroke: var(--color-text);
}

/* Form Fields */
.form-group {
  margin-bottom: 22px;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-label .required {
  color: #ef4444;
  font-size: 14px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-base);
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-base);
  font-family: inherit;
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea::placeholder {
  color: var(--color-text-muted);
}

/* Industry Selection */
.industry-section {
  margin-bottom: 22px;
}

.industry-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 10px;
}

.industry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.industry-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  border: 1px solid transparent;
  user-select: none;
}
.industry-tag:hover {
  background: #f0edff;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.industry-tag.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.industry-more-btn {
  padding: 7px 14px;
  background: transparent;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

.industry-more-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Industry Popover */
.industry-popover {
  display: none;
  position: fixed;
  margin-top: 0;
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--color-border);
  z-index: 99999;
  width: 290px;
  max-height: 600px;
  overflow-y: auto;
}

.industry-popover.active {
  display: block;
  animation: popoverIn 0.2s ease-out;
}

@keyframes popoverIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.industry-popover-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
}

.industry-popover-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.industry-popover-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  border: 1px solid transparent;
}

.industry-popover-tag:hover {
  background: #f0edff;
  color: var(--color-primary);
}

.industry-popover-tag.active {
  background: var(--color-primary);
  color: white;
}

/* Reference Image Upload */
.ref-section {
  margin-bottom: 22px;
}

.ref-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.ref-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}

.upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
}

.upload-area:hover {
  border-color: var(--color-primary);
  background: #faf9ff;
}

.upload-area svg {
  width: 32px;
  height: 32px;
  stroke: var(--color-text-muted);
  fill: none;
  stroke-width: 1.5;
  margin-bottom: 8px;
}

.upload-area p {
  font-size: 13px;
  color: var(--color-text-muted);
}

.upload-area span {
  color: var(--color-primary);
  font-weight: 500;
}

.upload-area.has-preview {
  padding: 0;
  border-style: solid;
  cursor: default;
  position: relative;
}

.upload-area.has-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.upload-area .clear-ref {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 24px;
  text-align: center;
  z-index: 2;
}

.upload-area.has-preview .clear-ref {
  display: block;
}

/* Description Section */
.desc-section {
  margin-bottom: 22px;
}

.desc-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-write-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 3px 10px;
  font-size: 12px;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
}

.ai-write-btn:hover {
  opacity: 0.85;
  transform: scale(1.03);
}

.ai-write-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ai-write-loading {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ai-write-spin 0.6s linear infinite;
}

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

/* Style Selection */
.style-section {
  margin-bottom: 24px;
}

.style-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.style-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.style-item {
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid transparent;
  transition: all var(--transition-base);
  user-select: none;
}

.style-item:hover {
  border-color: #c7c8ff;
}

.style-item.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.style-item-img {
  width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
}

.style-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.style-item-name {
  text-align: center;
  font-size: 12px;
  padding: 6px 4px;
  color: var(--color-text-secondary);
  background: #fafafa;
}

.style-item.active .style-item-name {
  color: var(--color-primary);
  font-weight: 600;
  background: #f5f3ff;
}

/* Start Design Button */
.start-design-btn {
  width: 100%;
  padding: 14px;
  margin-top: 20px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-base), transform var(--transition-base);
  font-family: inherit;
  flex-shrink: 0;
}

.start-design-btn:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.start-design-btn:active {
  transform: translateY(0);
}

/* ========== Logo Grid Area ========== */
.logo-grid-area {
  flex: 1;
  min-width: 0;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding-right: 8px;
}

.logo-grid-area::-webkit-scrollbar {
  width: 6px;
}

.logo-grid-area::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 6px;
}

.logo-grid-area::-webkit-scrollbar-track {
  background: transparent;
}

.logo-page-header {
  margin-bottom: 24px;
}

.logo-page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
}

.logo-page-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-top: 8px;
}

/* Categories */
.logo-categories {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.logo-categories::-webkit-scrollbar {
  display: none;
}

.logo-cat-tag {
  flex-shrink: 0;
  padding: 8px 18px;
  background: var(--color-white);
  border-radius: var(--radius-full);
  font-size: 14px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  user-select: none;
  border: 1px solid var(--color-border);
  -webkit-tap-highlight-color: transparent;
}
.logo-cat-tag:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: #f5f3ff;
}

.logo-cat-tag.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Logo Cards Grid */
.logo-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.logo-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  -webkit-tap-highlight-color: transparent;
}

.logo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

.logo-card:active {
  transform: scale(0.98);
}

.logo-card-image {
  width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.logo-card-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: inherit;
}

.logo-card-image:hover .logo-card-overlay {
  opacity: 1;
}

.btn-use-ref {
  padding: 8px 20px;
  background: #fff;
  color: #333;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: background 0.2s, transform 0.15s;
}

.btn-use-ref:hover {
  background: #f0edff;
  color: var(--color-primary);
  transform: scale(1.05);
}

.btn-use-ref:active {
  transform: scale(0.97);
}

.logo-card-info {
  padding: 14px 16px;
  border-top: 1px solid #f0f0f0;
}

.logo-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.logo-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.logo-tag {
  font-size: 12px;
  padding: 3px 8px;
  background: #f5f5f5;
  border-radius: 4px;
  color: var(--color-text-muted);
}

/* ========== Mobile: Design Panel as top section ========== */

/* Logo Design Loading */
.logo-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 24px;
}

.logo-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e8e8ff;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: logoSpin 0.8s linear infinite;
}

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

.logo-loading-text {
  font-size: 16px;
  color: var(--color-text-secondary);
  animation: logoPulse 1.5s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Logo Preview Area */
.logo-preview-area {
  padding: 20px 0;
}

.logo-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.logo-preview-box {
  aspect-ratio: 500 / 374;
  background: #f0f0f0;
  border: 2px solid #d0d0d0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.logo-preview-placeholder {
  font-size: 15px;
  color: #999;
  user-select: none;
}

.logo-preview-box canvas {
  max-width: 100%;
  max-height: 100%;
}

/* Logo Preview Hover Overlay */
.logo-preview-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 10;
}

.logo-preview-box:hover .logo-preview-overlay {
  opacity: 1;
}

.preview-action-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
  white-space: nowrap;
}

.preview-action-btn:hover {
  transform: scale(1.05);
}

.preview-action-btn:active {
  transform: scale(0.97);
}

.preview-action-btn.btn-edit {
  background: #fff;
  color: #333;
}

.preview-action-btn.btn-edit:hover {
  background: #f0edff;
  color: var(--color-primary);
}

.preview-action-btn.btn-download {
  background: var(--color-primary);
  color: #fff;
}

.preview-action-btn.btn-download:hover {
  background: var(--color-primary-hover);
}

/* Logo Preview Refresh Button (top-right) */
.preview-refresh-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.25s, background 0.2s;
}

.logo-preview-box:hover .preview-refresh-btn {
  opacity: 1;
}

.preview-refresh-btn:hover {
  background: rgba(99, 102, 241, 0.85);
}

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

/* 移动端H5：logo下方的下载按钮（浅灰色，默认隐藏） */
.mobile-download-btn {
  display: none;
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background: #f0f0f0;
  color: #666;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.mobile-download-btn:active {
  background: #e6e6e6;
}

/* Refresh Batch Button */
.refresh-batch-wrap {
  text-align: center;
  padding: 28px 0 10px;
}

.refresh-batch-btn {
  padding: 14px 48px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  font-family: inherit;
}

.refresh-batch-btn:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.refresh-batch-btn:active {
  transform: translateY(0);
}

.refresh-batch-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 639px) {
  .logo-preview-grid {
    grid-template-columns: repeat(1, 1fr);
  }

  /* 移动端H5：默认隐藏设计面板，仅展示Logo设计灵感 */
  .design-panel {
    display: none;
  }

  /* 选中具体灵感后：显示设计面板，隐藏Logo设计灵感 */
  .logo-page-layout.mobile-panel-active .design-panel {
    display: flex;
  }

  .logo-page-layout.mobile-panel-active .logo-grid-area {
    display: none;
  }

  /* 移动端设计面板内展示返回按钮 */
  .mobile-panel-back {
    display: flex;
  }

  /* 移动端：logo生成后隐藏悬浮层（含高级编辑），下载按钮移至logo下方 */
  .logo-preview-overlay {
    display: none;
  }

  .mobile-download-btn {
    display: block;
  }
}

@media (max-width: 767px) {
  .logo-preview-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1023px) {
  .logo-page-layout {
    flex-direction: column;
  }

  .design-panel {
    width: 100%;
    position: static;
    max-height: none;
    border-radius: var(--radius-lg);
  }

  .style-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ========== Responsive: Tablet ========== */
@media (min-width: 768px) {
  .logo-page-title {
    font-size: 28px;
  }

  .logo-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .logo-categories {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

/* ========== Responsive: Desktop ========== */
@media (min-width: 1024px) {
  .logo-page-title {
    font-size: 28px;
  }

  .logo-cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .logo-card {
    border-radius: var(--radius-lg);
  }
}

/* ========== Responsive: Large Desktop ========== */
@media (min-width: 1400px) {
  .logo-cards-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
  }

  .design-panel {
    width: 360px;
  }
}

/* ========== Responsive: Extra Large ========== */
@media (min-width: 1700px) {
  .logo-cards-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
  }
}

/* Touch-friendly */
@media (pointer: coarse) {
  .logo-cat-tag {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .logo-card:active {
    transform: scale(0.97);
  }
}

/* Small phones */
@media (max-width: 374px) {
  .logo-page-title {
    font-size: 20px;
  }

  .logo-cards-grid {
    gap: 10px;
  }

  .logo-cat-tag {
    padding: 6px 12px;
    font-size: 13px;
  }

  .style-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
