@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap");
:root {
  --bg: #101014;
  --surface: #191923;
  --text: #fff;
  --muted: #aaa9ba;
  --purple: #8b5cf6;
  --border: #302d40;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    16px "DM Sans",
    sans-serif;
  line-height: 1.6;
}
nav {
  position: sticky;
  top: 0;
  background: #15141cee;
  border-bottom: 1px solid var(--border);
  padding: 18px max(calc((100% - 1100px) / 2), 24px);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  z-index: 2;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  margin-right: 18px;
}
.brand {
  font: 700 22px "Space Grotesk";
  color: white;
}
.brand b,
em {
  color: #b69aff;
}
main {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 24px;
  min-height: 70vh;
}
h1,
h2,
h3 {
  font-family: "Space Grotesk";
}
h1 {
  font-size: clamp(2.3rem, 6vw, 4rem);
  line-height: 1.1;
}
.hero {
  padding: 65px 0 90px;
}
.hero span {
  color: #b69aff;
  letter-spacing: 3px;
  font-weight: 700;
}
.hero p {
  color: var(--muted);
  max-width: 600px;
  font-size: 1.1rem;
}
.btn,
button {
  display: inline-block;
  background: linear-gradient(120deg, #7c3aed, #5b21b6);
  color: white;
  border: 0;
  border-radius: 9px;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}
.ghost {
  background: transparent;
  border: 1px solid var(--border);
}
.panel,
article,
.grid article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin: 15px 0;
}
.panel {
  max-width: 650px;
}
label {
  display: block;
  margin: 12px 0 5px;
}
input,
select,
textarea {
  width: 100%;
  padding: 12px;
  background: #101014;
  color: white;
  border: 1px solid var(--border);
  border-radius: 8px;
}
textarea {
  min-height: 90px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.inline {
  display: inline;
}
.inline button {
  padding: 6px 12px;
}
.notice {
  background: #30234a;
  padding: 12px;
  border-radius: 8px;
}
.thumb {
  max-width: 260px;
  max-height: 180px;
  object-fit: cover;
  display: block;
}
footer {
  text-align: center;
  padding: 28px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.inspection-card {
  padding: 20px;
  margin: 18px 0;
  border: 1px solid #ded7eb;
  border-radius: 12px;
  background: #fff;
}

.thumb {
  width: 150px;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin: 12px 0;
}

.report-image {
  display: block;
  width: 100%;
  max-width: 850px;
  height: auto;
  margin: 15px 0 25px;
  border-radius: 12px;
  border: 1px solid #ded7eb;
}

.status-success {
  color: #16834a;
  font-weight: 600;
}

.status-error {
  color: #c0394b;
  font-weight: 600;
}

.btn-danger {
  background: #a82c48;
  color: #fff;
  border: none;
  cursor: pointer;
}

.inspection-card .actions,
.panel .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.inspection-card form {
  display: inline-block;
}

/* Detection Details */
.detection-details,
.detection-card,
.detection-info {
  background: #ffffff !important;
  color: #1f1b2d !important;
}

.detection-details h2,
.detection-details h3,
.detection-card h2,
.detection-card h3 {
  color: #24143f !important;
}

.detection-details p,
.detection-card p,
.detection-info p {
  color: #383044 !important;
}

.detection-details strong,
.detection-card strong,
.detection-info strong {
  color: #171222 !important;
}

/* Detection values */
.detection-details span,
.detection-card span,
.detection-info span {
  color: #5b21b6;
}

/* Bounding box and metadata */
.detection-details code,
.detection-card code {
  color: #4c1d95;
  background: #f3edff;
  padding: 3px 7px;
  border-radius: 5px;
}
/* ==============================
   INSPECTION REPORT
============================== */

.inspection-card {
  background: #ffffff !important;
  color: #241b35 !important;
  border: 1px solid #ded7eb;
  border-radius: 14px;
  padding: 24px;
  margin: 20px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.inspection-card h3 {
  color: #5b21b6 !important;
  margin-top: 0;
  margin-bottom: 18px;
}

.inspection-card p {
  color: #383044 !important;
  margin: 12px 0;
  line-height: 1.7;
}

.inspection-card strong {
  color: #24143f !important;
  font-weight: 700;
}

/* Bounding box */
.inspection-card p:last-child {
  overflow-wrap: anywhere;
}

/* ==============================
   BUTTON SPACING
============================== */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
}

.inspection-card .actions,
.panel .actions {
  gap: 14px;
}

.inspection-card .btn,
.panel .btn,
form .btn-danger {
  margin: 5px 5px 5px 0;
}

.inspection-card form {
  display: inline-block;
  margin: 10px 0;
}

/* ==============================
   REPORT BUTTONS
============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 20px;
  border-radius: 9px;
  text-align: center;
  transition: 0.2s ease;
}

.btn:hover,
button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ==============================
   SEVERITY SUMMARY CARDS
============================== */

.actions article {
  flex: 1 1 130px;
  min-width: 120px;
  padding: 18px;
  text-align: center;
  background: #ffffff;
  color: #241b35;
  border: 1px solid #ded7eb;
  border-radius: 12px;
}

.actions article h3 {
  color: #5b21b6;
  font-size: 26px;
  margin: 0;
}

.actions article p {
  color: #383044;
  margin-bottom: 0;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 48px;
  padding: 48px 0 64px;
}

.home-hero-content > span {
  color: #b69aff;
  letter-spacing: 3px;
  font-size: 12px;
  font-weight: 700;
}

.home-hero-content h1 {
  margin: 20px 0;
}

.home-hero-content p {
  max-width: 500px;
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 28px;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.home-hero-image {
  display: flex;
  justify-content: center;
}

.home-hero-image img {
  display: block;
  width: 100%;
  max-width: 470px;
  height: auto;
  object-fit: contain;
  animation: home-float 4s ease-in-out infinite;
}

@keyframes home-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.home-marquee {
  overflow: hidden;
  margin: 8px 0 56px;
  padding: 16px 0;
  background: #a78bfa;
  color: #171321;
}

.home-marquee-track,
.home-marquee-group {
  display: flex;
  width: max-content;
}

.home-marquee-track {
  animation: home-marquee-scroll 28s linear infinite;
}

.home-marquee-group span {
  padding: 0 28px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

@keyframes home-marquee-scroll {
  to {
    transform: translateX(-50%);
  }
}

.home-features {
  padding: 0 0 56px;
}

.home-features > h2 {
  margin-bottom: 24px;
  text-align: center;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.home-feature-card {
  padding: 26px 22px;
  border: 2px dotted #a78bfa;
  border-radius: 14px;
  background: var(--surface);
}

.home-feature-card h3 {
  margin-top: 0;
}

.home-feature-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.home-cta {
  margin: 0 0 48px;
  padding: 42px 24px;
  border-radius: 18px;
  background: #211b32;
  text-align: center;
}

.home-cta h2 {
  margin-top: 0;
}

.home-cta p {
  color: var(--muted);
  margin: 0 auto 24px;
  max-width: 620px;
}

@media (max-width: 760px) {
  .home-hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 32px;
  }

  .home-hero-image {
    grid-row: 1;
  }

  .home-hero-image img {
    max-width: 340px;
  }

  .home-feature-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero-image img,
  .home-marquee-track {
    animation: none;
  }
}

.dashboard-layout {
  display: grid;
  grid-template-areas: "panel art";
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  align-items: start;
  gap: 32px;
}

.dashboard-panel {
  grid-area: panel;
  width: 100%;
  max-width: none;
  margin: 0;
}

.dashboard-art {
  grid-area: art;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 40px;
}

.dashboard-art img {
  display: block;
  width: 100%;
  max-width: 390px;
  height: auto;
}

@media (max-width: 760px) {
  .dashboard-layout {
    grid-template-areas:
      "art"
      "panel";
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .dashboard-art {
    padding-top: 0;
  }

  .dashboard-art img {
    max-width: 260px;
  }
}

/* ==============================
   REPORT IMAGES
============================== */

.report-image {
  width: 100%;
  max-width: 850px;
  height: auto;
  display: block;
  margin: 18px 0 28px;
  border-radius: 12px;
}

/* ==============================
   MOBILE RESPONSIVENESS
============================== */

@media (max-width: 600px) {
  .actions {
    gap: 10px;
  }

  .actions article {
    flex: 1 1 40%;
  }

  .inspection-card {
    padding: 17px;
  }

  .btn {
    width: 100%;
  }
}

.inspection-card,
.inspection-card * {
  color: #241b35;
}

.inspection-card h3 {
  color: #5b21b6;
}

.inspection-card strong {
  color: #24143f;
  font-weight: 800;
}

.inspection-card p {
  color: #383044;
}

.inspection-card {
  background: #ffffff;
  border: 1px solid #ded7eb;
}


/* ============================================================
   AUTOCARE AI CHATBOT
============================================================ */

/* ---- Floating Action Button ---- */
#chatbot-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 9px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 20px 13px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

#chatbot-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(124, 58, 237, 0.65);
}

#chatbot-fab.active {
  background: linear-gradient(135deg, #5b21b6, #4c1d95);
}

.chatbot-fab-icon {
  display: flex;
  align-items: center;
}

.chatbot-fab-label {
  letter-spacing: 0.01em;
}

/* ---- Chat Window ---- */
#chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 9001;
  width: 390px;
  max-width: calc(100vw - 40px);
  max-height: 580px;
  display: flex;
  flex-direction: column;
  background: #12101c;
  border: 1px solid #3d2878;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(139, 92, 246, 0.2);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

#chatbot-window.minimized {
  max-height: 68px;
  overflow: hidden;
}

/* ---- Header ---- */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(120deg, #1e1040, #2d1b69);
  border-bottom: 1px solid #3d2878;
  flex-shrink: 0;
  cursor: default;
}

.chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatbot-avatar {
  font-size: 1.6rem;
  line-height: 1;
  background: rgba(139, 92, 246, 0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chatbot-title {
  color: #e0d4ff;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: "Space Grotesk", sans-serif;
}

.chatbot-subtitle {
  color: #9b7fe8;
  font-size: 0.75rem;
}

.chatbot-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chatbot-icon-btn {
  background: transparent;
  border: none;
  color: #c4b5fd;
  font-size: 0.9rem;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  padding: 0;
  min-height: unset;
}

.chatbot-icon-btn:hover {
  background: rgba(139, 92, 246, 0.25);
  opacity: 1;
  transform: none;
}

/* ---- Report toggle row ---- */
.chatbot-report-row {
  padding: 8px 14px;
  background: #1a1035;
  border-bottom: 1px solid #2d1f4e;
  flex-shrink: 0;
}

.chatbot-report-label {
  color: #c4b5fd;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  margin: 0;
}

.chatbot-report-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #8b5cf6;
  flex-shrink: 0;
}

/* ---- Messages area ---- */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb {
  background: #3d2878;
  border-radius: 4px;
}

/* ---- Single message row ---- */
.chatbot-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: chatbot-fadein 0.2s ease;
}

@keyframes chatbot-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chatbot-msg-user {
  align-self: flex-end;
  align-items: flex-end;
}

.chatbot-msg-bot {
  align-self: flex-start;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  max-width: 92%;
}

.chatbot-bot-avatar {
  font-size: 1.1rem;
  background: rgba(139, 92, 246, 0.15);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.chatbot-msg-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* ---- Bubbles ---- */
.chatbot-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  word-break: break-word;
}

.chatbot-bubble-user {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-bubble-user p {
  margin: 0;
  color: #fff;
}

.chatbot-bubble-bot {
  background: #1e1a2e;
  color: #e2ddf5;
  border: 1px solid #2d2550;
  border-bottom-left-radius: 4px;
}

/* Bot message markdown styles */
.chatbot-bubble-bot p {
  margin: 0 0 8px;
  color: #e2ddf5;
}
.chatbot-bubble-bot p:last-child { margin-bottom: 0; }

.chatbot-bubble-bot strong { color: #c4b5fd; }
.chatbot-bubble-bot em     { color: #a78bfa; font-style: italic; }

.chatbot-bubble-bot code {
  background: #2d1f4e;
  color: #c4b5fd;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.chatbot-bubble-bot h4,
.chatbot-bubble-bot h5 {
  color: #b69aff;
  font-size: 0.88rem;
  margin: 10px 0 4px;
}

.chatbot-bubble-bot ul,
.chatbot-bubble-bot ol {
  margin: 6px 0;
  padding-left: 18px;
}

.chatbot-bubble-bot li {
  color: #d4cfea;
  margin-bottom: 4px;
  font-size: 0.87rem;
}

/* ---- Timestamp ---- */
.chatbot-ts {
  font-size: 0.7rem;
  color: #6b6080;
  margin-top: 2px;
}

.chatbot-msg-user .chatbot-ts { text-align: right; }

/* ---- Error bubble ---- */
.chatbot-msg-error {
  align-self: stretch;
}

.chatbot-error-bubble {
  background: #2a1020;
  border: 1px solid #c0394b;
  border-radius: 10px;
  color: #f87171;
  font-size: 0.84rem;
  padding: 8px 12px;
  line-height: 1.5;
}

/* ---- Typing indicator ---- */
.chatbot-typing {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: #9b7fe8;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.chatbot-typing.visible {
  display: flex;
}

.chatbot-dots {
  display: flex;
  gap: 4px;
}

.chatbot-dots span {
  width: 7px;
  height: 7px;
  background: #8b5cf6;
  border-radius: 50%;
  animation: chatbot-bounce 1s infinite ease-in-out;
}

.chatbot-dots span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatbot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

/* ---- Input row ---- */
.chatbot-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #2d1f4e;
  background: #110f1e;
  flex-shrink: 0;
}

.chatbot-input-wrap {
  flex: 1;
  position: relative;
}

.chatbot-input {
  width: 100%;
  background: #1e1a2e;
  color: #e2ddf5;
  border: 1px solid #3d2878;
  border-radius: 12px;
  padding: 10px 14px 24px;
  font-size: 0.88rem;
  font-family: inherit;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.chatbot-input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.chatbot-input::placeholder { color: #5a4e7a; }

.chatbot-char-count {
  position: absolute;
  bottom: 7px;
  right: 10px;
  font-size: 0.68rem;
  color: #5a4e7a;
  pointer-events: none;
  user-select: none;
}

.chatbot-send-btn {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: #fff;
  border: none;
  border-radius: 12px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  min-height: unset;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}

.chatbot-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.55);
  opacity: 1;
}

.chatbot-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  #chatbot-fab {
    bottom: 16px;
    right: 16px;
    padding: 11px 16px 11px 14px;
    font-size: 0.84rem;
  }

  #chatbot-window {
    bottom: 76px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: 100%;
    max-height: 72vh;
  }
}
