/* Email Template Generator Styles */

.etpl-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.etpl-intro {
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  border-left: 4px solid #7c3aed;
  padding: 1.25rem 1.5rem;
  border-radius: 0 10px 10px 0;
  margin-bottom: 1.5rem;
}

.etpl-intro p {
  margin: 0;
  color: #5b21b6;
  line-height: 1.6;
}

.etpl-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

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

.etpl-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.etpl-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 1rem 0;
  padding-bottom: 0.625rem;
  border-bottom: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.etpl-section-title span {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
}

.etpl-hint {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 1rem 0;
}

/* Categories */
.etpl-categories {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.etpl-category-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.etpl-category-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.etpl-category-btn.active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.etpl-category-btn .etpl-cat-count {
  margin-left: auto;
  font-size: 0.75rem;
  background: rgba(0,0,0,0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 8px;
}

.etpl-category-btn.active .etpl-cat-count {
  background: rgba(255,255,255,0.2);
}

/* Template List */
.etpl-template-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  max-height: 400px;
  overflow-y: auto;
}

.etpl-template-btn {
  padding: 0.625rem 0.875rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.8125rem;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.etpl-template-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.etpl-template-btn.active {
  background: #ede9fe;
  border-color: #7c3aed;
  color: #5b21b6;
}

/* Fields */
.etpl-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
}

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

.etpl-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.etpl-field label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
}

.etpl-field input {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.etpl-field input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Preview */
.etpl-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 2px solid #e5e7eb;
}

.etpl-preview-header .etpl-section-title {
  margin: 0;
  padding: 0;
  border: none;
}

.etpl-actions {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.etpl-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
  color: #374151;
}

.etpl-btn:hover {
  background: #f3f4f6;
}

.etpl-btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.etpl-btn-primary {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.etpl-btn-primary:hover {
  background: #6d28d9;
}

.etpl-preview {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.etpl-preview-subject {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

.etpl-preview-subject label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b7280;
}

.etpl-subject-text {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #111827;
  outline: none;
}

.etpl-preview-body {
  padding: 1rem;
  min-height: 250px;
}

.etpl-body-text {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #374151;
  white-space: pre-wrap;
  outline: none;
}

.etpl-body-text:focus,
.etpl-subject-text:focus {
  background: #fffbeb;
}

/* Tips */
.etpl-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.etpl-tip h3 {
  font-size: 0.9375rem;
  margin: 0 0 0.5rem 0;
  color: #111827;
}

.etpl-tip ul {
  margin: 0;
  padding-left: 1.125rem;
  color: #4b5563;
  font-size: 0.8125rem;
  line-height: 1.7;
}

/* FAQ */
.etpl-faq details {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.875rem 0;
}

.etpl-faq details:last-child {
  border-bottom: none;
}

.etpl-faq summary {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #111827;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.etpl-faq summary::-webkit-details-marker {
  display: none;
}

.etpl-faq summary::after {
  content: '+';
  font-size: 1.125rem;
  color: #6b7280;
}

.etpl-faq details[open] summary::after {
  content: '−';
}

.etpl-faq details p {
  margin: 0.625rem 0 0 0;
  color: #4b5563;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Toast */
.etpl-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #10b981;
  color: #fff;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 9999;
}

.etpl-toast.show {
  opacity: 1;
  transform: translateY(0);
}
