.ai-blog-panel {
  position: fixed;
  inset: 0;
  z-index: 1002;
  pointer-events: none;
  color: rgba(232, 238, 247, 0.94);
  font-size: 14px;
}

.ai-blog-toggle,
.ai-blog-form button,
.ai-blog-modes button,
.ai-blog-history button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.ai-blog-toggle {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.65rem;
  padding: .55rem .92rem;
  border: 1px solid rgba(125, 211, 252, 0.26);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.95), rgba(15, 23, 42, 0.94));
  color: #ecfeff;
  box-shadow: 0 18px 42px rgba(3, 7, 18, 0.32);
  pointer-events: auto;
}

.ai-blog-mask {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(45, 212, 191, 0.12), transparent 24rem),
    rgba(2, 6, 23, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: auto;
}

.ai-blog-mask[hidden] {
  display: none !important;
}

.ai-blog-toggle span:first-child {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: rgba(236, 254, 255, 0.14);
  color: #a7f3d0;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.ai-blog-card {
  position: fixed;
  top: 7vh;
  left: 50%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(52rem, calc(100vw - 2rem));
  max-height: min(82vh, 44rem);
  padding: 1rem;
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 22px;
  background:
    radial-gradient(circle at 14% 0%, rgba(45, 212, 191, 0.13), transparent 13rem),
    linear-gradient(180deg, rgba(17, 27, 42, 0.98), rgba(10, 18, 30, 0.98));
  box-shadow: 0 24px 70px rgba(3, 7, 18, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  pointer-events: auto;
  transform: translateX(-50%);
}

.ai-blog-card[hidden] {
  display: none !important;
}

.ai-blog-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  margin: 0 0 .62rem;
  padding: .22rem;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.34);
}

.ai-blog-modes button {
  min-height: 2rem;
  border-radius: 999px;
  background: transparent;
  color: rgba(203, 213, 225, 0.84);
}

.ai-blog-modes button.is-active {
  background: rgba(125, 211, 252, 0.16);
  color: #ecfeff;
}

.ai-blog-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
}

.ai-blog-form input[type="search"] {
  min-width: 0;
  min-height: 2.5rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.36);
  color: #f8fafc;
  padding: 0 .78rem;
  outline: none;
}

.ai-blog-form input[type="search"]::placeholder {
  color: rgba(148, 163, 184, 0.72);
}

.ai-blog-form input[type="search"]:focus {
  border-color: rgba(125, 211, 252, 0.56);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.10);
}

.ai-blog-form button[type="submit"] {
  display: grid;
  place-items: center;
  width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border-radius: 14px;
  background: #7dd3fc;
  color: #082f49;
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1;
}

.ai-blog-send span {
  transform: translateY(-1px);
}

.ai-blog-form button:disabled,
.ai-blog-form input:disabled {
  cursor: wait;
  opacity: .72;
}

.ai-blog-history {
  margin-top: .7rem;
  padding: .58rem;
  border: 1px solid rgba(125, 211, 252, 0.10);
  border-radius: 15px;
  background: rgba(2, 6, 23, 0.22);
}

.ai-blog-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  color: rgba(203, 213, 225, 0.72);
  font-size: .78rem;
}

.ai-blog-history-head button {
  padding: .1rem .35rem;
  border-radius: 999px;
  background: transparent;
  color: rgba(125, 211, 252, 0.86);
}

.ai-blog-history-head button:disabled {
  cursor: default;
  opacity: .42;
}

.ai-blog-history-list {
  display: flex;
  gap: .42rem;
  margin-top: .42rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: rgba(125, 211, 252, 0.16) transparent;
  scrollbar-width: thin;
}

.ai-blog-history-item {
  flex: 0 0 auto;
  display: grid;
  gap: .12rem;
  max-width: 12rem;
  padding: .42rem .55rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.58);
  color: rgba(226, 232, 240, 0.9);
  text-align: left;
}

.ai-blog-history-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-blog-history-item time,
.ai-blog-history-empty {
  color: rgba(148, 163, 184, 0.72);
  font-size: .72rem;
}

.ai-blog-history-empty {
  margin: 0;
}

.ai-blog-status,
.ai-blog-fallback {
  margin: .7rem 0 0;
  color: rgba(203, 213, 225, 0.78);
  line-height: 1.45;
}

.ai-blog-results {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: .62rem;
  margin-top: .65rem;
  overflow: auto;
  scrollbar-color: rgba(125, 211, 252, 0.16) transparent;
  scrollbar-width: thin;
}

.ai-blog-history-list::-webkit-scrollbar,
.ai-blog-results::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.ai-blog-history-list::-webkit-scrollbar-track,
.ai-blog-results::-webkit-scrollbar-track {
  background: transparent;
}

.ai-blog-history-list::-webkit-scrollbar-thumb,
.ai-blog-results::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background-color: rgba(125, 211, 252, 0.16);
  background-clip: content-box;
}

.ai-blog-history-list:hover,
.ai-blog-history-list:focus-within,
.ai-blog-results:hover,
.ai-blog-results:focus-within {
  scrollbar-color: rgba(125, 211, 252, 0.30) transparent;
}

.ai-blog-history-list:hover::-webkit-scrollbar-thumb,
.ai-blog-history-list:focus-within::-webkit-scrollbar-thumb,
.ai-blog-results:hover::-webkit-scrollbar-thumb,
.ai-blog-results:focus-within::-webkit-scrollbar-thumb {
  background-color: rgba(125, 211, 252, 0.30);
}

.ai-blog-result,
.ai-blog-answer {
  border: 1px solid rgba(125, 211, 252, 0.12);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.54);
  padding: .78rem;
}

.ai-blog-references {
  display: grid;
  gap: .62rem;
  margin-top: .12rem;
  padding-top: .85rem;
  border-top: 1px solid rgba(125, 211, 252, 0.20);
}

.ai-blog-references h3 {
  margin: 0;
  color: rgba(167, 243, 208, 0.92);
  font-size: .86rem;
  letter-spacing: .08em;
}

.ai-blog-result-title {
  display: block;
  color: #bfdbfe;
  font-weight: 800;
  line-height: 1.35;
}

.ai-blog-result-meta {
  display: inline-block;
  margin-top: .22rem;
  color: rgba(167, 243, 208, 0.78);
  font-size: .75rem;
}

.ai-blog-result p,
.ai-blog-answer {
  color: rgba(226, 232, 240, 0.84);
  line-height: 1.55;
  white-space: pre-wrap;
}

.ai-blog-result p {
  margin: .35rem 0 0;
}

@media (max-width: 768px) {
  .ai-blog-toggle {
    left: .75rem;
    bottom: .75rem;
  }

  .ai-blog-card {
    top: .75rem;
    width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 1.5rem);
    border-radius: 20px;
    padding: .9rem;
  }

  .ai-blog-form {
    grid-template-columns: 1fr;
  }
}
