/* Wordcloud Layout */
.wordcloud-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-bottom: 20px;
}

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

/* Canvas Panel */
.canvas-panel {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.canvas-panel .section-header {
  flex-wrap: nowrap;
}

.canvas-container {
  position: relative;
  width: 100%;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wordcloudCanvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.canvas-placeholder {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--gray-400);
}

.canvas-placeholder p {
  font-size: 0.95rem;
}

.canvas-info {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.canvas-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.canvas-actions .btn {
  white-space: nowrap;
}

/* Controls Panel */
.controls-panel {
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.controls-panel .tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.controls-panel .tab {
  flex: 1;
  padding: 14px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-500);
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.controls-panel .tab:hover {
  color: var(--gray-700);
  background: var(--gray-100);
}

.controls-panel .tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #fff;
}

.tab-content {
  display: none;
  padding: 20px;
}

.tab-content.active {
  display: block;
}

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

.control-section:last-child {
  margin-bottom: 0;
}

.control-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.value-display {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  background: #eef2ff;
  padding: 2px 8px;
  border-radius: 4px;
}

.hint {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-bottom: 8px;
}

/* Textarea */
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Select Input */
.select-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--gray-800);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s;
}

.select-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Color Picker */
.color-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.color-row .color-picker {
  width: 48px;
  height: 40px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  cursor: pointer;
  padding: 3px;
}

.color-row .select-input {
  flex: 1;
}

/* Range Input */
.range-input {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--gray-200);
  border-radius: 3px;
  outline: none;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
}

.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Number Input */
.size-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

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

.size-field label {
  font-size: 0.85rem;
  color: var(--gray-600);
}

.number-input {
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.number-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Size Presets */
.size-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Button Group */
.button-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

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

.button-group .btn-small {
  flex: 1;
  min-width: 0;
}

/* Shortcut Hint */
.shortcut-hint {
  text-align: center;
  padding: 8px;
  background: var(--gray-50);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--gray-400);
}

/* Steps Grid */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.step-card {
  padding: 20px;
  background: var(--gray-50);
  border-radius: 8px;
  border: 1px solid var(--gray-200);
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.step-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 8px;
}

.step-card p {
  font-size: 0.85rem;
  color: var(--gray-600);
  line-height: 1.6;
}

/* Footer */
footer {
  text-align: center;
  padding: 24px;
  margin-top: 40px;
  color: var(--gray-500);
  font-size: 0.85rem;
}

footer a {
  color: var(--primary);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 20px 16px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .wordcloud-layout {
    grid-template-columns: 1fr;
  }

  .canvas-container {
    min-height: 300px;
  }

  .canvas-panel .section-header {
    flex-wrap: wrap;
    gap: 12px;
  }

  .canvas-actions {
    width: 100%;
  }

  .canvas-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .button-group {
    flex-direction: column;
  }

  .button-group .btn {
    min-width: 100%;
  }

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