/* CHANNEL SETTINGS STYLES */

.settings-container {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;
}

.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 240px;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border: none;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-size: 0.95rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.settings-tab:hover {
  background: #f8f9fa;
  transform: translateX(4px);
}

.settings-tab.active {
  background: var(--primary-color, #007bff);
  color: white;
  box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}

.settings-tab i {
  font-size: 1.1rem;
}

.settings-content {
  flex: 1;
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

/* Dark mode - settings layout */
[data-theme="dark"] .settings-tabs {
  background: transparent;
}

[data-theme="dark"] .settings-tab {
  background: #111827;
  color: #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  border: 1px solid #1f2937;
}

[data-theme="dark"] .settings-tab:hover {
  background: #1f2937;
  transform: translateX(4px);
}

[data-theme="dark"] .settings-tab.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

[data-theme="dark"] .settings-content {
  background: #1f2937;
  color: #e5e7eb;
  border: 1px solid #263041;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

[data-theme="dark"] .section-header {
  border-bottom: 2px solid #374151;
}

[data-theme="dark"] .section-header h3 {
  color: #f9fafb;
}

[data-theme="dark"] .section-header p {
  color: #9ca3af;
}

[data-theme="dark"] .template-card {
  background: #111827;
  border-color: #1f2937;
  color: #e5e7eb;
}

[data-theme="dark"] .template-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* TEMPLATES PANEL */

.templates-section {
  padding: 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e9ecef;
}

.section-header h3 {
  margin: 0;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-header p {
  margin: 0.5rem 0 0 0;
  color: #6c757d;
  font-size: 0.9rem;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.template-card {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s;
}

.template-card:hover {
  border-color: var(--primary-color, #007bff);
  box-shadow: 0 4px 12px rgba(0,123,255,0.15);
  transform: translateY(-2px);
}

.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.template-card-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: #2c3e50;
}

.template-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  text-transform: uppercase;
}

.badge-primary {
  background: #007bff;
  color: white;
}

.badge-success {
  background: #28a745;
  color: white;
}

.badge-secondary {
  background: #6c757d;
  color: white;
}

.template-card-body {
  margin-bottom: 1rem;
}

.template-type {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6c757d;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.template-preview {
  margin-top: 0.75rem;
}

.template-preview strong {
  display: block;
  color: #495057;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.preview-text {
  background: white;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #495057;
  border-left: 3px solid var(--primary-color, #007bff);
  white-space: pre-wrap;
  word-break: break-word;
}

.template-card-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
}

.btn-icon {
  padding: 0.5rem 0.75rem;
  border: 1px solid #dee2e6;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  color: #495057;
}

.btn-icon:hover {
  background: #f8f9fa;
  border-color: var(--primary-color, #007bff);
  color: var(--primary-color, #007bff);
}

.btn-icon.btn-danger {
  color: #dc3545;
}

.btn-icon.btn-danger:hover {
  background: #fff5f5;
  border-color: #dc3545;
}

/* EMPTY STATE */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #6c757d;
}

.empty-state i {
  font-size: 4rem;
  color: #dee2e6;
  margin-bottom: 1.5rem;
}

.empty-state h4 {
  margin: 1rem 0 0.5rem 0;
  color: #495057;
}

.empty-state p {
  margin: 0 0 1.5rem 0;
}

/* INFO BOX */

.info-box {
  background: #e7f3ff;
  border: 1px solid #b3d9ff;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.info-box i {
  color: #007bff;
  font-size: 1.5rem;
  margin-top: 0.25rem;
}

.info-box strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #004085;
}

.variables-preview {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.variables-preview code {
  background: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #007bff;
  border: 1px solid #b3d9ff;
}

.variables-preview a {
  color: #007bff;
  text-decoration: none;
  font-weight: 600;
}

.variables-preview a:hover {
  text-decoration: underline;
}

/* TEMPLATE MODAL */

.template-preview-modal {
  padding: 1rem 0;
}

.preview-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.preview-section h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem 0;
  font-size: 1rem;
  color: #495057;
}

.preview-content {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  border-left: 3px solid #007bff;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

.preview-body .preview-content {
  border-left-color: #6c757d;
  font-style: italic;
  color: #6c757d;
}

.variables-helper {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

/* VARIABLES LIST MODAL */

.variables-list {
  max-height: 500px;
  overflow-y: auto;
}

.variable-category {
  margin-bottom: 2rem;
}

.variable-category h5 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: #2c3e50;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e9ecef;
}

.variable-category .table {
  margin-bottom: 0;
}

.variable-category code {
  background: #e7f3ff;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: #007bff;
  font-size: 0.9rem;
}

/* FORM GROUPS */

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #495057;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color, #007bff);
  box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
  font-family: 'Consolas', 'Monaco', monospace;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.form-check-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.form-check-label {
  cursor: pointer;
  user-select: none;
}

.text-muted {
  color: #6c757d !important;
  font-size: 0.85rem;
}

/* RESPONSIVE */

@media (max-width: 768px) {
  .settings-container {
    flex-direction: column;
  }

  .settings-tabs {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    min-width: unset;
  }

  .settings-tab {
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  .templates-grid {
    grid-template-columns: 1fr;
  }
}
