/* ============================================================
   AskCube AI Chat Panel — collapsible side panel (right side)
   Non-blocking: site remains fully interactive underneath.
   Collapsed: tucks into a vertical tab on the right edge.
   ============================================================ */

/* ---------- Panel container ---------- */
.askcube-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  min-width: 280px;
  max-width: 80vw;
  height: 100%;
  background: #1a1a1a;
  border-left: 2px solid #00FDF6;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  pointer-events: auto;
}

/* Disable transform transition while dragging to avoid lag */
.askcube-panel.resizing {
  transition: none;
}

/* ---------- Resize handle (left edge) ---------- */
.askcube-resize-handle {
  position: absolute;
  top: 0;
  left: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 1;
}

.askcube-resize-handle:hover,
.askcube-resize-handle:active {
  background: rgba(0, 253, 246, 0.3);
}

/* Expanded (open) */
.askcube-panel.open {
  transform: translateX(0);
}

/* ---------- Collapsed tab ---------- */
.askcube-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 10000;
  background: #1a1a1a;
  border: 2px solid #00FDF6;
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 12px 6px;
  cursor: pointer;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  display: none;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.askcube-tab:hover {
  background: #2a2a2a;
}

.askcube-tab.visible {
  display: flex;
}

.askcube-tab-label {
  font-size: 0.8rem;
  font-weight: 600;
  background: linear-gradient(180deg, #00FDF6 6.37%, #0B7BF5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

.askcube-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00FDF6;
  flex-shrink: 0;
  display: none;
}

.askcube-tab-dot.has-messages {
  display: block;
}

/* ---------- Header ---------- */
.askcube-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
  gap: 8px;
}

.askcube-title {
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(180deg, #00FDF6 6.37%, #0B7BF5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex: 1;
}

.askcube-header-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.askcube-new-topic {
  background: none;
  border: 1px solid #444;
  border-radius: 4px;
  color: #999;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 3px 8px;
  line-height: 1;
  white-space: nowrap;
}

.askcube-collapse,
.askcube-close {
  background: none;
  border: none;
  color: #999;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.askcube-new-topic:hover,
.askcube-collapse:hover,
.askcube-close:hover {
  color: #fff;
}

/* ---------- Messages area ---------- */
.askcube-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.askcube-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.askcube-message.user {
  align-self: flex-end;
  background: #0B7BF5;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.askcube-message.assistant {
  align-self: flex-start;
  background: #2a2a2a;
  color: #ddd;
  border-bottom-left-radius: 4px;
}

.askcube-message a {
  color: #00FDF6;
  text-decoration: underline;
}

.askcube-message a:hover {
  color: #5dfdfa;
}

/* ---------- Markdown rendering in assistant messages ---------- */
.askcube-message.assistant {
  white-space: normal;
}

.askcube-message.assistant p {
  margin: 0 0 0.5em;
}

.askcube-message.assistant p:last-child {
  margin-bottom: 0;
}

.askcube-message.assistant strong {
  color: #fff;
}

.askcube-message.assistant em {
  font-style: italic;
}

.askcube-message.assistant ul,
.askcube-message.assistant ol {
  margin: 0.3em 0 0.5em;
  padding-left: 1.4em;
}

.askcube-message.assistant li {
  margin-bottom: 0.2em;
}

.askcube-message.assistant code {
  background: #111;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
}

.askcube-message.assistant pre {
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 0.4em 0;
}

.askcube-message.assistant pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

.askcube-message.assistant blockquote {
  border-left: 3px solid #00FDF6;
  margin: 0.4em 0;
  padding: 4px 12px;
  color: #aaa;
}

.askcube-message.assistant h1,
.askcube-message.assistant h2,
.askcube-message.assistant h3,
.askcube-message.assistant h4 {
  color: #fff;
  margin: 0.5em 0 0.3em;
  font-size: 0.95em;
  font-weight: 600;
}

.askcube-message.assistant hr {
  border: none;
  border-top: 1px solid #333;
  margin: 0.5em 0;
}

.askcube-message.assistant table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.4em 0;
  font-size: 0.85em;
}

.askcube-message.assistant th,
.askcube-message.assistant td {
  border: 1px solid #444;
  padding: 4px 8px;
  text-align: left;
}

.askcube-message.assistant th {
  background: #222;
  color: #fff;
}

/* ---------- Typing indicator ---------- */
.askcube-typing {
  align-self: flex-start;
  padding: 10px 14px;
  background: #2a2a2a;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  color: #999;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.askcube-typing .dot {
  width: 6px;
  height: 6px;
  background: #666;
  border-radius: 50%;
  animation: askcube-bounce 1.4s infinite ease-in-out both;
}

.askcube-typing .dot:nth-child(1) { animation-delay: -0.32s; }
.askcube-typing .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes askcube-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ---------- Welcome bubble ---------- */
.askcube-welcome {
  font-style: italic;
  opacity: 0.85;
}

/* ---------- Input area ---------- */
.askcube-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #333;
  flex-shrink: 0;
}

.askcube-input-area textarea {
  flex: 1;
  background: #000;
  border: 1px solid #444;
  border-radius: 16px;
  padding: 10px 16px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  font-family: var(--wa-font-family, helvetica, arial, sans-serif);
  resize: none;
  overflow-y: hidden;
  min-height: 38px;
  max-height: 120px;
  line-height: 1.4;
}

.askcube-input-area textarea:focus {
  border-color: #00FDF6;
}

.askcube-input-area textarea::placeholder {
  color: #666;
}

/* When content overflows max-height, switch to scrollable */
.askcube-input-area textarea.scrollable {
  overflow-y: auto;
}

#askcube-send {
  background: linear-gradient(180deg, #00FDF6 6.37%, #0B7BF5 100%);
  border: none;
  border-radius: 20px;
  padding: 10px 18px;
  color: #000;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
}

#askcube-send:hover {
  opacity: 0.9;
}

#askcube-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Error message ---------- */
.askcube-error {
  align-self: center;
  color: #ff6b6b;
  font-size: 0.8rem;
  padding: 6px 12px;
  background: rgba(255, 107, 107, 0.1);
  border-radius: 8px;
}

.askcube-navigate-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #00FDF6, #0B7BF5);
  color: #111;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.askcube-navigate-btn:hover {
  opacity: 0.85;
}

/* ---------- Movie links ---------- */
.askcube-message.assistant .askcube-movie-link {
  color: #00FDF6;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted #00FDF6;
}
.askcube-message.assistant .askcube-movie-link:hover {
  text-decoration: underline;
}

/* ---------- Results loaded indicator ---------- */
.askcube-results-loaded {
  display: block;
  margin-top: 8px;
  padding: 4px 0;
  color: #00FDF6;
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0.85;
}

/* ---------- Sparkle icon AI hover effect ---------- */

/* Wrapper: holds label + sparkle as one hover unit */
.askcube-trigger {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* "Ask AI" label — hidden by default, sits to the LEFT of the sparkle */
.askcube-hover-label {
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  background: linear-gradient(180deg, #00FDF6 6.37%, #0B7BF5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: max-width 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
  padding-right: 0;
}

/* Hover the whole trigger — expand label AND glow sparkle */
.askcube-trigger:hover .askcube-hover-label {
  max-width: 80px;
  opacity: 1;
  padding-right: 6px;
}

.askcube-trigger:hover .askcube-sparkle {
  transform: scale(1.3);
  filter: drop-shadow(0 0 4px rgba(0, 253, 246, 0.6));
}

/* Sparkle transition */
.about-search-icon.askcube-sparkle {
  transition: transform 0.2s ease, filter 0.2s ease;
}

/* ---------- Responsive: mobile ---------- */
@media (max-width: 550px) {
  .askcube-panel {
    width: 100%;
    border-left: none;
  }
}

/* ---------- Scrollbar styling ---------- */
.askcube-messages::-webkit-scrollbar {
  width: 6px;
}

.askcube-messages::-webkit-scrollbar-track {
  background: transparent;
}

.askcube-messages::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.askcube-messages::-webkit-scrollbar-thumb:hover {
  background: #666;
}
