/* ModelEdit.css - Styles for the record edit page */

.model-edit {
  padding: 2rem;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.model-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

.edit-title h1 {
  margin: 0;
  color: #1f2937;
  font-size: 1.875rem;
  font-weight: 600;
}

.edit-title p {
  margin: 0.5rem 0 0 0;
  color: #6b7280;
  font-size: 0.875rem;
}

.edit-actions {
  display: flex;
  gap: 0.75rem;
}

.edit-actions .btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.edit-actions .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.edit-actions .btn-primary {
  background-color: #3b82f6;
  color: white;
}

.edit-actions .btn-primary:hover:not(:disabled) {
  background-color: #2563eb;
}

.edit-actions .btn-secondary {
  background-color: #6b7280;
  color: white;
}

.edit-actions .btn-secondary:hover:not(:disabled) {
  background-color: #4b5563;
}

.edit-form {
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  padding: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

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

.field-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
}

.pk-badge,
.fk-badge {
  font-size: 0.625rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-weight: 500;
  text-transform: uppercase;
}

.pk-badge {
  background-color: #fef3c7;
  color: #92400e;
}

.fk-badge {
  background-color: #ddd6fe;
  color: #6b21a8;
}

.required {
  color: #ef4444;
  font-weight: bold;
}

.field-input {
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: all 0.2s;
  background-color: white;
}

.field-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.field-input.error {
  border-color: #ef4444;
  background-color: #fef2f2;
}

.field-input.error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.field-input:disabled {
  background-color: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}

.field-value.readonly {
  padding: 0.75rem;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  color: #6b7280;
  font-family:
    ui-monospace, SFMono-Regular, 'SF Mono', Consolas, 'Liberation Mono', Menlo,
    monospace;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-value.readonly.password-field {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.password-display {
  font-family: monospace;
  font-size: 0.75rem;
  color: #9ca3af;
  letter-spacing: 0.1em;
  background-color: #f9fafb;
  padding: 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.password-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
}

.password-field .field-note {
  margin: 0;
  flex: 1;
}

/* Password field for creation */
.password-field-create {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.password-field-create .field-input {
  width: 100%;
}

.password-field-create .field-note {
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
  margin: 0;
  padding: 0.25rem 0.5rem;
  background-color: #f0f9ff;
  border: 1px solid #e0f2fe;
  border-radius: 0.25rem;
}

.field-note {
  font-size: 0.75rem;
  color: #9ca3af;
  font-style: italic;
}

textarea.field-input {
  resize: vertical;
  min-height: 6rem;
  font-family: inherit;
}

select.field-input {
  cursor: pointer;
}

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

.error-message {
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 500;
}

.field-meta {
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
}

.model-edit-error {
  padding: 2rem;
  text-align: center;
}

.model-edit-error h2 {
  color: #ef4444;
  margin-bottom: 1rem;
}

.model-edit-error p {
  color: #6b7280;
  margin-bottom: 2rem;
}

.model-edit-error .btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
}

.model-edit-error .btn-secondary {
  background-color: #6b7280;
  color: white;
}

.model-edit-error .btn-secondary:hover {
  background-color: #4b5563;
}

/* Admin Page Loading - Centered within admin content area */
.admin-page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px); /* Account for header and padding */
  width: 100%;
}

/* Responsive design - Sidebar-aware breakpoints */
/* Large desktop screens - sidebar + content fits comfortably */

/* Medium desktop - account for sidebar width (1024px - 280px sidebar = 744px content) */

/* Small desktop/large tablet - sidebar significantly reduces available width */

/* Small tablets and large mobile screens */

/* Mobile phone screens */

/* Very small mobile screens */

/* Loading state for save button */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.btn:disabled .spin {
  animation: spin 1s linear infinite;
}
