/* =========================================================
   KiwiAI — Unified Diagnosis UI v16
   ========================================================= */

/* ---------- انتخاب مدل ---------- */
#kiwiModelRootV16 {
  margin: 0 0 18px;
}

.kiwi-v16-model-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 12px;
}

.kiwi-v16-model-tab {
  appearance: none;
  min-height: 43px;
  padding: 9px 15px;
  border: 1px solid rgba(14, 105, 74, .18);
  border-radius: 14px;
  background: #fff;
  color: #125d44;
  font: inherit;
  font-weight: 850;
  line-height: 1.35;
  cursor: pointer;
  box-shadow: 0 7px 16px rgba(12, 77, 56, .05);
  transition: .18s ease;
}

.kiwi-v16-model-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 22px rgba(12, 77, 56, .10);
}

.kiwi-v16-model-tab.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #0a6849, #2db07d);
  box-shadow: 0 12px 25px rgba(13, 108, 73, .18);
}

/* ---------- کلاس‌های مدل ---------- */
#kiwiV16Detectable {
  padding: 14px 15px;
  border: 1px solid rgba(17, 118, 80, .15);
  border-radius: 18px;
  background: linear-gradient(180deg, #f9fdf9, #edf8f2);
  box-shadow: 0 10px 24px rgba(12, 84, 59, .05);
}

.kiwi-v16-detectable-title {
  margin-bottom: 6px;
  color: #155f46;
  font-size: .93rem;
  font-weight: 900;
}

.kiwi-v16-detectable-sub {
  margin-bottom: 10px;
  color: #55766a;
  font-size: .84rem;
  line-height: 1.85;
}

.kiwi-v16-detectable-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kiwi-v16-detectable-chip {
  display: inline-flex;
  align-items: center;
  min-height: 33px;
  padding: 7px 12px;
  border: 1px solid rgba(16, 108, 75, .14);
  border-radius: 999px;
  background: #fff;
  color: #17664a;
  font-size: .81rem;
  font-weight: 800;
}

/* ---------- کارت نتیجه ---------- */
.kiwi-v16-result-card {
  height: 650px !important;
  min-height: 650px !important;
  overflow: hidden !important;
  border: 1px solid rgba(17, 108, 75, .12) !important;
  border-radius: 25px !important;
  background: linear-gradient(180deg, #fff, #f4fbf7) !important;
  box-shadow: 0 16px 36px rgba(13, 81, 58, .08) !important;
}

.kiwi-v16-result-card > .row {
  height: 100% !important;
  min-height: 0 !important;
  align-items: stretch !important;
}

.kiwi-v16-preview-col {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}

.kiwi-v16-result-side {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

/* ---------- پیش‌نمایش: فقط عکس ---------- */
#kiwiPreviewFrameV16 {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 18px !important;
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
}

#kiwiPreviewFrameV16 #preview-img:not(.d-none) {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: transparent !important;
  box-shadow: none !important;
}

#kiwiPreviewFrameV16 #preview-placeholder {
  display: none !important;
}

/* ---------- نتیجه و توضیحات ---------- */
#result-main {
  flex: 0 0 auto !important;
  margin-bottom: 10px !important;
}

#result-probs {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.kiwi-v16-summary {
  padding: 14px 15px;
  border: 1px solid rgba(14, 109, 76, .13);
  border-radius: 18px;
  background: linear-gradient(135deg, #f1fbf5, #fff);
}

.kiwi-v16-model-badge {
  display: inline-flex;
  margin-bottom: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #dff3e8;
  color: #126143;
  font-size: .75rem;
  font-weight: 900;
}

.kiwi-v16-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kiwi-v16-prediction-name {
  color: #145e44;
  font-size: 1.08rem;
  font-weight: 950;
}

.kiwi-v16-confidence {
  color: #0d714d;
  font-size: 1.02rem;
  font-weight: 950;
}

/* ---------- پنل توضیحات ---------- */
.kiwi-v16-details-card {
  flex: 0 0 225px;
  min-height: 225px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid rgba(15, 108, 75, .11);
  border-radius: 17px;
  background: #fff;
}

.kiwi-v16-details-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(16, 104, 74, .10);
  background: linear-gradient(135deg, #f2fbf6, #ffffff);
}

.kiwi-v16-details-title {
  color: #165f46;
  font-size: .93rem;
  font-weight: 950;
}

.kiwi-v16-details-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 14px;
  scrollbar-width: thin;
  scrollbar-color: #72cba0 #edf6f0;
}

.kiwi-v16-details-scroll::-webkit-scrollbar {
  width: 7px;
}

.kiwi-v16-details-scroll::-webkit-scrollbar-track {
  background: #edf6f0;
  border-radius: 999px;
}

.kiwi-v16-details-scroll::-webkit-scrollbar-thumb {
  background: #72cba0;
  border-radius: 999px;
}

.kiwi-v16-section {
  margin-bottom: 18px;
  direction: rtl;
  text-align: right;
}

.kiwi-v16-section:last-child {
  margin-bottom: 0;
}

.kiwi-v16-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: #176549;
  font-size: .91rem;
  font-weight: 950;
}

.kiwi-v16-section-title::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #2cab78;
}

.kiwi-v16-section-copy,
.kiwi-v16-section-copy p,
.kiwi-v16-section-copy li {
  direction: rtl;
  text-align: justify;
  text-justify: inter-word;
  color: #365e50;
  font-size: .91rem;
  line-height: 2.05;
}

.kiwi-v16-section-copy p {
  margin-bottom: 10px;
}

.kiwi-v16-section.is-en,
.kiwi-v16-section.is-en .kiwi-v16-section-copy,
.kiwi-v16-section.is-en .kiwi-v16-section-copy p,
.kiwi-v16-section.is-en .kiwi-v16-section-copy li {
  direction: ltr;
  text-align: left;
}

.kiwi-v16-section.references,
.kiwi-v16-section.references .kiwi-v16-section-copy,
.kiwi-v16-section.references .kiwi-v16-section-copy p,
.kiwi-v16-section.references .kiwi-v16-section-copy li {
  direction: ltr;
  text-align: left;
}

/* ---------- احتمال تمام کلاس‌ها ---------- */
.kiwi-v16-prob-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.kiwi-v16-prob-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  padding: 0 2px;
}

.kiwi-v16-prob-title {
  color: #165f46;
  font-size: .94rem;
  font-weight: 950;
}

.kiwi-v16-prob-count {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 11px;
  border-radius: 999px;
  background: #eaf6ef;
  color: #166145;
  font-size: .81rem;
  font-weight: 900;
}

.kiwi-v16-prob-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 11px;
  border: 1px solid rgba(15, 108, 75, .11);
  border-radius: 17px;
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: #72cba0 #edf6f0;
}

.kiwi-v16-prob-scroll::-webkit-scrollbar {
  width: 7px;
}

.kiwi-v16-prob-scroll::-webkit-scrollbar-track {
  background: #edf6f0;
  border-radius: 999px;
}

.kiwi-v16-prob-scroll::-webkit-scrollbar-thumb {
  background: #72cba0;
  border-radius: 999px;
}

.kiwi-v16-prob-row {
  margin-bottom: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(17, 108, 75, .10);
  border-radius: 12px;
  background: #fbfefc;
}

.kiwi-v16-prob-row.is-top {
  border-color: rgba(29, 159, 103, .30);
  background: linear-gradient(135deg, #eefaf3, #fff);
}

.kiwi-v16-prob-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-bottom: 6px;
  color: #2d5e4e;
  font-size: .81rem;
  font-weight: 850;
}

.kiwi-v16-prob-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8f1ec;
}

.kiwi-v16-prob-fill {
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, #3bbf84, #0b7550);
}

/* ---------- حذف کامل بخش قدیمی پایین ---------- */
body.kiwi-v16-ready #disease-info,
body.kiwi-v16-ready #disease-info *,
body.kiwi-v16-ready .kiwi-v16-legacy-hidden {
  display: none !important;
}

/* ---------- موبایل ---------- */
@media (max-width: 991.98px) {
  .kiwi-v16-result-card {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #kiwiPreviewFrameV16 {
    height: 350px !important;
    min-height: 350px !important;
  }

  .kiwi-v16-result-side {
    height: 650px !important;
    min-height: 650px !important;
    margin-top: 14px;
  }

  .kiwi-v16-details-card {
    flex-basis: 250px;
    min-height: 250px;
  }
}

@media (max-width: 767.98px) {
  .kiwi-v16-model-tab {
    width: 100%;
  }

  #kiwiPreviewFrameV16 {
    height: 300px !important;
    min-height: 300px !important;
  }

  .kiwi-v16-result-side {
    height: 660px !important;
    min-height: 660px !important;
  }

  .kiwi-v16-details-card {
    flex-basis: 270px;
    min-height: 270px;
  }

  .kiwi-v16-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
