/* Email Templates Page Styles */

/* Use flex layout for proper footer positioning */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Main content area with proper spacing */
.templates-wrap {
  flex: 1;
  padding-top: 8rem;
  padding-bottom: 2rem;
  background: #f8fafc;
  min-height: calc(100vh - 200px);
}

/* Container with proper max-width and spacing */
.templates-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Section header styling */
.templates-header {
  margin-bottom: 2rem;
}

.templates-header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.templates-header p {
  color: #6b7280;
  font-size: 1rem;
  margin: 0;
  line-height: 1.5;
}

/* Main grid layout */
.templates-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Left panel (template selector) */
.panel-nav {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  position: sticky;
  top: 7rem;
  max-height: calc(100vh - 10rem);
  overflow-y: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Right panel (editor) */
.panel-editor {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Form field styling */
.field-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.field-row:last-child {
  margin-bottom: 0;
}

.field-row input,
.field-row select {
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.875rem;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-row input:focus,
.field-row select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.field-row input {
  flex: 1;
}

.field-row select {
  min-width: 120px;
}

/* Split layout for editor and preview */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

/* Textarea styling */
.textarea {
  width: 100%;
  min-height: 240px;
  padding: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  background: #fff;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Preview area */
#preview {
  background: #f8fafc !important;
  white-space: pre-wrap;
  overflow: auto;
  border: 1px solid #e5e7eb;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #374151;
}

/* Labels and hints */
.hint {
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: block;
}

/* Badge styling */
.badge {
  background: #e5e7eb;
  color: #374151;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

/* Toolbar styling */
.toolbar {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

/* Empty state */
#editorEmpty {
  text-align: center;
  padding: 3rem 1rem;
  color: #9ca3af;
  font-size: 1rem;
}

/* Button styling improvements */
.btn {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.btn-outline {
  background: transparent;
  color: #2563eb;
  border: 1px solid #2563eb;
}

.btn-outline:hover {
  background: #2563eb;
  color: #fff;
}

/* Sample data section */
.sample-data-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.sample-data-section .textarea {
  min-height: 100px;
}

/* Responsive design */
@media (max-width: 1024px) {
  .templates-grid {
    grid-template-columns: 280px 1fr;
    gap: 1rem;
  }
  
  .panel-nav {
    padding: 1rem;
  }
  
  .panel-editor {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  .templates-wrap {
    padding-top: 6rem;
    padding-bottom: 1rem;
  }
  
  .templates-container {
    padding: 0 1rem;
  }
  
  .templates-header h1 {
    font-size: 1.875rem;
  }
  
  .templates-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .panel-nav {
    position: static;
    max-height: none;
    order: 2;
  }
  
  .panel-editor {
    order: 1;
  }
  
  .split {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .field-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .field-row input,
  .field-row select {
    width: 100%;
  }
  
  .toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .btn {
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }
}

@media (max-width: 480px) {
  .templates-wrap {
    padding-top: 5rem;
  }
  
  .templates-header h1 {
    font-size: 1.5rem;
  }
  
  .panel-nav,
  .panel-editor {
    padding: 1rem;
  }
  
  .textarea {
    min-height: 200px;
    font-size: 0.8rem;
  }
  
  .toolbar {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
}

/* Footer positioning */
.footer {
  margin-top: auto;
}
