/* ── View Results scroll button (mobile only) ── */
#viewResultsBtn {
  display: none;
}

@media (max-width: 1024px) {
  #viewResultsBtn {
    display: flex;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(to right, #198bb186, #1b4fa28a);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(25, 139, 177, 0.45);
    animation: btnPulse 2s ease-in-out infinite;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    width: 100px;
    /* max-width: 420px; */
  }

  #viewResultsBtn.visible {
    opacity: 1;
    pointer-events: auto;
  }

  #viewResultsBtn.hidden {
    opacity: 0;
    pointer-events: none;
  }
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(25, 139, 177, 0.4); }
  50%       { box-shadow: 0 4px 28px rgba(25, 139, 177, 0.7); }
}
@media (max-width: 1200px) {


  


  .msg{
    gap: 0;
  }

.panel.output{
  height: 290px !important;
}

  .chat-started {
    height: 100vh !important;
    .initial-center{
      display: none;
    }
  }

  .wrap {
    max-width: 100%;
    gap: 18px;
    padding: 0 16px;
  }

  .panel.chat {
    height: auto;
    min-height: 600px;
    height: 99vh !important;
  }

  .chat-input-wrapper {
    width: 600px;
  }

  

  #findingsRows {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    padding: 16px;
  }
}

/* ── 1024px: stack the two-column grid ───────────────────── */
@media (max-width: 1024px) {
  body {
    align-items: flex-start;
    padding: 0;
  }

  .result_body {
    max-width: 100%;
    margin: 0;
  }

  .page {
    padding: 8px 0;
  }

  .wrap {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 12px 24px;
    max-height: unset;
  }

  /* Chat panel spans full width */
  .panel.chat {
    grid-column: 1;
    grid-row: 1;
    height: 480px;
    min-height: unset;
  }

  /* Second-box fills full width below */
  .second-box {
    grid-column: 1;
    grid-row: 2;
    height: auto;
  }

  .panel.output {
    grid-column: 1;
    grid-row: auto;
    height: 300px;
  }



  .chat-input-wrapper {
    width: 500px;
    max-width: 90%;
  }
}

/* ── 768px: tablet ───────────────────────────────────────── */
@media (max-width: 768px) {

  
    body {
   display: flex;
   justify-content: center;
   align-items: center;
  }
  /* === Initial screen === */
  .chat_bod {
    width: 95%;
    margin: 16px auto;
  }

  .initial-center {
    width: 92%;
  }

  .chat-input-wrapper {
    width: 100%;
    max-width: 100%;
  }

  .chat-input-wrapper textarea {
    height: 100px;
    font-size: 14px;
    padding: 12px 44px 12px 14px;
  }

  .chat-input-wrapper button {
    width: 36px;
    height: 36px;
    font-size: 13px;
    right: 8px;
    bottom: 12px;
    top: unset;
    transform: none;
  }

  .pills {
    gap: 8px;
    margin-top: 14px;
  }

  .pill {
    font-size: 12px;
    padding: 6px 14px;
  }

  .text {
    font-size: 13px;
    text-align: center;
    padding: 0 8px;
  }

  /* === Chat body === */
  .chat-body {
    padding: 12px;
  }

  .message {
    max-width: 88%;
    gap: 0;
  }

  .bubble {
    font-size: 10px;
  }

  .chat-input input {
    height: 46px;
    font-size: 14px;
  }

  .chat-input button {
    width: 42px;
    height: 42px;
    font-size: 16px;
  }

  /* === Result layout === */
  .wrap {
    padding: 0 8px 20px;
    gap: 12px;
  }

.panel.chat {
  height: 400px;
}

.out-inner {
  height: 360px;
}

.chart-card {
  height: 360px;
}

#radar {
  margin-top: 50px;
  width: 100% !important;
  height: 500px !important;
}

  /* === Findings grid: single column === */
  #findingsRows {
    grid-template-columns:  repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .findings-skeleton {
    grid-template-columns:  repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
  }

  /* === Risk distribution === */
  .risk-header {
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
  }

  .risk-header h3 {
    font-size: 13px;
  }

  .risk-header span {
    font-size: 11px;
    color: #9ca3af;
  }

  .risk-labels {
    gap: 12px;
    font-size: 12px;
    flex-wrap: wrap;
  }

  /* === Inner chat panel === */
  .chat-inner {
    height: 100%;
  }

  .input-bar {
    position: relative;
    width: 100%;
    margin: 0;
    border-radius: 0 0 5px 5px;
  }

  .chat-bubble {
    font-size: 12px;
    max-width: 90%;
  }

  .final-Email {
    max-width: 90%;
    font-size: 11px;
  }

  /* === Finding cards === */
  .finding {
    padding: 10px;
    height: 90%;
  }

  .findings_box {
    font-size: 10px;
  }

  .grade-span-box{
    height: 40%;
  }

  .grade{
    align-items: center;
    justify-content: center;
    box-shadow: 0px 0px 5px 1px rgba(158, 139, 220, 0.502);
    height: 30px !important;
    padding: 3PX;
    width: 30px !important;
  }


}

/* ── 480px: large phone ──────────────────────────────────── */
@media (max-width: 480px) {
  .chat_bod {
    width: 100%;
    margin: 0;
    border-radius: 0;
  }

  .initial-center {

    width: 100%;
    padding: 0 12px;
  }

  .chat-input-wrapper textarea {
    height: 90px;
    font-size: 13px;
    border-radius: 10px;
  }

  .text {
    font-size: 12px;
  }

  .pills {
    gap: 6px;
  }

  .pill {
    font-size: 11.5px;
    padding: 5px 12px;
  }

  /* === Bottom input bar === */
  .chat-input {
    padding: 10px;
    gap: 8px;
  }

  .chat-input input {
    height: 42px;
    font-size: 13px;
    padding: 10px;
    border-radius: 8px;
  }

  .chat-input button {
    width: 38px;
    height: 38px;
    font-size: 14px;
    padding: 8px;
    border-radius: 38px;
  }

  /* === Result page === */
  .page {
    padding: 4px 0;
  }

  .wrap {
    padding: 0 6px 16px;
    gap: 10px;
  }

  .panel.chat {
    height: 360px;
    border-radius: 8px;
  }

  .panel.output {
    height: 240px;
    border-radius: 8px;
  }

  .out-inner,
  .chart-card {
    height: 240px;
  }

  .risk-distribution-box {
    padding: 14px;
    border-radius: 8px;
  }

  .risk-bar {
    height: 8px;
  }

  #findingsRows {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
  }

  .findings-skeleton {
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
  }

  .skeleton-card {
    padding: 20px;
  }

  .finding {
    padding: 12px;
    border-radius: 8px;
  }

  .finding-title {
    font-size: 12px;
    margin: 0 0 5px 0;
  }
  .finding-count span{
    margin: 0px 0px 10px 0;
    font-size: 11px !important;
  }

  .grade-span-high,
  .grade-span-medium,
  .grade-span-low,
  .grade-span-safe {
    font-size: 7px;
    padding: 4px 8px;
  }

  .findings_box {
    font-size: 13px;
  }

  /* === Thread / inner chat === */
  .thread {
    padding: 0 4px;
  }

  .chat-bubble {
    font-size: 11.5px;
    padding: 10px 12px;
    max-width: 95%;
  }

  .scan-item {
    font-size: 12px;
  }

  #userName {
    font-size: 11px;
  }

  .input-bar {
    padding: 7px 8px;
    gap: 7px;
  }

  .input-bar input {
    font-size: 13px;
  }

  .send {
    width: 30px;
    height: 30px;
    font-size: 13px;
    border-radius: 30px;
  }

  /* === Tooltip === */
  #tooltip {
    font-size: 11px;
    padding: 6px 8px;
  }
}

/* ── 360px: small phone ──────────────────────────────────── */
@media (max-width: 360px) {
  .chat-input-wrapper textarea {
    height: 80px;
    font-size: 12px;
  }

  .pill {
    font-size: 11px;
    padding: 5px 10px;
  }

  .text {
    font-size: 11px;
  }

  .panel.chat {
    height: 300px;
  }

  .panel.output {
    height: 200px;
  }

  .out-inner,
  .chart-card {
    height: 200px;
  }

  .bubble {
    font-size: 12px;
  }

  .chat-bubble {
    font-size: 11px;
    padding: 8px 10px;
  }

  .finding-title {
    font-size: 12px;
  }

  .findings_box {
    font-size: 12px;
  }
}

/* ── Touch: disable hover effects to prevent sticky states ─ */
@media (hover: none) and (pointer: coarse) {
  .pill:hover,
  .chat-input button:hover,
  .chat-input-wrapper button:hover,
  .severity-high:hover,
  .severity-medium:hover,
  .severity-low:hover,
  .severity-safe:hover,
  .grade-span-high:hover,
  .grade-span-medium:hover,
  .grade-span-low:hover,
  .grade-span-safe:hover {
    transform: none;
    box-shadow: none;
    border-color: inherit;
    color: inherit;
    background: inherit;
  }
}

/* ── Utility: full-width canvas on small screens ─────────── */
@media (max-width: 600px) {
  canvas#radar {
    max-width: 100%;
    height: auto !important;
  }
}