@layer base {
  *,
  ::before,
  ::after {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
  }
}

.last-responce:last-of-type {
  padding-bottom: 100px;
}

body {
  background: #f8fafa;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-thumb {
  background: #e1e5e6;
  border-radius: 999px;
  border: 2px solid #f8fafa;
}

::-webkit-scrollbar-thumb:hover {
  background: #cfd5d7;
}

[contenteditable]:empty:before {
  content: attr(data-ph);
  color: #9aa0a3;
}

.card-hover {
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.card-hover:hover {
  box-shadow: 0 2px 10px rgba(8, 116, 137, 0.1);
  transform: translateY(-1px);
}

.fade-in {
  animation: fade 0.3s ease both;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.overlay {
  display: none;
}

.overlay.open {
  display: flex;
}

/* ── Sidebar smooth slide-in / slide-out ── */

/* Header logo area mirrors sidebar width */
#sidebarHeaderArea {
  overflow: hidden;
  transition:
    width 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Panels animate their width, not display */
.panel {
  overflow: hidden;
  transition:
    max-width 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.26s ease,
    border-color 0.34s ease;
}

/* When open, cap at the declared Tailwind width */
#sourcesPanel {
  max-width: 280px;
}

#studioPanel {
  /* center main canvas - grows freely */
  max-width: none;
}

#chatPanel {
  max-width: 480px;
}

/* Collapsed: squeeze to zero */
.panel.collapsed {
  max-width: 0 !important;
  min-width: 0 !important;
  opacity: 0;
  pointer-events: none;
  border-color: transparent;
}

/* Rails: always in the flex row, start at zero width, slide open */
.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  max-width: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
  transition:
    max-width 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.26s ease;
}

/* When a rail is revealed it grows to w-11 (44px) */
.rail.open {
  max-width: 44px;
  min-width: 44px;
  opacity: 1;
  pointer-events: auto;
}

/* Fade panel contents slightly ahead of the width collapse
            so text doesn't get squished visibly before it disappears */
.panel > * {
  transition: opacity 0.18s ease;
}

.panel.collapsed > * {
  opacity: 0;
}

/* Toggle icon: flip the inner vertical bar on collapse */
.collapse-icon {
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Studio 3-tab underline indicator */
.studio-tab-line {
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Studio pane cross-fade */
.studio-pane {
  animation: fade 0.22s ease both;
}

.panel.collapsed ~ .rail .collapse-icon,
.collapse-btn-active .collapse-icon {
  transform: scaleX(-1);
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Quick edits popup — smooth open/close. Uses position:fixed (coordinates set by JS)
            so it can overlap the document panel without being clipped by .panel's overflow:hidden. */
.quick-edits-panel {
  position: fixed;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transform-origin: bottom left;
  pointer-events: none;
  transition:
    opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-edits-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Agents dropdown — same smooth-open approach as Quick edits, dark theme */
.agents-panel {
  position: fixed;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transform-origin: bottom left;
  pointer-events: none;
  transition:
    opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.agents-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  max-height: 400px;
  overflow-y: auto;
}

/* "Ask AttestaAI" text-selection popup */
.ask-ai-popup {
  opacity: 0;
  transform: translateY(4px) scale(0.96);
  transform-origin: bottom center;
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.ask-ai-popup.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

mark.hl {
  background: #e8f1f3;
  padding: 0 2px;
  border-radius: 2px;
}

/* =====================================================
    STUDIO RESIZE HANDLE
  ===================================================== */

#studioPanel {
  position: relative;
}

/* Full draggable strip */
#studioResizeHandle {
  position: absolute;

  right: 0;
  top: 0;
  bottom: 0;

  width: 10px;

  z-index: 9999;

  cursor: col-resize;

  touch-action: none;

  background: transparent;
}

/* Visible drag indicator */
#studioResizeHandle::after {
  content: "";

  position: absolute;

  right: 4px;
  top: 50%;

  width: 2px;
  height: 32px;

  transform: translateY(-50%);

  border-radius: 999px;

  background: transparent;

  transition:
    height 0.15s ease,
    background 0.15s ease;
}

/* Hover */
#studioResizeHandle:hover::after {
  height: 48px;
  background: #94a3b8;
}

/* Active dragging */
#studioPanel.is-resizing #studioResizeHandle::after {
  height: 54px;
  background: #64748b;
}

body.is-resizing-studio {
  cursor: col-resize !important;
  user-select: none !important;
}

/*
  * Prevent the PDF iframe / other content
  * from stealing the pointer while resizing.
  */
body.is-resizing-studio iframe,
body.is-resizing-studio canvas {
  pointer-events: none !important;
}

.summary-html h2,
.summary-html h3,
.summary-html h4 {
  margin-top: 24px;
  margin-bottom: 12px;
}

.summary-html h2:first-child,
.summary-html h3:first-child,
.summary-html h4:first-child {
  margin-top: 0;
}

.summary-html p {
  margin-bottom: 12px;
  line-height: 1.6;
}

.summary-html ul {
  margin-bottom: 16px;
  padding-left: 20px;
  list-style: disc;
}

.summary-html li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.summary-html strong {
  font-weight: 600;
}

/* authendication */

/* ---- Soft diffuse gradient (dark teal → blue → green → yellow-orange) ---- */
.mesh {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(
    158deg,
    #0b3f52 0%,
    #0e708d 24%,
    #3a86ad 42%,
    #5eb3e0 56%,
    #63dd84 74%,
    #b9d95c 88%,
    #fd9a5c 100%
  );
}

/* Oversized inner layer, gently warped so colours melt organically */
.mesh-fx {
  position: absolute;
  inset: -22%;
  filter: url(#liquid);
  will-change: transform;
}

.blob {
  position: absolute;
  width: 78%;
  height: 78%;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.55;
  mix-blend-mode: screen;
  will-change: transform;
}
.b1 {
  background: #0e708d;
  top: -14%;
  left: -10%;
  animation: drift1 34s ease-in-out infinite;
}
.b2 {
  background: #5eb3e0;
  top: 18%;
  left: 20%;
  animation: drift2 40s ease-in-out infinite;
}
.b3 {
  background: #63dd84;
  bottom: -8%;
  right: -6%;
  animation: drift3 38s ease-in-out infinite;
}
.b4 {
  background: #fd9a5c;
  bottom: -16%;
  right: 14%;
  animation: drift4 44s ease-in-out infinite;
}

@keyframes drift1 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(14%, 12%) scale(1.12);
  }
}
@keyframes drift2 {
  0%,
  100% {
    transform: translate(0, 0) scale(1.05);
  }
  50% {
    transform: translate(-16%, 10%) scale(0.92);
  }
}
@keyframes drift3 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-12%, -14%) scale(1.14);
  }
}
@keyframes drift4 {
  0%,
  100% {
    transform: translate(0, 0) scale(1.08);
  }
  50% {
    transform: translate(16%, -10%) scale(0.9);
  }
}

/* Fine film grain */
.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.5) 0.6px,
    transparent 0.6px
  );
  background-size: 18px 18px;
  opacity: 0.09;
}

/* Right-edge white fade — content dissolves into white */
.fade-right {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: linear-gradient(
    to right,
    transparent 0%,
    transparent 72%,
    rgba(255, 255, 255, 0.15) 82%,
    rgba(255, 255, 255, 0.55) 91%,
    rgba(255, 255, 255, 0.88) 96%,
    #ffffff 100%
  );
}

/* Multi-step form transitions */
.step {
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}
.step.entering {
  opacity: 0;
  transform: translateX(18px);
}
.step.leaving {
  opacity: 0;
  transform: translateX(-18px);
}

/* OTP digit boxes */
.otp-box {
  width: 52px;
  height: 56px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  outline: none;
  caret-color: transparent;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.otp-box:focus {
  border-color: #171717;
  box-shadow: 0 0 0 4px rgba(23, 23, 23, 0.09);
}
.otp-box.filled {
  border-color: #171717;
}

/* Step progress dots */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d4d4d4;
  transition: 0.3s;
}
.dot.active {
  width: 20px;
  border-radius: 999px;
  background: #171717;
}

@media (prefers-reduced-motion: reduce) {
  .blob {
    animation: none !important;
  }
  .step {
    transition: none !important;
  }
}
