/**
 * Staff / Teacher Management Stylesheet
 *
 * Hardcodes literal colors per project convention.
 * Ensures strict responsive behavior: overflow-x: auto, word-break: break-word, min-width: 0.
 *
 * @package Elimu_ERP_Staff
 */

/* =========================================================================
   1. METABOX ACCOUNT LINKING STYLES
   ========================================================================= */

.eerp-staff-linking-wrapper {
  font-family: var(--eerp-font-body);
  color: var(--eerp-text);
  position: relative;
  min-width: 0;
}

.eerp-hint-text {
  font-size: 12px;
  color: var(--eerp-text-muted);
  line-height: 1.4;
  margin: 0 0 12px 0;
}

.eerp-form-group {
  margin-bottom: 12px;
  position: relative;
}

.eerp-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--eerp-neutral-700);
  margin-bottom: 4px;
}

.eerp-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.eerp-search-input-wrapper .eerp-spinner {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

.eerp-search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--eerp-surface);
  border: 1px solid var(--eerp-neutral-300);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
}

.eerp-search-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.eerp-search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--eerp-neutral-100);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.eerp-search-result-item:hover {
  background-color: var(--eerp-neutral-50);
}

.eerp-result-avatar img {
  border-radius: 50%;
  display: block;
}

.eerp-result-info {
  flex: 1;
  min-width: 0;
}

.eerp-result-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--eerp-neutral-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eerp-result-meta {
  font-size: 11px;
  color: var(--eerp-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eerp-search-no-results,
.eerp-search-error {
  padding: 12px;
  font-size: 12px;
  color: var(--eerp-text-muted);
  text-align: center;
}

.eerp-action-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 12px 0;
}

.eerp-action-divider::before,
.eerp-action-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--eerp-border);
}

.eerp-action-divider span {
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--eerp-text-muted);
  text-transform: uppercase;
}

.eerp-btn-block {
  width: 100%;
  justify-content: center;
  text-align: center;
}

/* Linked Card */
.eerp-linked-badge-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--eerp-neutral-50);
  border: 1px solid var(--eerp-border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.eerp-linked-avatar {
  flex-shrink: 0;
}

.eerp-linked-avatar img {
  border-radius: 50%;
  display: block;
}

.eerp-linked-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.eerp-linked-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--eerp-neutral-900);
  word-break: break-word;
}

.eerp-linked-login {
  font-size: 12px;
  color: var(--eerp-brand);
  font-weight: 500;
}

.eerp-linked-email {
  font-size: 11px;
  color: var(--eerp-text-muted);
  word-break: break-all;
}

.eerp-role-pill {
  display: inline-block;
  align-self: flex-start;
  background: var(--eerp-brand-soft);
  color: var(--eerp-brand);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

.eerp-linked-actions {
  display: flex;
  justify-content: flex-end;
}

.eerp-btn-unlink {
  color: var(--eerp-status-absent) !important;
  font-size: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.eerp-btn-unlink:hover {
  color: var(--eerp-status-absent-text) !important;
  text-decoration: underline;
}

/* =========================================================================
   2. CREATE USER MODAL
   ========================================================================= */

.eerp-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.eerp-modal-dialog {
  background: var(--eerp-surface);
  border-radius: 10px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.eerp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--eerp-border);
}

.eerp-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--eerp-neutral-900);
}

.eerp-modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--eerp-text-muted);
  cursor: pointer;
  padding: 0;
}

.eerp-modal-close:hover {
  color: var(--eerp-neutral-900);
}

.eerp-modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 70vh;
}

.eerp-form-row {
  margin-bottom: 14px;
}

.eerp-form-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--eerp-neutral-700);
  margin-bottom: 4px;
}

.eerp-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.eerp-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: var(--eerp-neutral-50);
  border-top: 1px solid var(--eerp-border);
}

/* =========================================================================
   3. RESPONSIVE UTILITIES & BADGES
   ========================================================================= */

.eerp-cell-break {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.eerp-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.eerp-badge-role {
  background-color: var(--eerp-neutral-100);
  color: var(--eerp-text);
}

.eerp-badge-unlinked {
  background-color: var(--eerp-neutral-50);
  color: var(--eerp-text-muted);
  border: 1px solid var(--eerp-border);
}

@media (max-width: 600px) {
  .eerp-grid-2col {
    grid-template-columns: 1fr;
  }
}

/* ===== Staff & Access Management panel ===== */

.eerp-staff-access-wrapper {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: #334155;
}

.eerp-sa-header h2 {
	margin-bottom: 4px;
	color: var(--eerp-primary, #0f2b48);
}

.eerp-sa-subtitle {
	color: #64748b;
	margin-top: 0;
}

.eerp-sa-alert {
	padding: 10px 14px;
	border-radius: 6px;
	margin-bottom: 14px;
	font-size: 0.9rem;
}

.eerp-sa-alert-success { background: #dcfce7; color: #166534; }
.eerp-sa-alert-danger { background: #fee2e2; color: #991b1b; }

.eerp-sa-loading,
.eerp-sa-empty {
	color: #64748b;
	padding: 20px 0;
}

.eerp-sa-table-wrap {
	overflow-x: auto;
}

.eerp-sa-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.eerp-sa-table th,
.eerp-sa-table td {
	text-align: left;
	padding: 10px 14px;
	border-bottom: 1px solid #e2e8f0;
	white-space: nowrap;
}

.eerp-sa-table th {
	background: #f1f5f9;
	color: #334155;
}

.eerp-sa-toggle {
	width: 18px;
	height: 18px;
	cursor: pointer;
}
