/* E&A Engineer KPIs Stylesheet - Glassmorphism Theme */

.kpi-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  animation: fadeIn 0.4s ease-out;
}

/* KPI Summary Cards */
.kpi-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.kpi-stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.12);
}

.kpi-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon-wrapper.primary {
  background: rgba(37, 99, 235, 0.15);
  color: var(--primary);
}

.kpi-icon-wrapper.success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.kpi-icon-wrapper.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.kpi-icon-wrapper.info {
  background: rgba(6, 182, 212, 0.15);
  color: var(--info);
}

.kpi-stat-info {
  display: flex;
  flex-direction: column;
}

.kpi-stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

/* Dashboard Analytics & Chart */
.kpi-dashboard-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.kpi-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.kpi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.kpi-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* KPI Trend Graph Simulation */
.kpi-chart-container {
  width: 100%;
  height: 220px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: 20px;
  box-sizing: border-box;
}

.kpi-chart-gridlines {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  bottom: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.kpi-chart-gridline {
  border-bottom: 1px dashed rgba(0, 0, 0, 0.05);
  width: 100%;
  position: relative;
}

.kpi-chart-gridline::after {
  content: attr(data-value);
  position: absolute;
  right: 0;
  top: -12px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-chart-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  z-index: 2;
}

.kpi-chart-bar-wrapper {
  width: 32px;
  height: 150px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  position: relative;
}

.kpi-chart-bar-fill {
  width: 100%;
  background: linear-gradient(to top, var(--primary), #3b82f6);
  border-radius: 4px;
  transition: height 1s ease-out;
  cursor: pointer;
}

.kpi-chart-bar-fill:hover {
  background: var(--primary-hover);
}

.kpi-chart-bar-fill::after {
  content: attr(data-score);
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.kpi-chart-bar-fill:hover::after {
  opacity: 1;
}

.kpi-chart-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Grading Info List */
.kpi-grade-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.02);
  margin-bottom: 8px;
  border: 1px solid rgba(0,0,0,0.03);
}

.kpi-grade-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.kpi-grade-badge.a { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.kpi-grade-badge.b { background: rgba(37, 99, 235, 0.12); color: var(--primary); }
.kpi-grade-badge.c { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.kpi-grade-badge.d { background: rgba(239, 68, 68, 0.12); color: var(--danger); }

/* Master Table Section */
.kpi-table-controls {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 16px;
}

.kpi-search-input {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  width: 250px;
  box-sizing: border-box;
  color: var(--text-main);
}

.kpi-filter-select {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
}

.kpi-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.kpi-table th {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.kpi-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}

.kpi-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.kpi-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

.kpi-score-badge {
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
}

.kpi-score-badge.high { color: var(--success); }
.kpi-score-badge.mid { color: var(--primary); }
.kpi-score-badge.low { color: var(--warning); }

/* Slide-out Scorecard Drawer */
.kpi-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.kpi-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.kpi-drawer {
  position: fixed;
  top: 0;
  right: -550px;
  width: 520px;
  height: 100vh;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1000;
  box-shadow: -10px 0 40px rgba(15, 23, 42, 0.15);
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 24px;
  box-sizing: border-box;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.kpi-drawer.active {
  right: 0;
}

.kpi-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 16px;
}

.kpi-drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.kpi-drawer-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

.kpi-drawer-profile {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.05);
  border: 1px solid rgba(37, 99, 235, 0.08);
}

.kpi-profile-avatar {
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
}

.kpi-profile-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.kpi-profile-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Category Block inside Drawer */
.kpi-drawer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kpi-drawer-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-left: 3px solid var(--primary);
  padding-left: 8px;
}

.kpi-item-row {
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.01);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.kpi-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.kpi-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.kpi-item-weight {
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  white-space: nowrap;
}

.kpi-item-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.kpi-item-target {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--success);
}

/* Form and Interactive Inputs */
.kpi-input-field {
  background: var(--glass-bg);
  color: var(--text-main);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kpi-input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Sub-tabs interactive hover effects */
.kpi-tab-btn {
  transition: all 0.2s ease;
}

.kpi-tab-btn:hover:not(.active) {
  color: var(--text-main) !important;
  background: rgba(0, 0, 0, 0.02) !important;
}

