/*
 * SocksDesigner - Design Editor Styles
 * Extends base.css design system
 */

/* =============================================
   Design Editor Layout
   ============================================= */

html,
body {
  height: 100%;
  margin: 0;
  background: var(--gradient-surface), var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.layout {
  height: 100vh;
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
}

/* =============================================
   3D Viewer Panel
   ============================================= */

.viewer {
  flex: 3;
  min-width: 460px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 26%), rgba(17, 21, 34, 0.55);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-default);
  background: rgba(0, 0, 0, 0.1);
}

.viewer-nav-left,
.viewer-nav-right {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.btn-nav {
  height: var(--btn-height-xs);
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
}

.btn-ghost.btn-nav {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-ghost.btn-nav:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-default);
  background: rgba(0, 0, 0, 0.12);
}

.viewer-title {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  letter-spacing: 0.2px;
}

.viewer-actions {
  display: flex;
  gap: var(--space-2);
}

.viewer-stage {
  flex: 1;
  position: relative;
}

.viewer-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.viewer-hint {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
  border-top: 1px solid var(--border-default);
  background: rgba(0, 0, 0, 0.08);
}

.canvas-panel {
  flex: 3;
  min-width: 0;
  display: flex;
  height: 100%;
  min-height: 0;
}

.canvas-panel #textureEditorCard {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: fit-content;
  height: 100%;
  min-height: 0;
  padding: var(--space-2);
  margin: 0 auto;
}

.canvas-panel #textureEditorCard .card-title {
  margin-bottom: 0;
}

.editor-card-toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: var(--space-2);
  min-height: 0;
  width: 100%;
}

.editor-card-tip {
  margin: 0;
  white-space: normal;
  max-width: 100%;
}

.editor-card-actions {
  margin-bottom: 0;
  flex-wrap: wrap;
}

.canvas-panel .texture-editor {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  aspect-ratio: 168 / 300;
  width: auto;
  align-self: center;
}

.canvas-panel .texture-editor canvas {
  width: 100%;
  height: 100%;
  aspect-ratio: 168 / 300;
  max-width: none;
  max-height: none;
  object-fit: fill;
  object-position: center;
}

/* =============================================
   Control Panel
   ============================================= */

.panel {
  flex: 4;
  min-width: 340px;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Tabs */
.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-2);
}

.tab-btn {
  height: var(--btn-height-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: var(--font-semibold);
  transition: all var(--duration-fast) var(--ease-out);
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.tab-btn.is-active {
  background: var(--gradient-brand);
  border-color: rgba(255, 255, 255, 0.18);
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: var(--space-3);
}

.tab-panel.is-active {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

/* Split Row */
.split-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: rgba(17, 21, 34, 0.6);
  box-shadow: var(--shadow-lg);
}

.panel-title {
  font-family: var(--font-display);
  font-weight: var(--font-extrabold);
}

/* =============================================
   Cards
   ============================================= */

.card {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--gradient-card), var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
  transition: all var(--duration-normal) var(--ease-out);
}

.card:hover {
  border-color: var(--border-strong);
}

.is-hidden {
  display: none !important;
}

.card-title {
  font-family: var(--font-display);
  font-weight: var(--font-extrabold);
  margin-bottom: var(--space-2);
}

.muted {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin-bottom: var(--space-2);
}

/* =============================================
   Layout Utilities
   ============================================= */

.row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-2);
}

.grid-2,
.grid-3 {
  display: grid;
  gap: var(--space-2);
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
}

.grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.text-control-row {
  margin-top: var(--space-2);
}

/* =============================================
   Form Elements
   ============================================= */

.label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.input,
.select {
  width: 100%;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text-primary);
  padding: 0 var(--space-2);
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.input[type="file"] {
  height: var(--btn-height-md);
  line-height: var(--btn-height-md);
  padding: 0 var(--space-3);
}

.input[type="file"]::file-selector-button,
.input[type="file"]::-webkit-file-upload-button {
  height: var(--btn-height-xs);
  margin: 0 var(--space-2) 0 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-family: var(--font-sans);
  cursor: pointer;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

.file-name {
  color: var(--text-muted);
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.custom-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.custom-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.16);
}

.custom-item.is-selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-muted);
}

.custom-item:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-muted);
}

.custom-item-title {
  font-size: var(--text-sm);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-item-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.is-hidden {
  display: none !important;
}

.font-picker {
  position: relative;
}

.font-picker-trigger {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  font-size: 16px;
}

.font-picker-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: rgba(12, 14, 22, 0.98);
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  display: none;
}

.font-picker.is-open .font-picker-menu {
  display: block;
}

.font-picker-option {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}

.font-picker-option:hover,
.font-picker-option.is-active {
  background: rgba(255, 255, 255, 0.08);
}

.font-picker-option-name {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.font-picker-option-preview {
  font-size: 18px;
  line-height: 1.2;
}

.input:hover,
.select:hover {
  border-color: var(--border-strong);
}

.input:focus,
.select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-muted), var(--shadow-glow-sm);
}

/* Buttons in Design Editor */
.btn {
  height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: var(--font-medium);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-strong);
}

.btn-wide {
  min-width: 80px;
  text-align: center;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gradient-brand);
  border-color: rgba(255, 255, 255, 0.14);
  color: white;
}

.btn-primary:hover {
  background: var(--gradient-brand-hover);
  box-shadow: var(--shadow-glow-sm);
  transform: translateY(-1px);
}

.btn.is-active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.75), rgba(16, 185, 129, 0.55));
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-default);
}

.btn-ghost:hover {
  background: var(--bg-highlight);
}

.checkbox {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.range {
  width: 100%;
  accent-color: var(--color-primary);
}

/* =============================================
   Gallery & Thumbnails
   ============================================= */

.gallery {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-2);
}

.gallery-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-3) 0;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.stats-table th,
.stats-table td {
  padding: var(--space-2);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
}

.stats-table th {
  color: var(--text-muted);
  font-weight: var(--font-semibold);
}

.thumb {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.12);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 4 / 5;
  transition: all var(--duration-fast) var(--ease-out);
}

.thumb:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  image-rendering: pixelated;
}

.thumb-selected {
  outline: 2px solid var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-muted), var(--shadow-glow-sm);
}

.icon-library .thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1);
  background: #ffffff;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.icon-library {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-rows: 84px;
  align-items: start;
  max-height: none;
  overflow-y: auto;
  align-content: start;
  padding-right: 4px;
  min-height: 0;
  flex: 1;
  height: 100%;
}

.icon-library-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.icon-library-loading-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  color: #ffffff;
  font-size: 13px;
  letter-spacing: 0.02em;
  font-weight: 700;
  pointer-events: none;
  z-index: 5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  background:
    radial-gradient(circle at center, rgba(9, 12, 22, 0.78) 0%, rgba(9, 12, 22, 0.58) 36%, rgba(9, 12, 22, 0.38) 62%, rgba(9, 12, 22, 0.08) 100%);
}

.icon-library-loading-overlay::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  margin-right: 10px;
  animation: icon-loading-spin 0.8s linear infinite;
}

.icon-library-loading-overlay.is-visible {
  display: flex;
}

@keyframes icon-loading-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

#tab-icon .card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.icon-library .thumb img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  background: #ffffff;
}

#customLogoList .custom-upload-thumb {
  background:
    linear-gradient(45deg, #f1f3f8 25%, transparent 25%) -8px 0 / 16px 16px,
    linear-gradient(-45deg, #f1f3f8 25%, transparent 25%) -8px 0 / 16px 16px,
    linear-gradient(45deg, transparent 75%, #f1f3f8 75%) -8px 0 / 16px 16px,
    linear-gradient(-45deg, transparent 75%, #f1f3f8 75%) -8px 0 / 16px 16px,
    #ffffff;
}

#customLogoList .custom-upload-thumb img {
  background: transparent;
}

#customLogoList .custom-upload-thumb.is-pending {
  background: rgba(11, 16, 31, 0.9);
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.4);
}

.custom-upload-pending {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: var(--font-semibold);
  letter-spacing: 0.02em;
}

.custom-upload-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(18, 20, 31, 0.82);
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}

.custom-upload-delete-btn:hover {
  background: rgba(210, 52, 70, 0.95);
}

.icon-palette-editor {
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

.icon-palette-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
}

.icon-palette-color {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.icon-palette-arrow {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.color-code-btn {
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.color-code-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* =============================================
   Color Palette
   ============================================= */

.palette {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.swatch {
  width: 32px;
  height: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.color-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.color-chip {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: #ffffff;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.1);
  transition: all var(--duration-fast) var(--ease-out);
}

.color-chip:hover {
  transform: scale(1.1);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.1), var(--shadow-glow-sm);
}

.palette-row .color-chip {
  width: 32px;
  height: 32px;
}

/* =============================================
   Color Modal
   ============================================= */

.color-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-4);
  backdrop-filter: blur(4px);
}

#colorModal {
  z-index: calc(var(--z-modal) + 20);
}

#iconColorModal {
  z-index: calc(var(--z-modal) + 10);
}

.color-modal.is-open {
  display: flex;
}

.color-modal-content {
  width: min(560px, 95vw);
  max-height: 80vh;
  overflow: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  background: var(--bg-overlay);
  box-shadow: var(--shadow-xl);
  padding: var(--space-4);
}

.color-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.color-modal-title {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
}

.color-options {
  display: grid;
  gap: var(--space-3);
}

.color-option-section {
  display: grid;
  gap: var(--space-2);
}

.color-option-section-title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.color-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-2);
}

.color-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: rgba(0, 0, 0, 0.15);
  cursor: pointer;
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: all var(--duration-fast) var(--ease-out);
}

.color-option:hover {
  border-color: var(--border-strong);
  background: rgba(0, 0, 0, 0.25);
}

.color-option-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.color-option-name {
  font-weight: var(--font-medium);
  line-height: 1.2;
}

.color-option-usage {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.1;
}

.color-option-code {
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}

.color-option-code:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.color-option .swatch {
  border-radius: var(--radius-full);
  flex: 0 0 auto;
}

.color-option.is-selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-muted);
}

#iconColorMapList {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2);
}

#iconColorMapList .icon-palette-item {
  width: auto;
  max-width: max-content;
}

/* =============================================
   Share Modal
   ============================================= */

.share-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-4);
  backdrop-filter: blur(4px);
}

.share-modal.is-open {
  display: flex;
}

/* =============================================
   Auto Order Overlay
   ============================================= */

.auto-order-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  background: rgba(10, 12, 16, 0.78);
  backdrop-filter: blur(4px);
  padding: var(--space-4);
}

.auto-order-overlay.is-visible {
  display: flex;
}

.auto-order-card {
  width: min(420px, 92vw);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  background: var(--bg-overlay);
  box-shadow: var(--shadow-xl);
  padding: var(--space-5);
  text-align: center;
}

.auto-order-title {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
}

.auto-order-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.share-modal-content {
  width: min(520px, 95vw);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  background: var(--bg-overlay);
  box-shadow: var(--shadow-xl);
  padding: var(--space-5);
  max-height: 90vh;
  overflow: auto;
}

.share-modal-title {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
}

.share-form {
  margin-top: var(--space-3);
  display: grid;
  gap: var(--space-2);
  display: none;
}

.ai-meta-loading {
  display: none;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.04);
  gap: var(--space-2);
}

.ai-meta-loading.is-active {
  display: grid;
}

.ai-meta-label {
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.ai-meta-tip {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.ai-progress {
  position: relative;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.ai-progress-bar {
  position: absolute;
  inset: 0;
  width: 35%;
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.1), rgba(124, 92, 255, 0.7), rgba(124, 92, 255, 0.1));
  animation: ai-progress-indeterminate 1.3s ease-in-out infinite;
}

@keyframes ai-progress-indeterminate {
  0% { transform: translateX(-60%); }
  100% { transform: translateX(220%); }
}

.share-textarea {
  min-height: 84px;
  resize: vertical;
}

.share-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr 1fr;
  margin-top: var(--space-2);
}

.share-field .label {
  margin-bottom: var(--space-1);
}

.share-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.tag-btn {
  height: 28px;
  padding: 0 var(--space-2);
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.tag-btn:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.12);
}

.share-modal.is-sharing .share-form {
  display: grid;
}

.share-modal.is-risk .share-form {
  display: none !important;
}

.share-modal.is-risk .share-actions {
  display: none;
}

.share-risk {
  margin-top: var(--space-3);
  border: 1px solid rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: grid;
  gap: var(--space-2);
}

.share-risk-title {
  font-weight: var(--font-semibold);
  color: #fecaca;
}

.share-risk-text {
  color: #ffe4e6;
  font-size: var(--text-sm);
}

.share-actions {
  margin-top: var(--space-4);
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.share-submit-status {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: var(--space-2);
}

.share-submit-status.is-hidden {
  display: none;
}

.share-submit-label {
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.share-submit-tip {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.share-submit-progress {
  position: relative;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.share-submit-progress-bar {
  position: absolute;
  inset: 0;
  width: 35%;
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.1), rgba(124, 92, 255, 0.7), rgba(124, 92, 255, 0.1));
  animation: ai-progress-indeterminate 1.3s ease-in-out infinite;
}

/* =============================================
   Texture Editor
   ============================================= */

.texture-editor {
  border: none;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
  position: relative;
  padding: 0;
  margin: 0;
}

.texture-editor canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  object-fit: contain;
  object-position: center;
}

.color-usage-live {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 9;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(11, 16, 28, 0.8);
  color: #f8fbff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.color-usage-live.is-invalid {
  border-color: rgba(248, 113, 113, 0.9);
  background: rgba(127, 29, 29, 0.9);
}

.editor-selection-bar {
  position: absolute;
  z-index: 8;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: rgba(8, 12, 20, 0.88);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(4px);
}

.editor-selection-bar.is-visible {
  display: inline-flex;
}

.btn.btn-xs {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 8px;
}

.editor-selection-angle {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

/* =============================================
   Responsive Design
   ============================================= */

@media (max-width: 1080px) {
  .layout {
    flex-direction: column;
    height: auto;
  }

  .viewer {
    min-width: 0;
    height: 56vh;
  }

  .panel {
    max-width: none;
    min-width: 0;
  }

  .editor-card-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-card-tip {
    white-space: normal;
  }
}

@media (max-width: 768px) {
  .layout {
    padding: var(--space-2);
    gap: var(--space-2);
  }

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

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

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

  .split-row {
    grid-template-columns: 1fr;
  }

  .share-grid {
    grid-template-columns: 1fr;
  }
}
