/* Loading Spinner Styles */
.loading-spinner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
  opacity: 1;
  visibility: visible;
}

.loading-spinner.hide {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #0d6efd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

[data-bs-theme="dark"] .loading-spinner {
  background: rgba(33, 37, 41, 0.95);
}

[data-bs-theme="dark"] .loading-spinner p {
  color: #ccc !important;
}
/* ========================================
   RPJMD ORGANIZATIONAL CHART - PROFESSIONAL STYLING
   ======================================== */

.k-orgchart {
  display: flex;
  justify-content: center;
  padding: 30px 15px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 12px;
  min-height: 600px;
}

.rpjmd-org-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 16px;
  min-width: 280px;
  border-left: 5px solid #3b82f6;
  overflow: hidden;
  position: relative;
}

.rpjmd-org-card:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
}

/* Level-specific border colors */
.rpjmd-org-card.level-1 {
  border-left-color: #3b82f6;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
  min-width: 320px;
}

.rpjmd-org-card.level-2 {
  border-left-color: #f59e0b;
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
  min-width: 300px;
}

.rpjmd-org-card.level-3 {
  border-left-color: #10b981;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  min-width: 290px;
}

.rpjmd-org-card.level-4 {
  border-left-color: #8b5cf6;
  background: linear-gradient(135deg, #ffffff 0%, #faf5ff 100%);
  min-width: 280px;
}

.rpjmd-org-card.level-5 {
  border-left-color: #06b6d4;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
  min-width: 270px;
  font-size: 13px;
}

/* Card Header */
.org-card-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

/* Avatar Styling */
.org-avatar {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.avatar-letter {
  font-size: 18px;
  line-height: 1;
}

.avatar-position {
  font-size: 9px;
  margin-top: 2px;
  opacity: 0.85;
  font-weight: 600;
}

.avatar-level-1 {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.avatar-level-2 {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.avatar-level-3 {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.avatar-level-4 {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.avatar-level-5 {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

/* Card Content */
.org-card-content {
  flex: 1;
  min-width: 0;
}

.org-title {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 4px 0;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: normal;
  word-wrap: break-word;
}

.org-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 6px 0;
  font-weight: 500;
}

.org-position-badge {
  display: inline-block;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* KPI Section */
.org-card-kpi {
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
  margin-top: 10px;
  background: rgba(243, 244, 246, 0.4);
  padding: 10px;
  border-radius: 6px;
}

.kpi-header {
  font-size: 11px;
  font-weight: 700;
  color: #1f2937;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.kpi-item {
  font-size: 11px;
  color: #374151;
  padding: 4px 0;
  line-height: 1.4;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.kpi-item:last-child {
  border-bottom: none;
}

/* Kendo Org Chart Connectors */
.k-orgchart .k-connector {
  stroke: #cbd5e1;
  stroke-width: 2;
}

.k-orgchart .k-item {
  margin: 12px 6px !important;
  padding: 0 !important;
}

.k-orgchart .k-group {
  margin-top: 20px;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .rpjmd-org-card {
    min-width: 250px;
    padding: 14px;
    font-size: 13px;
  }

  .org-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

  .avatar-letter {
    font-size: 18px;
  }

  .org-title {
    font-size: 13px;
  }

  .org-subtitle {
    font-size: 11px;
  }
}

@media (max-width: 768px) {
  .k-orgchart {
    padding: 20px 10px;
    min-height: 400px;
  }

  .rpjmd-org-card {
    min-width: 220px;
    padding: 12px;
    font-size: 12px;
  }

  .org-card-header {
    gap: 10px;
  }

  .org-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .avatar-letter {
    font-size: 16px;
  }

  .org-title {
    font-size: 12px;
  }

  .org-subtitle {
    font-size: 10px;
  }

  .org-position-badge {
    padding: 2px 6px;
    font-size: 9px;
  }
}

@media (max-width: 480px) {
  .rpjmd-org-card {
    min-width: 180px;
    padding: 10px;
    font-size: 11px;
  }

  .org-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .avatar-letter {
    font-size: 14px;
  }

  .org-title {
    font-size: 11px;
  }

  .org-subtitle {
    font-size: 9px;
  }

  .kpi-header {
    font-size: 9px;
  }

  .kpi-item {
    font-size: 9px;
  }
}

.product-photo {
  box-shadow: inset 0 0 30px rgba(0,0,0,.3);
  margin: 0 10px 0 0;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-size: 100%;
  background-repeat: no-repeat;
  display: inline-block;
}

.product-name {
  display: inline-block;
  vertical-align: middle;
  line-height: 32px;
  padding-left: 3px;
}

.customer-photo {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-size: 32px 35px;
    background-position: center center;
    vertical-align: middle;
    line-height: 32px;
    box-shadow: inset 0 0 1px #999, inset 0 0 10px rgba(0,0,0,.2);
    margin-left: 5px;
}