/**
 * =====================================================
 * مطاعم أبوزيد — Jisr HR Integration Styles
 * jisr.css  v1.0
 * Independent styles — do NOT affect any other section
 * =====================================================
 */

/* ── Page wrapper ──────────────────────────────────── */
#page-jisr {
  /* inherits .page base from style.css */
}

#jisr-root {
  padding: 0 0 40px;
  min-height: 400px;
}

/* ── Loading state ─────────────────────────────────── */
.jisr-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 80px 20px;
  color: #7a90a8;
}

.jisr-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(24,175,200,0.2);
  border-top-color: #18AFC8;
  border-radius: 50%;
  animation: jisr-spin 0.9s linear infinite;
}

@keyframes jisr-spin { to { transform: rotate(360deg); } }

/* ── Error state ───────────────────────────────────── */
.jisr-error-state {
  max-width: 560px;
  margin: 60px auto;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 16px;
  padding: 36px;
  text-align: center;
  color: #e2e8f0;
}

.jisr-error-state > i {
  font-size: 2.5rem;
  color: #ef4444;
  display: block;
  margin-bottom: 12px;
}

.jisr-error-state h3 {
  font-size: 1.25rem;
  color: #f87171;
  margin-bottom: 10px;
}

.jisr-error-state p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.jisr-error-tips {
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 14px 18px;
  text-align: right;
  margin-bottom: 20px;
  color: #94a3b8;
  font-size: 0.85rem;
}
.jisr-error-tips ul {
  margin: 6px 0 0 0;
  padding-right: 20px;
  list-style: disc;
}
.jisr-error-tips li { margin-bottom: 4px; }

/* ── Credentials form ──────────────────────────────── */
.jisr-credentials-form {
  max-width: 520px;
  margin: 40px auto;
  background: linear-gradient(135deg, rgba(14,125,146,0.12), rgba(6,182,212,0.06));
  border: 1px solid rgba(24,175,200,0.2);
  border-radius: 20px;
  overflow: hidden;
}

.jisr-cred-header {
  background: linear-gradient(135deg, #083d4a, #0E7D92);
  padding: 28px 32px;
  text-align: center;
}

.jisr-cred-header h2 {
  font-size: 1.3rem;
  color: #e2e8f0;
  margin: 12px 0 8px;
}

.jisr-cred-header p {
  color: rgba(255,255,255,0.65);
  font-size: 0.88rem;
}

.jisr-cred-body {
  padding: 28px 32px;
}

.jisr-field-group {
  margin-bottom: 20px;
}

.jisr-field-group label {
  display: block;
  font-size: 0.83rem;
  color: #94a3b8;
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.jisr-required { color: #f87171; margin-right: 2px; }

.jisr-field-hint {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 4px;
}

.jisr-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 14px;
  color: #e2e8f0;
  font-size: 0.92rem;
  font-family: inherit;
  direction: ltr;
  transition: border-color 0.2s;
}
.jisr-input:focus {
  outline: none;
  border-color: #18AFC8;
  box-shadow: 0 0 0 3px rgba(24,175,200,0.15);
}
.jisr-input-readonly {
  opacity: 0.55;
  cursor: not-allowed;
}

.jisr-security-note {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 22px;
  color: #86efac;
  font-size: 0.82rem;
}
.jisr-security-note i { color: #22c55e; font-size: 1rem; flex-shrink: 0; }

.jisr-cred-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Buttons ───────────────────────────────────────── */
.jisr-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-weight: 600;
}

.jisr-btn-primary {
  background: linear-gradient(135deg, #0E7D92, #18AFC8);
  color: #fff;
}
.jisr-btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

.jisr-btn-secondary {
  background: rgba(255,255,255,0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.12);
}
.jisr-btn-secondary:hover { background: rgba(255,255,255,0.13); }

.jisr-btn-outline {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,0.12);
}
.jisr-btn-outline:hover { border-color: #18AFC8; color: #18AFC8; }

.jisr-btn-sm {
  padding: 7px 14px;
  font-size: 0.82rem;
  border-radius: 8px;
  border: none;
  background: rgba(24,175,200,0.15);
  color: #18AFC8;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.jisr-btn-sm:hover { background: rgba(24,175,200,0.25); }
.jisr-btn-sm.jisr-btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: #94a3b8;
}
.jisr-btn-sm.jisr-btn-primary {
  background: linear-gradient(135deg,#0E7D92,#18AFC8);
  color: #fff;
}

/* ── Brand badge ───────────────────────────────────── */
.jisr-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(24,175,200,0.18);
  border: 1px solid rgba(24,175,200,0.3);
  color: #18AFC8;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.jisr-brand-badge.lg {
  padding: 8px 20px;
  font-size: 1rem;
}

/* ── Page header ───────────────────────────────────── */
.jisr-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #083d4a 0%, #0E7D92 60%, #18AFC8 100%);
  padding: 28px 32px;
  border-radius: 0 0 20px 20px;
  margin-bottom: 24px;
}

.jisr-header-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.jisr-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
}

.jisr-page-sub {
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
  margin: 0;
}

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

.jisr-sync-info {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Filters bar ───────────────────────────────────── */
.jisr-filters-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 16px 20px;
  margin: 0 20px 24px;
}

.jisr-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 130px;
}

.jisr-filter-group label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.jisr-input-sm {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 6px 10px;
  color: #e2e8f0;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s;
  direction: rtl;
}
.jisr-input-sm:focus {
  outline: none;
  border-color: #18AFC8;
}

/* ── KPI Cards grid ────────────────────────────────── */
.jisr-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  padding: 0 20px;
  margin-bottom: 20px;
}

.jisr-kpi-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 18px 16px 14px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.jisr-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
}
.jisr-kpi-card.kpi-status-green::before { background: #22c55e; }
.jisr-kpi-card.kpi-status-yellow::before { background: #f59e0b; }
.jisr-kpi-card.kpi-status-red::before { background: #ef4444; }
.jisr-kpi-card.kpi-status-neutral::before { background: #475569; }

.jisr-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.jisr-kpi-icon { font-size: 1.6rem; margin-bottom: 8px; }

.jisr-kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #e2e8f0;
  line-height: 1;
  margin-bottom: 6px;
}
.jisr-kpi-unit {
  font-size: 0.9rem;
  font-weight: 400;
  color: #94a3b8;
  margin-right: 2px;
}

.jisr-kpi-label {
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 6px;
}

.jisr-kpi-hint {
  font-size: 0.72rem;
  color: #475569;
  line-height: 1.4;
}

/* ── Detail grid ───────────────────────────────────── */
.jisr-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 0 20px;
  margin-bottom: 20px;
}

/* ── Panel ─────────────────────────────────────────── */
.jisr-panel {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  overflow: hidden;
}
.jisr-panel-wide {
  margin: 0 20px 20px;
}

.jisr-panel-header {
  background: rgba(255,255,255,0.06);
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.jisr-panel-header i { color: #18AFC8; }

.jisr-panel-body {
  padding: 14px 16px;
}

.jisr-empty-msg {
  color: #475569;
  font-size: 0.85rem;
  text-align: center;
  padding: 12px 0;
}

/* ── Status pills ──────────────────────────────────── */
.jisr-status-pills-wrap,
.jisr-gender-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.jisr-status-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.1);
}
.jisr-status-pill.jisr-status-active { background: rgba(34,197,94,0.15); color: #86efac; border-color: rgba(34,197,94,0.25); }
.jisr-status-pill.jisr-status-resigned { background: rgba(239,68,68,0.12); color: #fca5a5; border-color: rgba(239,68,68,0.2); }
.jisr-status-pill.jisr-status-terminated { background: rgba(239,68,68,0.18); color: #f87171; border-color: rgba(239,68,68,0.3); }
.jisr-status-pill.jisr-status-on_leave,
.jisr-status-pill.jisr-status-on-leave { background: rgba(245,158,11,0.12); color: #fcd34d; border-color: rgba(245,158,11,0.2); }
.jisr-status-pill.jisr-status-suspended { background: rgba(99,102,241,0.12); color: #a5b4fc; border-color: rgba(99,102,241,0.2); }

.jisr-gender-pill {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(24,175,200,0.12);
  color: #67e8f9;
  border: 1px solid rgba(24,175,200,0.2);
}

/* ── Dept bar chart ────────────────────────────────── */
.jisr-dept-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.jisr-dept-name {
  min-width: 120px;
  font-size: 0.82rem;
  color: #94a3b8;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jisr-dept-bar-wrap {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 5px;
  overflow: hidden;
}

.jisr-dept-bar {
  height: 100%;
  background: linear-gradient(90deg, #0E7D92, #18AFC8);
  border-radius: 5px;
  transition: width 0.5s ease;
  min-width: 4px;
}

.jisr-dept-count {
  min-width: 32px;
  font-size: 0.82rem;
  color: #e2e8f0;
  font-weight: 700;
  text-align: left;
}

/* ── Expiry rows ───────────────────────────────────── */
.jisr-expiry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.82rem;
}
.jisr-expiry-row:last-child { border-bottom: none; }
.jisr-expiry-row i { color: #f59e0b; flex-shrink: 0; }
.jisr-expiry-row span:first-of-type { flex: 1; color: #cbd5e1; }
.jisr-expiry-date { color: #f87171; font-weight: 600; direction: ltr; }

/* ── Leave rows ────────────────────────────────────── */
.jisr-leave-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 0.85rem;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.jisr-leave-row:last-child { border-bottom: none; }
.jisr-leave-row strong { color: #e2e8f0; }

/* ── Data note ─────────────────────────────────────── */
.jisr-data-note {
  margin: 0 20px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  font-size: 0.78rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.jisr-data-note i { color: #18AFC8; }

.jisr-mock-badge {
  background: rgba(245,158,11,0.15);
  color: #fcd34d;
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 10px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ── Mobile responsive ─────────────────────────────── */
@media (max-width: 768px) {
  .jisr-page-header {
    padding: 20px 16px;
    border-radius: 0 0 14px 14px;
  }
  .jisr-page-title { font-size: 1.15rem; }
  .jisr-filters-bar { margin: 0 12px 18px; padding: 12px; gap: 10px; }
  .jisr-filter-group { min-width: calc(50% - 5px); }
  .jisr-kpi-grid { padding: 0 12px; grid-template-columns: repeat(2, 1fr); }
  .jisr-kpi-value { font-size: 1.4rem; }
  .jisr-detail-grid { padding: 0 12px; grid-template-columns: 1fr; }
  .jisr-panel-wide { margin: 0 12px 16px; }
  .jisr-data-note { margin: 0 12px; }
  .jisr-credentials-form { margin: 20px 12px; }
  .jisr-cred-header, .jisr-cred-body { padding: 20px 18px; }
  .jisr-cred-actions { flex-direction: column; }
  .jisr-cred-actions .jisr-btn { width: 100%; justify-content: center; }
  .jisr-dept-name { min-width: 90px; font-size: 0.78rem; }
}

@media (max-width: 480px) {
  .jisr-kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .jisr-kpi-value { font-size: 1.25rem; }
  .jisr-kpi-icon { font-size: 1.3rem; }
}
