/* ══════════════════════════════════════════════
   HR Dashboard — Employee Management Styles
   ══════════════════════════════════════════════ */

/* ── Toolbar ── */
.emp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.emp-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.emp-search-wrapper::before {
  content: "\1F50D";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0.5;
}

.emp-search {
  width: 100%;
  padding: 10px 14px 10px 36px;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--card-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.emp-search::placeholder {
  color: #94a3b8;
}

.emp-search:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.emp-filter-select {
  padding: 10px 32px 10px 14px;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--card-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 150px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.emp-filter-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.emp-btn-add {
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  background: #3b82f6;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

.emp-btn-add:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.emp-btn-add:active {
  background: #1d4ed8;
  transform: scale(0.97);
}

/* ── Table ── */
.emp-table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.emp-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  min-width: 700px;
}

.emp-table th,
.emp-table td {
  padding: 14px 18px;
  text-align: left;
}

.emp-table th {
  background: var(--sidebar-bg);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.emp-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.emp-table tbody tr:hover {
  background: #eff6ff;
  transition: background 0.15s;
}

.emp-table tr:not(:last-child) td {
  border-bottom: 1px solid var(--border-color);
}

/* ── Status Badges (within employee table) ── */
.emp-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.emp-badge--active {
  background: #dcfce7;
  color: #166534;
}

.emp-badge--inactive {
  background: #fee2e2;
  color: #991b1b;
}

.emp-badge--on-leave {
  background: #fef9c3;
  color: #854d0e;
}

/* ── Action Buttons ── */
.emp-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.emp-action-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.emp-action-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.emp-action-btn:active {
  transform: scale(0.92);
}

.emp-action-btn--view:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #3b82f6;
}

.emp-action-btn--edit:hover {
  background: #fefce8;
  border-color: #eab308;
  color: #ca8a04;
}

.emp-action-btn--delete:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
}

/* ── Empty State ── */
.emp-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.emp-empty-state span {
  display: block;
  font-size: 2rem;
  margin-bottom: 8px;
}

/* ── Modal Overlay ── */
.emp-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: empModalFadeIn 0.2s ease-out;
}

@keyframes empModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes empModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Modal Card ── */
.emp-modal {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  margin: 1rem;
  padding: 0;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  overflow-y: auto;
  animation: empModalSlideIn 0.25s ease-out;
}

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

.emp-modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.emp-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 1.15rem;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.emp-modal-close:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.emp-modal-body {
  padding: 24px;
}

/* ── Detail Modal ── */
.emp-detail-top {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.emp-detail-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 1px;
}

.emp-detail-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.emp-detail-role {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

.emp-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.emp-detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.emp-detail-field .field-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.emp-detail-field .field-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* ── Form Modal ── */
.emp-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.emp-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.emp-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.emp-form-group.full-width {
  grid-column: 1 / -1;
}

.emp-form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.emp-form-group label .required {
  color: #ef4444;
  margin-left: 2px;
}

.emp-form-group input,
.emp-form-group select {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-sizing: border-box;
}

.emp-form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.emp-form-group input:focus,
.emp-form-group select:focus {
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* ── Validation error state ── */
.emp-form-group input.is-invalid,
.emp-form-group select.is-invalid {
  border-color: #ef4444;
  background: #fff5f5;
}

.emp-form-group input.is-invalid:focus,
.emp-form-group select.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.emp-form-error {
  font-size: 0.78rem;
  color: #ef4444;
  font-weight: 500;
  min-height: 1rem;
}

/* ── Modal Footer / Actions ── */
.emp-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

.emp-btn {
  padding: 9px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

.emp-btn:active {
  transform: scale(0.97);
}

.emp-btn--primary {
  color: #ffffff;
  background: #3b82f6;
}

.emp-btn--primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.emp-btn--secondary {
  color: var(--text-primary);
  background: #f1f5f9;
  border: 1px solid var(--border-color);
}

.emp-btn--secondary:hover {
  background: #e2e8f0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .emp-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .emp-search-wrapper {
    min-width: auto;
  }

  .emp-filter-select {
    min-width: auto;
    width: 100%;
  }

  .emp-btn-add {
    width: 100%;
    text-align: center;
  }

  .emp-table-wrapper {
    margin: 0 -16px;
    border-radius: 0;
  }

  .emp-modal {
    margin: 0.5rem;
    max-height: 95vh;
  }

  .emp-form-row {
    grid-template-columns: 1fr;
  }

  .emp-detail-grid {
    grid-template-columns: 1fr;
  }

  .emp-detail-top {
    flex-direction: column;
    text-align: center;
  }
}
