﻿/* â€” Recommendation Engine UX Refactor */

.recommendation-section {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line, #d9dec3);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 16px 44px rgba(44,52,24,.08);
  margin-bottom: 24px;
}

.recommendation-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.recommendation-updating .recommendation-shell {
  opacity: .72;
  transition: opacity .18s ease;
}

.recommendation-update-pill {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  border: 1px solid #d8dfb7;
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: #596600;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(44,52,24,.08);
}

.recommendation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.recommendation-header h2 {
  margin: 0;
  font-size: 28px;
  color: #121827;
  letter-spacing: -.02em;
}

.recommendation-data-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fffaf0;
  border: 1px solid #f1dfb5;
  color: #7a4a00;
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.recommendation-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px;
}

.recommendation-kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line, #d9dec3);
  border-radius: 22px;
  padding: 18px;
}

.recommendation-kpi-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #eef1d2;
  font-size: 24px;
  flex: 0 0 auto;
}

.recommendation-kpi-card span {
  display: block;
  color: #1f2937;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 4px;
}

.recommendation-kpi-card strong {
  display: block;
  color: #121827;
  font-size: 24px;
  line-height: 1.1;
}

.recommendation-kpi-card small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #667085;
}

.recommendation-kpi-card small.down { color: #d92d20; }
.recommendation-kpi-card small.up { color: #039855; }

.recommendation-entities-card {
  background: #fff;
  border: 1px solid var(--line, #d9dec3);
  border-radius: 24px;
  padding: 18px;
}

.recommendation-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.recommendation-card-head h3 {
  margin: 0;
  color: #121827;
  font-size: 22px;
}

.recommendation-card-head p {
  margin: 5px 0 0;
  color: #667085;
  font-size: 13px;
}

.recommendation-filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.recommendation-filter-row button {
  border: 1px solid var(--line, #d9dec3);
  background: #fff;
  color: #596600;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: none;
}

.recommendation-filter-row button.active {
  background: #eef1d2;
  border-color: #cdd7a0;
  box-shadow: inset 0 0 0 1px rgba(167,191,0,.18);
}

.recommendation-entities-list {
  display: grid;
  gap: 10px;
}

.recommendation-entity {
  border: 1px solid #e6ead3;
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.recommendation-entity.critical {
  border-color: #ffc7c2;
  box-shadow: inset 4px 0 0 #f04438;
}

.recommendation-entity.important {
  border-color: #f1dfb5;
  box-shadow: inset 4px 0 0 #f79009;
}

.recommendation-entity.opportunity {
  border-color: #cde6c6;
  box-shadow: inset 4px 0 0 #12b76a;
}

.recommendation-entity summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.recommendation-entity summary::-webkit-details-marker {
  display: none;
}

.recommendation-entity-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.recommendation-entity-left strong {
  color: #121827;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recommendation-entity-left em {
  color: #667085;
  font-style: normal;
  background: #f2f4f0;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  flex: 0 0 auto;
}

.recommendation-severity {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.recommendation-severity.critical {
  background: #ffe2df;
  color: #b42318;
}

.recommendation-severity.important {
  background: #fff1c2;
  color: #b54708;
}

.recommendation-severity.opportunity {
  background: #e5f5df;
  color: #2e7d32;
}

.recommendation-entity-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: auto;
  justify-content: flex-end;
  text-align: right;
}

.recommendation-entity-right span {
  color: #b42318;
  background: #ffe2df;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
}

.recommendation-entity-right b {
  color: #475467;
  font-size: 16px;
}

.recommendation-entity[open] .recommendation-entity-right b {
  transform: rotate(180deg);
}

.recommendation-entity-body {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 14px;
  padding: 0 16px 16px;
}

.recommendation-problems {
  border: 1px solid #eef1d2;
  border-radius: 16px;
  background: #fbfcf3;
  padding: 14px;
}

.recommendation-problems h4 {
  margin: 0 0 12px;
  color: #121827;
  font-size: 14px;
}

.recommendation-problem {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(217,222,195,.65);
}

.recommendation-problem:last-child {
  border-bottom: none;
}

.recommendation-problem i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #f04438;
  margin-top: 6px;
}

.recommendation-problem strong {
  display: block;
  color: #121827;
  font-size: 13px;
  margin-bottom: 3px;
}

.recommendation-problem small {
  color: #667085;
  font-size: 12px;
  line-height: 1.4;
}

.recommendation-empty {
  color: #667085;
  font-size: 13px;
  padding: 14px;
  text-align: center;
}

.recommendation-loading,
.recommendation-empty-state {
  min-height: 160px;
  border: 1px dashed var(--line, #d9dec3);
  background: #fbfcf3;
  border-radius: 22px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 22px;
  color: #667085;
  font-size: 13px;
}

.recommendation-skeleton {
  width: 80%;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg,#eef1d2 25%,#f8faef 37%,#eef1d2 63%);
  background-size: 400% 100%;
  animation: recommendationShimmer 1.4s ease infinite;
}

.recommendation-skeleton.short {
  width: 48%;
  margin-top: 10px;
}

@keyframes recommendationShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media(max-width: 1200px) {
  .recommendation-kpis {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }

  .recommendation-entity-body {
    grid-template-columns: 1fr;
  }
}

@media(max-width: 760px) {
  .recommendation-section {
    padding: 16px;
  }

  .recommendation-header {
    flex-direction: column;
    align-items: stretch;
  }

  .recommendation-kpis {
    grid-template-columns: 1fr;
  }

  .recommendation-entity summary,
  .recommendation-entity-left,
  .recommendation-entity-right {
    align-items: flex-start;
  }

  .recommendation-entity summary {
    flex-direction: column;
  }

  .recommendation-entity-left {
    flex-wrap: wrap;
  }

}

/* Recommendation Engine layout */
.recommendation-section,
#recommendationsPanelMount {
  width: 100% !important;
  max-width: none !important;
  display: block !important;
  grid-column: 1 / -1 !important;
  box-sizing: border-box !important;
}

#recommendationEngine {
  width: 100% !important;
  max-width: none !important;
  display: block !important;
}

.recommendation-data-note.compact {
  background: #fbfcf3;
  border-color: #d9dec3;
  color: #596600;
  font-weight: 800;
}

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

.recommendation-report-btn {
  background: #ff563f !important;
  color: #fff !important;
  border: 1px solid rgba(255,86,63,.2) !important;
  border-radius: 16px !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  font-weight: 950 !important;
  box-shadow: 0 10px 24px rgba(255,86,63,.18);
}

.recommendation-header h2 {
  font-size: 30px;
}

.recommendation-kpi-card small.good {
  color: #039855 !important;
}

.recommendation-kpi-card small.bad {
  color: #d92d20 !important;
}
