/* =========================================================
   KiwiAI — Single Diagnosis Renderer v11
   ========================================================= */

#kiwiModelRootV11 {
  margin: 0 0 18px;
}

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

.kiwi-v11-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: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

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

.kiwi-v11-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);
}

#kiwiV11Detectable {
  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-v11-detectable-title {
  margin-bottom: 6px;
  color: #155f46;
  font-size: .93rem;
  font-weight: 900;
}

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

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

.kiwi-v11-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-v11-card {
  height: 565px !important;
  min-height: 565px !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-v11-card > .row {
  height: 100% !important;
  min-height: 0 !important;
  align-items: stretch !important;
}

.kiwi-v11-card .col-md-5,
.kiwi-v11-card .col-md-7 {
  height: 100% !important;
  min-height: 0 !important;
}

.kiwi-v11-card .col-md-7 {
  overflow: hidden !important;
}

#kiwiPreviewFrameV11 {
  position: relative;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  isolation: isolate;
  border: 1px solid rgba(13, 105, 73, .14) !important;
  border-radius: 22px !important;
  background:
    radial-gradient(circle at 20% 15%, rgba(67, 185, 126, .16), transparent 35%),
    linear-gradient(145deg, #e9f6ef, #f9fdf9) !important;
}

#kiwiPreviewFrameV11::before {
  content: "";
  position: absolute;
  inset: -25px;
  z-index: -1;
  background-image: var(--kiwi-v11-preview-bg, none);
  background-size: cover;
  background-position: center;
  filter: blur(24px);
  opacity: .32;
  transform: scale(1.15);
}

#preview-img:not(.d-none) {
  position: relative !important;
  z-index: 2;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  padding: 10px !important;
  object-fit: contain !important;
  object-position: center !important;
  border-radius: 19px !important;
  background: transparent !important;
}

#preview-placeholder {
  position: relative;
  z-index: 2;
  height: 100%;
  min-height: 100%;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px;
  color: #52796b !important;
  font-weight: 750;
  line-height: 1.9;
}

#preview-placeholder::before {
  content: "⌁";
  display: block;
  width: 60px;
  height: 60px;
  margin-bottom: 13px;
  border-radius: 19px;
  background: #fff;
  color: #18724f;
  font-size: 2.5rem;
  line-height: 56px;
  box-shadow: 0 11px 25px rgba(14, 96, 67, .10);
}

#result-main {
  flex: 0 0 auto !important;
  margin-bottom: 9px !important;
}

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

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

.kiwi-v11-model-badge {
  display: inline-flex;
  margin-bottom: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dff3e8;
  color: #126143;
  font-size: .74rem;
  font-weight: 900;
}

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

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

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

.kiwi-v11-switcher {
  display: flex;
  gap: 7px;
  margin-top: 11px;
}

.kiwi-v11-switch {
  appearance: none;
  flex: 1 1 50%;
  min-height: 37px;
  padding: 7px 8px;
  border: 1px solid rgba(15, 108, 75, .15);
  border-radius: 11px;
  background: #fff;
  color: #28614d;
  font: inherit;
  font-size: .79rem;
  font-weight: 850;
  cursor: pointer;
}

.kiwi-v11-switch.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #0b694b, #27a876);
}

/* فقط محتوای این دو تب اسکرول می‌خورد */
.kiwi-v11-workspace {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(15, 108, 75, .11);
  border-radius: 17px;
  background: #fff;
}

.kiwi-v11-panel {
  height: 100%;
  min-height: 0;
}

.kiwi-v11-panel[hidden] {
  display: none !important;
}

.kiwi-v11-scroll {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 11px;
  scrollbar-width: thin;
  scrollbar-color: #72cba0 #edf6f0;
}

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

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

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

/* نوارهای احتمال */
.kiwi-v11-prob-row {
  margin-bottom: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(17, 108, 75, .10);
  border-radius: 12px;
  background: #fbfefc;
}

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

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

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

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

/* توضیحات بزرگ و خوانا */
.kiwi-v11-guide-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  color: #176549;
  font-size: .94rem;
  font-weight: 950;
}

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

.kiwi-v11-guide-copy,
.kiwi-v11-guide-copy p,
.kiwi-v11-guide-copy li {
  color: #375f51;
  line-height: 2.05;
  font-size: .91rem;
}

.kiwi-v11-guide-copy {
  margin-bottom: 22px;
}

.kiwi-v11-references {
  direction: ltr;
  text-align: left;
}

/* توضیحات قدیمی دیگر وارد کارت نمی‌شوند */
body.kiwi-v11-active #kiwiDiseaseDetailsV7 {
  display: none !important;
}

@media (max-width: 991.98px) {
  .kiwi-v11-card {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #kiwiPreviewFrameV11 {
    height: 390px !important;
    min-height: 390px !important;
  }

  .kiwi-v11-card .col-md-7 {
    height: 570px !important;
    min-height: 570px !important;
    margin-top: 14px;
  }
}

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

  #kiwiPreviewFrameV11 {
    height: 330px !important;
    min-height: 330px !important;
  }

  .kiwi-v11-card .col-md-7 {
    height: 540px !important;
    min-height: 540px !important;
  }

  .kiwi-v11-detectable-chip {
    white-space: normal;
    text-align: center;
  }
}
