/* Prompt Templates Container */
.prompt-templates-container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .prompt-templates-container {
    padding: 0 3rem;
  }
}

@media (min-width: 1200px) {
  .prompt-templates-container {
    padding: 0 4rem;
  }
}

.prompt-templates-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.prompt-templates-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

/* Filters */
.prompt-templates-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--surface-secondary);
  border-radius: 8px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.filter-select {
  padding: 0.5rem 2rem 0.5rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--surface-primary);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1em;
  color: var(--text-primary);
  font-size: 0.875rem;
  appearance: none;
}

/* Template Table */
.prompt-templates-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.prompt-templates-table thead {
  background: var(--surface-secondary);
  border-bottom: 2px solid var(--border-color);
}

.prompt-templates-table th {
  padding: 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.prompt-templates-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--text-primary);
}

.prompt-templates-table tbody tr {
  transition: background 0.2s ease;
}

.prompt-templates-table tbody tr:hover {
  background: var(--surface-secondary);
}

.prompt-templates-table tbody tr:last-child td {
  border-bottom: none;
}

.template-link {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.template-link:hover {
  color: var(--accent-color);
}

.template-type-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.description-column {
  max-width: 300px;
  color: var(--text-secondary);
}

.variables-column {
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.actions-column {
  text-align: right;
  white-space: nowrap;
}

.text-muted {
  color: var(--text-secondary);
  opacity: 0.6;
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-model-type {
  background: var(--surface-tertiary);
  color: var(--text-primary);
}

.badge-model-type.badge-image {
  background: #e3f2fd;
  color: #1976d2;
}

.badge-model-type.badge-video {
  background: #f3e5f5;
  color: #7b1fa2;
}

.badge-model-type.badge-text {
  background: #e8f5e9;
  color: #388e3c;
}

.badge-model-type.badge-audio {
  background: #fff3e0;
  color: #f57c00;
}

.badge-status.badge-active {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-status.badge-draft {
  background: #fff3e0;
  color: #f57c00;
}

.badge-status.badge-inactive {
  background: #f5f5f5;
  color: #757575;
}

.badge-status.badge-archived {
  background: #ffebee;
  color: #c62828;
}

.prompt-template-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.prompt-template-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.prompt-template-info {
  display: flex;
  gap: 1.5rem;
}

.meta-item {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.prompt-template-actions {
  display: flex;
  gap: 0.5rem;
}

/* Form Styles */
.prompt-template-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
}

/* Danger Zone */
.danger-zone {
  margin-top: 3rem;
  padding: 1.5rem;
  background: rgba(239, 83, 80, 0.05);
  border: 1px solid rgba(239, 83, 80, 0.3);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.danger-zone-title {
  font-size: 1rem;
  font-weight: 600;
  color: #c62828;
  margin: 0 0 0.5rem 0;
  align-self: flex-start;
}

.danger-zone-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
  align-self: flex-start;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2rem;
}

.prompt-template-form {
  background: var(--surface-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2rem;
}

.form-section {
  margin-bottom: 2.5rem;
}

.form-section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.form-field {
  margin-bottom: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-textarea.prompt-editor {
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  min-height: 300px;
}

.form-help-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-style: italic;
}

.form-errors {
  background: #ffebee;
  border: 1px solid #ef5350;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 2rem;
}

.form-errors h3 {
  color: #c62828;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.form-errors ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.form-errors li {
  color: #c62828;
  font-size: 0.875rem;
  padding: 0.25rem 0;
}

.template-help {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface-secondary);
  border-radius: 6px;
  border-left: 3px solid var(--accent-color);
}

.template-help-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.template-variables-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.5rem;
}

.template-variables-list li {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.form-actions {
  display: flex;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

/* Show Page Styles */
.prompt-template-show {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
}

.prompt-template-show-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.prompt-template-show-actions {
  display: flex;
  gap: 0.5rem;
}

.prompt-template-show-content {
  display: grid;
  gap: 2rem;
}

.info-section {
  background: var(--surface-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.subsection-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.info-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.template-preview {
  background: var(--surface-secondary);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.template-content {
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

.template-variables {
  margin-top: 1rem;
}

.variable-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.variable-tag {
  padding: 0.375rem 0.75rem;
  background: var(--surface-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.75rem;
  color: var(--accent-color);
}

.usage-example {
  background: var(--surface-secondary);
  border-radius: 6px;
  padding: 1rem;
}

.example-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.example-output {
  background: var(--surface-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1rem;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

/* Button Styles */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-sm {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--surface-tertiary);
  border-color: var(--accent-color);
}

.btn-danger {
  background: #ef5350;
  color: white;
}

.btn-danger:hover {
  background: #c62828;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239, 83, 80, 0.3);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

/* Dark mode adjustments */
[data-theme="dark"] {
  --surface-primary: #1e1e1e;
  --surface-secondary: #2a2a2a;
  --surface-tertiary: #363636;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --border-color: #404040;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
}

[data-theme="dark"] .btn-secondary {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .btn-secondary:hover {
  background: var(--surface-tertiary);
  border-color: var(--accent-color);
}

[data-theme="dark"] .badge-model-type.badge-image {
  background: #1e3a5f;
  color: #60a5fa;
}

[data-theme="dark"] .badge-model-type.badge-video {
  background: #3d1e4f;
  color: #c084fc;
}

[data-theme="dark"] .badge-model-type.badge-text {
  background: #1e4620;
  color: #4ade80;
}

[data-theme="dark"] .badge-model-type.badge-audio {
  background: #4f3214;
  color: #fb923c;
}

[data-theme="dark"] .badge-status.badge-active {
  background: #1e4620;
  color: #4ade80;
}

[data-theme="dark"] .badge-status.badge-draft {
  background: #4f3214;
  color: #fb923c;
}

[data-theme="dark"] .badge-status.badge-inactive {
  background: #2a2a2a;
  color: #9ca3af;
}

[data-theme="dark"] .badge-status.badge-archived {
  background: #4f1e1e;
  color: #ef4444;
}

[data-theme="dark"] .text-muted {
  color: #b0b0b0;
  opacity: 1;
}
