/* ============================================================
   WHALE OS - Employee Master & Profile (Relate Style)
   Light SaaS • Precision Typography • High Data Density • Arabic RTL
   ============================================================ */

/* Main Layout & Canvas */
.em-layout,
.ep-layout {
  padding: 24px;
  background: var(--bg-primary, #fcfcfc);
  min-height: 100vh;
  font-family: inherit;
  color: var(--midnight-ink, #020520);
  direction: rtl;
}

/* Header & Actions */
.em-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.em-header-info h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--midnight-ink, #020520);
  margin: 0 0 4px 0;
  font-family: var(--font-heading, 'Cairo', sans-serif);
  letter-spacing: -0.02em;
}

.em-header-info p {
  color: var(--ash-helper, #6b7280);
  font-size: 13px;
  margin: 0;
}

.em-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons System - Relate Pills */
.em-add-btn {
  background: var(--primary, #145aff);
  border: 1px solid transparent;
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 90, 255, 0.2);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.em-add-btn:hover {
  background: var(--royal-hover, #0d47d9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20, 90, 255, 0.25);
}

.em-btn-secondary {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  color: var(--graphite-body, #14141e);
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.em-btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.em-btn-danger {
  background: #fef2f2;
  border: 1px solid rgba(242, 96, 82, 0.25);
  color: var(--coral-lost, #f26052);
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.em-btn-danger:hover {
  background: #fee2e2;
  border-color: var(--coral-lost, #f26052);
}

/* Stats Row Cards */
.em-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.em-stat-card {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-relate-card);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.em-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-relate-card-hover);
  border-color: #cbd5e1;
}

.em-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
}

.em-stat-card.stat-active::before    { background: var(--mint-win, #16ca2e); }
.em-stat-card.stat-probation::before { background: var(--amber-pending, #ffa64d); }
.em-stat-card.stat-notice::before    { background: var(--coral-lost, #f26052); }
.em-stat-card.stat-archived::before  { background: var(--ash-helper, #6b7280); }

.em-stat-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--midnight-ink, #020520);
  font-family: var(--font-metrics, 'Inter', sans-serif);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-bottom: 4px;
}

.em-stat-label {
  font-size: 12px;
  color: var(--ash-helper, #6b7280);
  font-weight: 500;
}

.em-stat-card.stat-active .em-stat-val { color: var(--mint-win, #16ca2e); }
.em-stat-card.stat-probation .em-stat-val { color: var(--amber-pending, #ffa64d); }
.em-stat-card.stat-notice .em-stat-val { color: var(--coral-lost, #f26052); }
.em-stat-card.stat-archived .em-stat-val { color: var(--ash-helper, #6b7280); }

/* Toolbar & Filters */
.em-controls {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  box-shadow: var(--shadow-relate-card);
}

.em-search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.em-search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ash-helper, #6b7280);
  font-size: 13px;
  pointer-events: none;
}

.em-search-input {
  width: 100%;
  height: 38px;
  background: var(--fog-surface, #f8fafc);
  border: 1px solid var(--stone-divider, #e2e8f0);
  padding: 0 38px 0 14px;
  border-radius: 9999px;
  color: var(--midnight-ink, #020520);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.em-search-input:focus {
  border-color: var(--primary, #145aff);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(20, 90, 255, 0.12);
}

.em-filter-select {
  height: 38px;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  color: var(--graphite-body, #14141e);
  padding: 0 14px 0 32px;
  border-radius: 9999px;
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
  min-width: 140px;
  transition: border-color 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
}

.em-filter-select:hover,
.em-filter-select:focus {
  border-color: #cbd5e1;
}

/* Layout Switcher */
.em-layout-switcher {
  display: flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 9999px;
  border: 1px solid var(--stone-divider, #e2e8f0);
}

.em-layout-btn {
  background: transparent;
  border: none;
  color: var(--ash-helper, #6b7280);
  padding: 5px 10px;
  border-radius: 9999px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}

.em-layout-btn.active {
  background: #ffffff;
  color: var(--primary, #145aff);
  box-shadow: 0 1px 2px rgba(2, 5, 32, 0.04);
}

/* Data Table Grid */
.em-table-wrap {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-relate-card);
}

.em-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: right;
}

.em-table thead th {
  background: #f8fafc;
  color: var(--ash-helper, #6b7280);
  font-size: 11.5px;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--stone-divider, #e2e8f0);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

.em-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--stone-divider, #e2e8f0);
  font-size: 13px;
  color: var(--graphite-body, #14141e);
  vertical-align: middle;
}

.em-table tbody tr {
  transition: background-color 0.15s ease;
}

.em-table tbody tr:hover {
  background-color: #f1f5f9;
}

.em-table tbody tr.selected {
  background-color: var(--lavender-wash, #f0f4fe) !important;
}

.em-row-archived {
  opacity: 0.6;
}

/* Sorting */
th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover {
  color: var(--midnight-ink, #020520);
}
.em-sort-indicator {
  display: inline-block;
  margin-right: 4px;
  font-size: 10px;
}

/* Checkboxes Column */
.em-th-cb, .em-td-cb {
  width: 40px;
  text-align: center !important;
  padding: 10px !important;
}

.em-row-select-cb, #em-select-all {
  width: 16px;
  height: 16px;
  accent-color: var(--primary, #145aff);
  cursor: pointer;
}

/* Status Badges - Relate Status Pill */
.em-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
}

.em-status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.em-status-active {
  background: #eefcf0;
  color: #15803d;
  border: 1px solid rgba(22, 202, 46, 0.2);
}

.em-status-probation {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid rgba(255, 166, 77, 0.25);
}

.em-status-notice {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid rgba(242, 96, 82, 0.2);
}

.em-status-suspended {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid rgba(242, 96, 82, 0.2);
}

.em-status-resigned,
.em-status-archived {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid var(--stone-divider, #e2e8f0);
}

/* Compliance Badges */
.em-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
}

.em-badge-success { background: #eefcf0; color: #15803d; }
.em-badge-warning { background: #fffbeb; color: #b45309; }
.em-badge-danger  { background: #fef2f2; color: #b91c1c; }

/* Actions Cell & Buttons */
.em-actions-cell {
  display: flex;
  gap: 6px;
  justify-content: flex-start;
}

.em-action-btn {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  color: var(--slate-caption, #475569);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.em-action-btn:hover {
  background: #f1f5f9;
  color: var(--midnight-ink, #020520);
}

.em-btn-edit:hover {
  border-color: rgba(20, 90, 255, 0.3);
  color: var(--primary, #145aff);
}

.em-btn-archive:hover {
  border-color: rgba(242, 96, 82, 0.3);
  color: var(--coral-lost, #f26052);
}

/* Bulk Actions Bar */
.em-bulk-actions-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 50px);
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 9999px;
  padding: 10px 22px;
  box-shadow: var(--shadow-relate-modal);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.em-bulk-actions-bar.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.em-bulk-content {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: var(--midnight-ink, #020520);
}

.em-bulk-actions {
  display: flex;
  gap: 8px;
}

.em-btn-bulk {
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.em-btn-bulk-activate {
  background: #eefcf0;
  color: #15803d;
}

.em-btn-bulk-archive {
  background: #fef2f2;
  color: #b91c1c;
}

/* Pagination */
.em-pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: #ffffff;
  border-top: 1px solid var(--stone-divider, #e2e8f0);
  flex-wrap: wrap;
  gap: 12px;
}

.em-pagination-info {
  font-size: 12px;
  color: var(--ash-helper, #6b7280);
}

.em-pagination-controls {
  display: flex;
  gap: 4px;
}

.em-page-btn {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  color: var(--slate-caption, #475569);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.em-page-btn:hover:not([disabled]) {
  background: #f1f5f9;
  color: var(--midnight-ink, #020520);
}

.em-page-btn.active {
  background: var(--primary, #145aff);
  border-color: var(--primary, #145aff);
  color: #ffffff;
  font-weight: 600;
}

.em-page-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Cards Grid Layout Mode */
.em-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 16px;
  background: var(--bg-primary, #fcfcfc);
}

.em-card {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-relate-card);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.em-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-relate-card-hover);
}

.em-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.em-card-avatar {
  width: 40px;
  height: 40px;
  background: var(--lavender-wash, #f0f4fe);
  color: var(--primary, #145aff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.em-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--midnight-ink, #020520);
  margin: 0;
  cursor: pointer;
}

.em-card-name:hover {
  color: var(--primary, #145aff);
}

.em-card-id {
  font-size: 11px;
  color: var(--ash-helper, #6b7280);
  font-family: var(--font-metrics, 'Inter', sans-serif);
}

.em-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 12px;
}

.em-card-info-item {
  display: flex;
  justify-content: space-between;
  color: var(--graphite-body, #14141e);
}

.em-card-info-item span {
  color: var(--ash-helper, #6b7280);
}

/* ══════════════════════════════════════════════════════════
   EMPLOYEE PROFILE STYLES (Relate Style)
   ══════════════════════════════════════════════════════════ */

.ep-header-card {
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-relate-card);
}

.ep-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.ep-profile-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ep-profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--lavender-wash, #f0f4fe);
  color: var(--primary, #145aff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

.ep-profile-meta h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--midnight-ink, #020520);
  margin: 0 0 4px;
}

.ep-profile-subtitle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ash-helper, #6b7280);
}

.ep-profile-subtitle span.sep {
  opacity: 0.4;
}

.ep-completeness-container {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--lavender-wash, #f0f4fe);
  border: 1px solid rgba(20, 90, 255, 0.15);
  padding: 6px 12px;
  border-radius: 9999px;
}

.ep-completeness-label {
  font-size: 11px;
  color: var(--primary, #145aff);
  font-weight: 600;
}

.ep-completeness-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary, #145aff);
  font-family: var(--font-metrics, 'Inter', sans-serif);
}

.ep-completeness-bar-bg {
  width: 70px;
  height: 6px;
  background: rgba(20, 90, 255, 0.15);
  border-radius: 9999px;
  overflow: hidden;
}

.ep-completeness-bar-fill {
  height: 100%;
  background: var(--primary, #145aff);
  border-radius: 9999px;
}

.ep-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--stone-divider, #e2e8f0);
  flex-wrap: wrap;
  gap: 10px;
}

.ep-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 9999px;
  color: var(--slate-caption, #475569);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ep-btn-back:hover {
  background: #f1f5f9;
  color: var(--midnight-ink, #020520);
}

/* Tabs Navigation - Pill Tabs */
.ep-tabs-nav {
  display: flex;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 9999px;
  padding: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: var(--shadow-xs);
}

.ep-tabs-nav::-webkit-scrollbar {
  display: none;
}

.ep-tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 9999px;
  color: var(--slate-caption, #475569);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ep-tab-btn:hover {
  color: var(--midnight-ink, #020520);
  background: #f1f5f9;
}

.ep-tab-btn.active {
  color: var(--primary, #145aff);
  background: var(--lavender-wash, #f0f4fe);
  font-weight: 600;
}

/* Tab Content Panel */
.ep-tab-panel {
  display: none;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-relate-card);
  animation: whale-fade-in 0.2s ease;
}

.ep-tab-panel.active {
  display: block;
}

.ep-tab-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--midnight-ink, #020520);
  margin: 0 0 16px;
  border-bottom: 1px solid var(--stone-divider, #e2e8f0);
  padding-bottom: 8px;
}

.ep-field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.ep-field-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--fog-surface, #f8fafc);
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 10px;
  padding: 10px 14px;
}

.ep-field-label {
  font-size: 11px;
  color: var(--ash-helper, #6b7280);
  font-weight: 500;
}

.ep-field-value {
  font-size: 13px;
  color: var(--midnight-ink, #020520);
  font-weight: 600;
}

.ep-field-value.english-val {
  font-family: var(--font-metrics, 'Inter', sans-serif);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: right;
}

/* Empty State */
.em-empty {
  padding: 48px 20px;
  text-align: center;
  max-width: 420px;
  margin: 40px auto;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 16px;
  box-shadow: var(--shadow-relate-card);
}

.em-empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.em-empty h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--midnight-ink, #020520);
  margin: 0 0 6px 0;
}

.em-empty p {
  font-size: 12px;
  color: var(--ash-helper, #6b7280);
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .em-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .em-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .em-field-grid {
    grid-template-columns: 1fr;
  }
  .ep-header-top {
    flex-direction: column;
    align-items: flex-start;
  }
}
