/**
 * Relations Module Styles
 */

/* Relation Editor */
.relation-editor {
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 100%;
}

.relation-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.relation-editor-header h4 {
  margin: 0;
  font-size: 18px;
  color: #1f2937;
}

.relation-help-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #6f86cf;
  color: white;
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.relation-help-btn:hover {
  background: #5671c0;
  transform: scale(1.1);
}

.relation-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.relation-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.relation-field span {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
}

.relation-field input,
.relation-field select {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.15s ease;
}

.relation-field input:focus,
.relation-field select:focus {
  outline: none;
  border-color: #6f86cf;
  box-shadow: 0 0 0 3px rgba(111, 134, 207, 0.1);
}

.relation-field input.disabled-input {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.relation-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}

.relation-divider::before,
.relation-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.relation-divider span {
  font-size: 11px;
  text-transform: uppercase;
  color: #9ca3af;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.relation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.relation-delete-btn {
  margin-right: auto;
  padding: 10px 16px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 14px;
  color: #dc2626;
  cursor: pointer;
  transition: all 0.15s ease;
}

.relation-delete-btn:hover {
  background: #fecaca;
  border-color: #fca5a5;
}

.relation-cancel-btn {
  padding: 10px 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.relation-cancel-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

/* Related Records Panel */
.related-records-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.related-records-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #9ca3af;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.related-records-empty p {
  margin: 0 0 16px;
  font-size: 14px;
}

.add-relation-btn {
  padding: 8px 16px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  font-size: 13px;
  color: #1e40af;
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-relation-btn:hover {
  background: #dbeafe;
  border-color: #6f86cf;
}

.related-records-section {
  background: #f9fafb;
  border-radius: 8px;
  overflow: hidden;
}

.related-records-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

.related-records-header h5 {
  margin: 0;
  font-size: 14px;
  color: #374151;
}

.related-count {
  background: #e5e7eb;
  color: #6b7280;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.related-records-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.no-records {
  padding: 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

.add-related-btn {
  margin-top: 8px;
  padding: 6px 12px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  font-size: 12px;
  color: #1e40af;
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-related-btn:hover {
  background: #dbeafe;
}

.related-record-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.related-record-item:hover {
  background: #f9fafb;
  border-color: #6f86cf;
}

.record-title {
  font-size: 13px;
  color: #1f2937;
  font-weight: 500;
}

.unlink-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s ease;
}

.unlink-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Relation Help Dialog */
.relation-help-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.relation-help {
  background: white;
  border-radius: 12px;
  padding: 24px;
}

.relation-help h3 {
  margin: 0 0 20px;
  font-size: 18px;
  color: #1f2937;
}

.relation-help .help-section {
  margin-bottom: 20px;
}

.relation-help .help-section h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #374151;
}

.relation-help .help-section ul,
.relation-help .help-section ol {
  margin: 0;
  padding-left: 20px;
}

.relation-help .help-section li {
  margin-bottom: 8px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.relation-help .help-section strong {
  color: #374151;
}

/* Relation Dialog */
.relation-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  background: transparent;
}

/* Dark theme */
body.dark-theme .relation-editor {
  background: #1e293b;
}

body.dark-theme .relation-editor-header h4 {
  color: #f1f5f9;
}

body.dark-theme .relation-field span {
  color: #94a3b8;
}

body.dark-theme .relation-field input,
body.dark-theme .relation-field select {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

body.dark-theme .relation-field input:focus,
body.dark-theme .relation-field select:focus {
  border-color: #6f86cf;
}

body.dark-theme .relation-field input.disabled-input {
  background: #1e293b;
  color: #64748b;
}

body.dark-theme .relation-divider::before,
body.dark-theme .relation-divider::after {
  background: #334155;
}

body.dark-theme .relation-divider span {
  color: #64748b;
}

body.dark-theme .relation-actions {
  border-top-color: #334155;
}

body.dark-theme .relation-cancel-btn {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark-theme .relation-cancel-btn:hover {
  background: #475569;
}

body.dark-theme .related-records-panel {
  background: transparent;
}

body.dark-theme .related-records-section {
  background: #1e293b;
}

body.dark-theme .related-records-header {
  background: #0f172a;
  border-bottom-color: #334155;
}

body.dark-theme .related-records-header h5 {
  color: #e2e8f0;
}

body.dark-theme .related-count {
  background: #334155;
  color: #e2e8f0;
}

body.dark-theme .related-records-list {
  background: transparent;
}

body.dark-theme .related-record-item {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .related-record-item:hover {
  background: #1e293b;
  border-color: #6f86cf;
}

body.dark-theme .record-title {
  color: #e2e8f0;
}

body.dark-theme .no-records {
  color: #64748b;
}

body.dark-theme .add-relation-btn,
body.dark-theme .add-related-btn {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #93c5fd;
}

body.dark-theme .add-relation-btn:hover,
body.dark-theme .add-related-btn:hover {
  background: #1e40af;
}

body.dark-theme .relation-help {
  background: #1e293b;
}

body.dark-theme .relation-help h3 {
  color: #f1f5f9;
}

body.dark-theme .relation-help .help-section h4 {
  color: #e2e8f0;
}

body.dark-theme .relation-help .help-section li {
  color: #94a3b8;
}

body.dark-theme .relation-help .help-section strong {
  color: #f1f5f9;
}
