* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  color: #e4e4e7;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

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

header h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

header p {
  color: #a1a1aa;
  font-size: 0.95rem;
}

.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.nav-tab {
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #a1a1aa;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e4e4e7;
}

.nav-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: transparent;
  color: white;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.image-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.toolbar-label {
  font-size: 0.75rem;
  color: #a1a1aa;
}

.toolbar-status {
  font-size: 0.85rem;
  color: #e4e4e7;
}

.toolbar-right .btn {
  min-width: 160px;
}

.provider-select {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.provider-chip {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: #d4d4d8;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.provider-chip:hover {
  background: rgba(255, 255, 255, 0.12);
}

.provider-chip.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: transparent;
  color: white;
}

.provider-models {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
}

.provider-model-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.provider-label {
  font-size: 0.75rem;
  color: #a1a1aa;
  min-width: 90px;
}

.provider-section-title {
  font-size: 0.8rem;
  color: #d4d4d8;
  margin-bottom: 8px;
}

@media (max-width: 1000px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
}

.input-group {
  margin-bottom: 16px;
}

.input-label {
  font-size: 0.85rem;
  color: #a1a1aa;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prompt-input {
  width: 100%;
  min-height: 100px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px;
  color: #e4e4e7;
  font-size: 0.95rem;
  resize: vertical;
  transition: border-color 0.3s;
}

.prompt-input:focus {
  outline: none;
  border-color: #667eea;
}

.prompt-input::placeholder {
  color: #71717a;
}

.prompt-input.negative {
  min-height: 60px;
  border-color: rgba(239, 68, 68, 0.3);
}

.prompt-input.negative:focus {
  border-color: #ef4444;
}

.params-panel {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.params-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.param-group .params-title {
  margin-bottom: 0;
}

.param-toggle {
  font-size: 0.7rem;
  color: #71717a;
  transition: transform 0.2s;
}

.param-group.open .param-toggle {
  transform: rotate(90deg);
}

.param-group .params-content {
  margin-top: 12px;
}

.param-group:not(.open) .params-content {
  display: none;
}

.provider-params {
  display: none;
}

.capability-hint {
  display: none;
  font-size: 0.72rem;
  color: #71717a;
  margin-top: 6px;
}

.capability-disabled {
  opacity: 0.5;
}

.capability-disabled .capability-hint {
  display: block;
}

.capability-partial .capability-hint {
  display: block;
  color: #facc15;
}

.param-item.capability-disabled .btn-group-selector,
.param-item.capability-disabled .select-input,
.param-item.capability-disabled .text-input,
.param-item.capability-disabled .input-with-btn button,
.input-group.capability-disabled textarea,
.input-group.capability-disabled .input-with-btn button {
  pointer-events: none;
}

.params-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: #d4d4d8;
}

.params-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.param-item.full-width {
  grid-column: 1 / -1;
}

.param-label {
  font-size: 0.8rem;
  color: #a1a1aa;
}

.btn-group-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-select {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #d4d4d8;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-select:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-select.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: transparent;
  color: white;
}

.select-input {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #e4e4e7;
  font-size: 0.85rem;
  cursor: pointer;
  width: 100%;
}

.select-input:focus {
  outline: none;
  border-color: #667eea;
}

.select-input option {
  background: #1a1a2e;
}

.text-input {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #e4e4e7;
  font-size: 0.85rem;
  width: 100%;
}

.text-input:focus {
  outline: none;
  border-color: #667eea;
}

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn input {
  flex: 1;
}

.input-with-btn button {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #d4d4d8;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.input-with-btn button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.accordion {
  margin-bottom: 16px;
}

.accordion-item {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.accordion-title {
  font-size: 0.9rem;
  color: #d4d4d8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.accordion-icon {
  font-size: 0.7rem;
  transition: transform 0.3s;
  color: #71717a;
}

.accordion-item.open .accordion-icon {
  transform: rotate(90deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.accordion-item.open .accordion-content {
  max-height: 200px;
}

.accordion-body {
  padding: 0 14px 14px;
}

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

.template-tag {
  padding: 6px 12px;
  background: rgba(102, 126, 234, 0.12);
  border: 1px solid rgba(102, 126, 234, 0.25);
  border-radius: 16px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.template-tag:hover {
  background: rgba(102, 126, 234, 0.25);
  transform: translateY(-1px);
}

.template-tag.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: transparent;
  color: white;
}

.selected-templates {
  padding: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  min-height: 40px;
  margin-bottom: 16px;
}

.selected-label {
  font-size: 0.75rem;
  color: #71717a;
  margin-bottom: 6px;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.selected-tag {
  padding: 3px 8px;
  background: rgba(118, 75, 162, 0.35);
  border-radius: 10px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.selected-tag .remove {
  cursor: pointer;
  opacity: 0.7;
  font-size: 0.9rem;
  line-height: 1;
}

.selected-tag .remove:hover {
  opacity: 1;
}

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-group .btn {
  min-width: 120px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #e4e4e7;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.right-panel {
  display: flex;
  flex-direction: column;
}

.preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 350px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  position: relative;
}

.preview-area .results-grid {
  align-self: stretch;
}

.placeholder {
  text-align: center;
  color: #71717a;
}

.placeholder-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.placeholder p {
  font-size: 0.9rem;
}

.generated-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 12px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
}

.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.action-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #d4d4d8;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.result-info {
  margin-top: 12px;
  text-align: center;
  font-size: 0.8rem;
  color: #a1a1aa;
  max-width: 100%;
  padding: 0 10px;
}

.results-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.result-card {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid transparent;
}

.result-card.active {
  border-color: rgba(102, 126, 234, 0.6);
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.2);
}

.result-card-header {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.result-image {
  width: 100%;
  border-radius: 8px;
}

.result-card-meta {
  font-size: 0.75rem;
  color: #a1a1aa;
}

.result-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.result-action {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #d4d4d8;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.result-action:hover {
  background: rgba(255, 255, 255, 0.12);
}

.result-meta {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #e4e4e7;
}

.provider-badge {
  background: rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.4);
}

.model-badge {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
}

.loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading.active {
  display: flex;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(102, 126, 234, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  color: #a1a1aa;
  font-size: 0.9rem;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.history-section {
  margin-top: 24px;
}

.history-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 10px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(102, 126, 234, 0.5) transparent;
}

.history-scroll::-webkit-scrollbar {
  height: 6px;
}

.history-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.history-scroll::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.5);
  border-radius: 3px;
}

.history-item {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
  position: relative;
  background: rgba(0, 0, 0, 0.3);
}

.history-item:hover {
  transform: scale(1.08);
}

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

.history-item .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 8px;
}

.history-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.history-badge {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.6rem;
  background: rgba(255, 255, 255, 0.15);
  color: #f8fafc;
}

.history-item:hover .overlay {
  opacity: 1;
}

.history-item .overlay span {
  font-size: 0.65rem;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(102, 126, 234, 0.95);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.shortcut-hint {
  text-align: center;
  font-size: 0.75rem;
  color: #71717a;
  margin-top: 10px;
}

.shortcut-hint kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
}

.input-mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.mode-tab {
  flex: 1;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #a1a1aa;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.mode-tab:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mode-tab.active {
  background: rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.4);
  color: #e4e4e7;
}

.upload-area {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 16px;
}

.upload-area:hover {
  border-color: rgba(102, 126, 234, 0.5);
  background: rgba(102, 126, 234, 0.05);
}

.upload-area.dragover {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.1);
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
  opacity: 0.6;
}

.upload-text {
  color: #a1a1aa;
  font-size: 0.9rem;
}

.upload-hint {
  color: #71717a;
  font-size: 0.8rem;
  margin-top: 6px;
}

.upload-preview {
  display: none;
  position: relative;
}

.upload-preview.has-image {
  display: block;
}

.upload-preview img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.upload-preview .remove-image {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.multi-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.multi-upload-item {
  aspect-ratio: 1;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.multi-upload-item:hover {
  border-color: rgba(102, 126, 234, 0.4);
}

.multi-upload-item.has-image {
  border-style: solid;
  border-color: rgba(102, 126, 234, 0.5);
}

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

.multi-upload-item .upload-label {
  font-size: 0.7rem;
  color: #71717a;
  margin-top: 4px;
}

.multi-upload-item .upload-plus {
  font-size: 1.5rem;
  color: #71717a;
}

.view-controls {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.view-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #a1a1aa;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e4e4e7;
}

.view-btn.active {
  background: rgba(102, 126, 234, 0.3);
  border-color: rgba(102, 126, 234, 0.5);
  color: white;
}

.display-options {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.display-option {
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #a1a1aa;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.display-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.display-option.active {
  background: rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.4);
  color: #e4e4e7;
}

.render-section {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  padding: 14px;
  margin-top: 16px;
}

.render-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #d4d4d8;
  margin-bottom: 12px;
}

.triview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.triview-item {
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71717a;
  font-size: 0.7rem;
}

.triview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.render-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #a1a1aa;
  cursor: pointer;
}

.checkbox-label input {
  accent-color: #667eea;
}

.canvas-3d {
  width: 100%;
  height: 350px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.nav-link-external {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #a1a1aa;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.3s;
}

.nav-link-external:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e4e4e7;
}

.search-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .search-layout {
    grid-template-columns: 1fr;
  }
}

.search-sidebar {
  position: sticky;
  top: 20px;
  height: fit-content;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.search-simple-layout {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.search-box-center {
  display: flex;
  gap: 12px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.search-input-large {
  flex: 1;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #e4e4e7;
  font-size: 1.1rem;
}

.search-input-large:focus {
  outline: none;
  border-color: #667eea;
}

.search-input-large::placeholder {
  color: #71717a;
}

.search-btn-large {
  padding: 16px 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.search-btn-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.results-area {
  min-height: 400px;
}

.search-box {
  display: flex;
  gap: 8px;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #e4e4e7;
  font-size: 0.95rem;
}

.search-input:focus {
  outline: none;
  border-color: #667eea;
}

.search-input::placeholder {
  color: #71717a;
}

.search-btn {
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.hot-tags {
  margin-top: 12px;
}

.hot-label {
  font-size: 0.8rem;
  color: #71717a;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.hot-tag {
  padding: 5px 12px;
  background: rgba(102, 126, 234, 0.15);
  border: 1px solid rgba(102, 126, 234, 0.25);
  border-radius: 14px;
  font-size: 0.8rem;
  color: #d4d4d8;
  cursor: pointer;
  transition: all 0.2s;
}

.hot-tag:hover {
  background: rgba(102, 126, 234, 0.3);
  transform: translateY(-1px);
}

.filter-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #d4d4d8;
  margin-bottom: 14px;
}

.filter-group {
  margin-bottom: 14px;
}

.filter-label {
  font-size: 0.8rem;
  color: #a1a1aa;
  margin-bottom: 8px;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #a1a1aa;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.filter-btn.active {
  background: rgba(102, 126, 234, 0.25);
  border-color: rgba(102, 126, 234, 0.4);
  color: #e4e4e7;
}

.favorites-preview {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.favorites-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: #d4d4d8;
}

.btn-text {
  background: none;
  border: none;
  color: #667eea;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-text:hover {
  text-decoration: underline;
}

.favorites-thumbnails {
  display: flex;
  gap: 8px;
}

.fav-thumb {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
}

.empty-hint {
  font-size: 0.8rem;
  color: #71717a;
}

.search-main {
  min-height: 500px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.results-count {
  font-size: 0.9rem;
  color: #a1a1aa;
}

.results-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.select-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
  width: auto;
}

.view-toggle {
  display: flex;
  gap: 4px;
}

.view-toggle .view-btn {
  padding: 6px 10px;
  font-size: 0.9rem;
}

.masonry-grid {
  columns: 4;
  column-gap: 16px;
}

@media (max-width: 1200px) {
  .masonry-grid { columns: 3; }
}

@media (max-width: 800px) {
  .masonry-grid { columns: 2; }
}

.grid-rank {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.grid-rank .masonry-item {
  aspect-ratio: 1;
  margin-bottom: 0;
}

.grid-rank .masonry-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 1200px) {
  .grid-rank { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 800px) {
  .grid-rank { grid-template-columns: repeat(3, 1fr); }
}

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

.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.grid-view .masonry-item {
  aspect-ratio: 1;
}

.grid-view .masonry-item img {
  height: 100%;
  object-fit: cover;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}

.masonry-item:hover {
  transform: translateY(-4px);
}

.masonry-item img {
  width: 100%;
  display: block;
}

.masonry-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
}

.masonry-item:hover .masonry-overlay {
  opacity: 1;
}

.masonry-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.masonry-tags span {
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  font-size: 0.7rem;
  color: white;
}

.masonry-actions {
  display: flex;
  gap: 6px;
}

.masonry-btn {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.masonry-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.masonry-btn.active {
  background: #ef4444;
}

.load-more {
  text-align: center;
  padding: 20px;
}

.loading-grid {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #71717a;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1rem;
  margin-bottom: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  background: rgba(26, 26, 46, 0.98);
  border-radius: 16px;
  max-width: 1000px;
  max-height: 90vh;
  width: 90%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-large {
  max-width: 1200px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
  font-size: 1.2rem;
  color: #e4e4e7;
}

.modal-body {
  display: flex;
  max-height: calc(90vh - 60px);
  overflow: hidden;
}

.modal-image-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  min-width: 0;
}

.modal-image {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
}

.modal-info {
  width: 320px;
  padding: 20px;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section h3 {
  font-size: 0.9rem;
  color: #d4d4d8;
  margin-bottom: 10px;
}

.info-item {
  display: flex;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.info-label {
  color: #71717a;
  width: 70px;
}

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

.modal-tags .tag {
  padding: 4px 10px;
  background: rgba(102, 126, 234, 0.2);
  border-radius: 12px;
  font-size: 0.8rem;
  color: #d4d4d8;
}

.prompt-box {
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  font-size: 0.8rem;
  color: #a1a1aa;
  margin-bottom: 10px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.modal-actions .btn {
  flex: 1;
  padding: 10px;
  font-size: 0.8rem;
}

.similar-images {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.similar-img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s;
}

.similar-img:hover {
  transform: scale(1.1);
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.favorites-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
}

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

.favorites-item-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.favorites-item:hover .favorites-item-actions {
  opacity: 1;
}

.btn-icon {
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.btn-icon:hover {
  background: rgba(239, 68, 68, 0.8);
}

@media (max-width: 768px) {
  .modal-body {
    flex-direction: column;
  }
  
  .modal-info {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .nav-bar {
    flex-direction: column;
    gap: 12px;
  }
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
}

.platform-badge.etsy {
  background: rgba(241, 100, 30, 0.15);
  color: #f4a261;
  border: 1px solid rgba(241, 100, 30, 0.3);
}

.platform-badge.amazon {
  background: rgba(255, 153, 0, 0.15);
  color: #ffb347;
  border: 1px solid rgba(255, 153, 0, 0.3);
}

.platform-icon {
  font-size: 1.1rem;
}

.product-overlay {
  justify-content: space-between;
  padding: 10px;
}

.product-info-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-price-tag {
  font-size: 1rem;
  font-weight: 700;
  color: #4ade80;
}

.product-rating-mini {
  font-size: 0.7rem;
  color: #fbbf24;
}

.product-platform {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #a1a1aa;
  margin-bottom: 8px;
}

.product-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e4e4e7;
  margin-bottom: 8px;
  line-height: 1.4;
}

.product-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: #4ade80;
  margin-bottom: 8px;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.product-rating .stars {
  color: #fbbf24;
}

.product-rating .rating-count {
  color: #71717a;
}

.shop-info {
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 8px;
}

.favorites-item-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.fav-price {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4ade80;
}

.link-btn {
  background: rgba(102, 126, 234, 0.4) !important;
}

.link-btn:hover {
  background: rgba(102, 126, 234, 0.6) !important;
}

.time-filter-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.time-range-container {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.time-range-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.time-range-label {
  font-size: 0.85rem;
  color: #a1a1aa;
  text-align: center;
}

.time-selects {
  display: flex;
  gap: 8px;
}

.time-select {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #e4e4e7;
  font-size: 0.9rem;
  cursor: pointer;
  min-width: 90px;
}

.time-select:focus {
  outline: none;
  border-color: #667eea;
}

.time-select option {
  background: #1a1a2e;
}

.time-range-separator {
  font-size: 1.5rem;
  color: #667eea;
  padding: 20px 0 0 0;
}

.time-apply-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 20px;
}

.time-apply-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.time-filter-info {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

#time-display {
  font-size: 0.95rem;
  color: #d4d4d8;
  font-weight: 500;
}

@media (max-width: 700px) {
  .time-range-container {
    flex-direction: column;
  }
  
  .time-range-separator {
    transform: rotate(90deg);
    padding: 10px 0;
  }
}

.sales-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.5), transparent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sales-badge .rank {
  font-size: 1rem;
  font-weight: 700;
  color: #fbbf24;
}

.sales-badge .sales {
  font-size: 0.8rem;
  color: #a1a1aa;
}

.masonry-item {
  position: relative;
}

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

.scene-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.scene-option:hover {
  background: rgba(102, 126, 234, 0.15);
  border-color: rgba(102, 126, 234, 0.3);
}

.scene-option.active {
  background: rgba(102, 126, 234, 0.25);
  border-color: #667eea;
}

.scene-icon {
  font-size: 1.8rem;
}

.scene-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e4e4e7;
}

.scene-desc {
  font-size: 0.7rem;
  color: #71717a;
}

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

.keywords-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.keywords-search-box {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  max-width: 800px;
  margin: 0 auto 24px;
}

.keywords-search-box .filter-item {
  flex-shrink: 0;
}

.keywords-search-box .search-input-large {
  flex: 1;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-item label {
  font-size: 0.85rem;
  color: #a1a1aa;
}

.keywords-results {
  display: none;
  flex-direction: column;
  gap: 8px;
  max-width: 700px;
  margin: 0 auto;
}

.keyword-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  transition: all 0.2s;
}

.keyword-row:hover {
  background: rgba(102, 126, 234, 0.12);
  transform: translateX(4px);
}

.keyword-rank {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #a1a1aa;
  flex-shrink: 0;
}

.keyword-rank.top-rank {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #1a1a2e;
}

.keyword-text {
  flex: 1;
  font-size: 1rem;
  color: #e4e4e7;
}

.keyword-heat {
  font-size: 0.9rem;
  color: #fbbf24;
  font-weight: 600;
  flex-shrink: 0;
}

.loading-cell {
  text-align: center;
  padding: 40px !important;
}

@media (max-width: 600px) {
  .keywords-search-box {
    flex-direction: column;
    align-items: stretch;
  }
  
  .keywords-search-box .filter-item {
    width: 100%;
  }
  
  .keyword-row {
    padding: 12px 14px;
    gap: 12px;
  }
  
  .keyword-text {
    font-size: 0.9rem;
  }
  
  .keyword-heat {
    font-size: 0.8rem;
  }
}
