:root {
  --card-bg: var(--surface);
  --card-border: var(--border);
  --card-shadow: var(--shadow);
}

.text-image-panel {
  max-width: 1100px;
  margin: 0 auto;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-header h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.card-header p {
  margin: 0;
  color: var(--muted);
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 700;
  color: var(--muted);
}

.panel-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.field-label {
  font-weight: 600;
  color: var(--muted);
}

.textarea-field textarea {
  min-height: 240px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  resize: vertical;
}

.select-input,
.num-input,
.text-input {
  width: 100%;
  height: 50px;
  padding: 14px 16px;
  border-radius: 25px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.num-input:focus,
.select-input:focus,
.text-input:focus {
  outline: none;
  background: var(--bg);
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.color-input {
  height: 44px;
  padding: 0;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.options-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    cursor: pointer;
    user-select: none;
    justify-content: center;
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.check span {
  font-size: 0.95rem;
  color: var(--text);
}

.actions {
  display: flex;
  justify-content: stretch;
}

.actions .primary-btn {
  width: 100%;
}



.preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.preview-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.image-preview-area {
  width: 100%;
  min-height: 380px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: repeating-conic-gradient(#1f2937 0% 25%, #111827 0% 50%) 50% / 24px 24px;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}

#preview-canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#preview-canvas.no-shadow {
  box-shadow: none;
}

@media (max-width: 900px) {
  .actions {
    justify-content: flex-start;
  }
}

/* Color Picker Styles */
.color-picker-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-panel--horizontal {
  flex-direction: row;
  gap: 8px;
  align-items: center;
  width: fit-content;
}

.hue-control {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 160px;
}

.hue-control--vertical {
  height: 200px;
  width: 24px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hue-track {
  width: 32px;
  height: 200px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}

.hue-thumb {
  position: absolute;
  width: 30px;
  height: 6px;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  left: 50%;
  transform: translate(-50%, -50%);
}

.sv-picker {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.sv-picker canvas {
  display: block;
}

.sv-thumb {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  transform: translate(-5px, -5px);
  pointer-events: none;
}

.picker-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-indicator {
  width: 200px;
  height: 200px;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Disabled color picker styles */
.color-picker--disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(50%);
}

/* Modern Collapsible Design */
.options-collapsible {
  position: relative;
  z-index: 10;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.options-collapsible:not(.collapsed) {
  border: none;
  box-shadow: none;
  overflow: visible;
}

.options-collapsible.collapsed {
  background: transparent;
  overflow: visible;
}

.options-toggle {
  width: 100%;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  line-height: 1;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  z-index: 20;
}

/* Collapsed State: Prominent Action Button */
.options-collapsible.collapsed .options-toggle {
  background: linear-gradient(135deg, #6366f1, #a855f7); /* Indigo -> Purple */
  color: white;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
  margin-bottom: 0;
}

.options-collapsible.collapsed .options-toggle:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px -5px rgba(99, 102, 241, 0.5);
  filter: brightness(1.1);
}

/* Expanded State: Subtle Control Button */
.options-collapsible:not(.collapsed) .options-toggle {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin-bottom: 24px; /* Distinct spacing from content */
}

.options-collapsible:not(.collapsed) .options-toggle:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.options-toggle i {
  font-size: 1.1em;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}

.options-collapsible.collapsed .options-toggle i {
  transform: rotate(180deg);
}

.options-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.12); /* Clean floating shadow */
  overflow: hidden;
  
  /* Initial State (Hidden) */
  max-height: 0;
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  transform-origin: top center;
  
  transition: 
    max-height 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.4s ease,
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.options-content:not(.collapsed) {
  max-height: 2500px;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.options-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.options-content .options {
  padding: 32px;
}

@media (max-width: 768px) {
  /* 모바일 색상 선택기 indicator 크기 조정 */
  .color-input {
    height: 40px;
    min-width: 60px;
  }

  .options-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .options-content .options {
    padding: 20px;
  }
  .picker-panel--horizontal {
    display: grid;
    grid-template-columns: auto 2fr;
  }
  .color-indicator {
    height: 20px;
    width: 20px;
  }
}
