/* ../styles/users.css */

/* General Page Enhancements */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0;
  font-size: 1.8em;
}

/* Card and Table Styling */
.card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef;
}

.card-header h2 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
}

.card-actions {
  display: flex;
  gap: 10px;
}

.form-select {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background-color: #fff;
  font-size: 0.9em;
}

.card-body {
  padding: 20px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
}

.data-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  font-size: 0.9em;
  text-transform: uppercase;
  color: #495057;
}

.data-table tbody tr:hover {
  background-color: #f1f3f5;
}

.user-info-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #007bff; /* Example color, can be dynamic or an image */
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
}
.user-avatar.small {
  width: 32px;
  height: 32px;
  font-size: 1.1em;
}
.user-avatar.large {
  width: 60px;
  height: 60px;
  font-size: 2em;
  margin-bottom: 10px;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 500;
  text-transform: capitalize;
}

.status-badge.active {
  background-color: #d1e7dd; /* Light green */
  color: #0f5132; /* Dark green */
}

.status-badge.inactive {
  background-color: #f8d7da; /* Light red */
  color: #842029; /* Dark red */
}
.status-badge.pending {
  /* Added for consistency if needed elsewhere */
  background-color: #fff3cd; /* Light yellow */
  color: #664d03; /* Dark yellow */
}
.status-badge.approved {
  /* Added for consistency if needed elsewhere */
  background-color: #d1e7dd;
  color: #0f5132;
}
.status-badge.rejected {
  /* Added for consistency if needed elsewhere */
  background-color: #f8d7da;
  color: #842029;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 5px;
  font-size: 1.1em;
  transition: color 0.2s ease;
}

.btn-icon:hover {
  color: #007bff;
}
.btn-icon.delete:hover {
  color: #dc3545;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  gap: 5px;
}

.pagination-btn {
  background-color: #fff;
  border: 1px solid #dee2e6;
  color: #007bff;
  padding: 8px 12px;
  text-decoration: none;
  transition: background-color 0.3s;
  border-radius: 4px;
  cursor: pointer;
}

.pagination-btn:hover:not([disabled]) {
  background-color: #e9ecef;
}

.pagination-btn.active {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.pagination-btn:disabled {
  color: #6c757d;
  cursor: not-allowed;
  background-color: #f8f9fa;
}

/* Modal Styling */
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 1050; /* Higher than sidebar */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5); /* Dim background */
  padding-top: 50px; /* For centering effect */
}

.modal.active {
  display: flex; /* Use flex to center content */
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: #fefefe;
  margin: auto;
  padding: 0; /* Remove padding, header/body/footer will handle it */
  border: 1px solid #888;
  width: 80%;
  max-width: 600px; /* Max width for larger screens */
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 15px 20px;
  background-color: #007bff;
  color: white;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3em;
}

.close-modal {
  color: white;
  float: right;
  font-size: 28px;
  font-weight: bold;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
  color: #f1f1f1;
  text-decoration: none;
}

.modal-body {
  padding: 20px;
  max-height: 70vh; /* Allow scrolling for long forms */
  overflow-y: auto;
}

/* Form Styling within Modals */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 0.9em;
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 0.95em;
}

.form-control:focus {
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-row {
  display: flex;
  gap: 15px;
}

.form-row .form-group {
  flex: 1; /* Distribute space equally */
}

.password-input-container {
  position: relative;
}

.password-input-container .form-control {
  padding-right: 40px; /* Space for the toggle button */
}

.toggle-password {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  border: none;
  background: transparent;
  padding: 0 12px;
  cursor: pointer;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toggle-password:hover {
  color: #343a40;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e9ecef;
}

/* Buttons (General, assuming from dashboard.css but can be customized here) */
.btn {
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}
.btn-primary:hover {
  background-color: #0056b3;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}
.btn-secondary:hover {
  background-color: #545b62;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
}
.btn-danger:hover {
  background-color: #b02a37;
}

/* View User Modal Specifics */
.user-profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e9ecef;
}

.user-profile-info h3 {
  margin: 0 0 5px 0;
  font-size: 1.4em;
}
.user-profile-info p {
  margin: 0 0 8px 0;
  color: #6c757d;
}

.user-profile-details .detail-item {
  display: flex;
  margin-bottom: 10px;
  font-size: 0.95em;
}
.user-profile-details .detail-label {
  font-weight: 600;
  color: #495057;
  width: 120px; /* Adjust as needed */
}

.user-recent-activity {
  margin-top: 20px;
}
.user-recent-activity h4 {
  font-size: 1.1em;
  margin-bottom: 10px;
  color: #343a40;
}
.activity-list.small .activity-item {
  /* Assuming styles from dashboard.css, make adjustments if needed */
  padding: 8px 0;
}
.activity-list.small .activity-icon {
  width: 30px;
  height: 30px;
  font-size: 0.9em;
}

/* Styles for dynamically added rows or error messages */
.error-message {
  color: #dc3545;
  font-size: 0.85em;
  margin-top: 5px;
}

.is-invalid {
  border-color: #dc3545 !important;
}
.is-invalid:focus {
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.details-section {
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid #e9ecef;
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.details-header h4 {
  margin: 0;
  font-size: 1.1em;
  font-weight: 600;
}

.user-detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-detail-row .form-group {
  margin-bottom: 0;
  flex-grow: 1;
}

.user-detail-row .btn-icon {
  flex-shrink: 0;
  color: #6c757d;
}
.user-detail-row .btn-icon:hover {
  color: #dc3545;
}

.user-detail-group {
  position: relative;
  padding: 20px 15px 15px 15px; /* More space at top for button */
  border: 1px solid #e9ecef;
  border-radius: 6px;
  margin-bottom: 15px;
  background-color: #fdfdfd;
}

/* Space between the key and value inputs */
.user-detail-group .form-group {
  margin-bottom: 10px;
}

/* No margin on the last input */
.user-detail-group .form-group:last-child {
  margin-bottom: 0;
}

/* Style for the new labels */
.user-detail-group .form-group label {
  font-size: 0.85em;
  font-weight: 600;
  color: #495057;
  margin-bottom: 4px;
}

/* Position the delete button in the top-right corner */
.delete-detail-row {
  position: absolute;
  top: 5px;
  right: 5px;
  color: #adb5bd; /* Softer initial color */
  padding: 3px;
}

.delete-detail-row:hover {
  color: #dc3545;
  background-color: #f8f9fa;
}

/* ../styles/users.css */

/* ... (all existing CSS) ... */

/* --- NEW STYLES FOR REQUIRED & READ-ONLY FIELDS --- */

/* Style for the key input when it's read-only */
.form-control.readonly-key {
  background-color: #e9ecef; /* Light grey to indicate it's not editable */
  cursor: not-allowed;
  font-weight: 500;
  color: #495057;
}

/* Add a visual indicator (a blue left border) to required detail groups */
.user-detail-group.is-required {
  border-left: 3px solid #007bff;
  padding-left: 12px; /* Adjust padding to not overlap the border */
}

/* Position the delete button correctly, even with the new padding */
.user-detail-group.is-required .delete-detail-row {
  right: 5px; /* Ensure it stays in the corner */
}
