/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: #fff;
  border-radius: var(--border-radius);
  padding: 6px;
  box-shadow: var(--shadow);
}

.tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  color: var(--gray-600);
}

.tab-btn:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}

.tab-btn.active svg {
  stroke: #fff;
}

/* Tab Content */
.tab-content {
  display: none;
}

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

/* Editor Layout */
.editor-section {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 24px;
  margin-top: 20px;
  box-shadow: var(--shadow);
}

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

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

.preview-wrapper {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background-image:
    linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.preview-wrapper canvas {
  max-width: 100%;
  max-height: 400px;
  display: block;
}

.image-info {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.image-info span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.controls-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-section {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 20px;
}

.control-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gray-200);
}

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

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

.control-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

/* Message Input */
.message-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  transition: border-color 0.2s;
}

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

.char-count {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 8px;
}

.capacity-hint {
  color: var(--gray-400);
}

/* Text Input */
.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

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

.input-hint {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--gray-400);
}

/* Radio Group */
.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s;
  background: #fff;
}

.radio-option:hover {
  border-color: var(--primary);
}

.radio-option input:checked + span {
  color: var(--primary);
  font-weight: 500;
}

.radio-option:has(input:checked) {
  border-color: var(--primary);
  background: #eef2ff;
}

.radio-option input[type="radio"] {
  accent-color: var(--primary);
}

/* Download Section */
.download-section {
  margin-top: auto;
  padding-top: 16px;
}

.download-section .btn {
  width: 100%;
}

/* Result Section */
.result-section {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--gray-200);
}

.result-section .section-header {
  margin-bottom: 12px;
}

.result-section .section-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
}

.result-text {
  padding: 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--gray-800);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.result-text.error {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fecaca;
}

.result-text.success {
  color: #059669;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.info-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
}

.info-item p {
  font-size: 0.85rem;
  color: var(--gray-500);
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .tab-nav {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .info-grid {
    grid-template-columns: 1fr;
  }

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

  .radio-option {
    width: 100%;
  }
}
