/* ==========================================================================
   Hero chat box — typewriter prompt card.
   Adapted from the "chat box anime" vanilla package; every colour is mapped
   onto the site tokens below so it follows the Maktabi theme automatically.
   ========================================================================== */

.cb-hero-wrapper {
  /* palette → site tokens */
  --cb-foreground: var(--text);
  --cb-border: var(--border-strong);
  --cb-card: var(--surface-solid);
  --cb-card-foreground: var(--text);
  --cb-popover: var(--surface-solid);
  --cb-popover-foreground: var(--text);
  --cb-primary: var(--accent);
  --cb-primary-foreground: #ffffff;
  --cb-secondary: var(--accent-soft);
  --cb-secondary-foreground: var(--accent);
  --cb-muted: var(--surface);
  --cb-muted-foreground: var(--muted);

  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 26px auto 0;
  box-sizing: border-box;
}
.cb-hero-wrapper * { box-sizing: border-box; }

/* Floating sparkle badge above the card */
.cb-badge-container {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.cb-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  border-radius: 9999px;
  font-size: var(--fs-sm);
  font-weight: 500;
  background-color: var(--cb-secondary);
  color: var(--cb-secondary-foreground);
  border: 1px solid var(--accent-border);
  transition: all .3s ease;
  user-select: none;
  white-space: nowrap;
}
@media (max-width: 480px) { .cb-badge { white-space: normal; text-align: center; } }
.cb-badge-icon {
  width: 14px; height: 14px;
  color: var(--cb-primary);
  flex-shrink: 0;
}
html.motion-ok .cb-badge-icon { animation: cb-pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }

/* Chat input card */
.cb-card {
  position: relative;
  background-color: var(--cb-card);
  color: var(--cb-card-foreground);
  border-radius: 16px;
  padding: 17px;
  border: 1px solid var(--cb-border);
  transition: box-shadow .2s cubic-bezier(.22, 1, .36, 1), border-color .2s;
  box-shadow:
    rgba(0, 0, 0, .06) 0 0 0 1px,
    rgba(0, 0, 0, .06) 0 1px 1px -.5px,
    rgba(0, 0, 0, .06) 0 3px 3px -1.5px,
    rgba(0, 0, 0, .06) 0 6px 6px -3px,
    rgba(0, 0, 0, .06) 0 12px 12px -6px,
    rgba(0, 0, 0, .06) 0 24px 24px -12px;
  text-align: start;
}
.cb-card:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 4px var(--glow-nf), var(--sh-lift);
}

/* Typewriter area */
.cb-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 10px;
  cursor: text;
}
.cb-real-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 17px;
  color: var(--cb-foreground);
  z-index: 2;
  padding: 0;
  margin: 0;
}
.cb-real-input::placeholder { color: transparent; }
.cb-typewriter-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 1;
}
.cb-typewriter-text { color: var(--cb-muted-foreground); font-weight: 400; }
.cb-typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 22px;
  background-color: var(--cb-primary);
  margin-inline-start: 2px;
  vertical-align: middle;
}
html.motion-ok .cb-typewriter-cursor { animation: cb-cursor-blink .7s infinite; }

/* Bottom toolbar */
.cb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--cb-border);
}

/* Assistant picker */
.cb-model-dropdown { position: relative; }
.cb-btn-model {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cb-muted-foreground);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all .2s cubic-bezier(.22, 1, .36, 1);
  font-family: inherit;
}
.cb-btn-model:hover {
  color: var(--cb-foreground);
  background-color: var(--cb-muted);
  transform: translateY(-1px);
}
.cb-btn-model svg { width: 14px; height: 14px; }
.cb-model-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  min-width: 180px;
  background-color: var(--cb-popover);
  color: var(--cb-popover-foreground);
  border-radius: 12px;
  border: 1px solid var(--cb-border);
  box-shadow: var(--sh-lift);
  padding: 6px;
  z-index: 50;
}
html.motion-ok .cb-model-menu.open { animation: cb-scale-in .15s ease-out; }
.cb-model-menu.open { display: block; }
.cb-model-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  text-align: start;
  background: transparent;
  border: none;
  color: var(--cb-foreground);
  cursor: pointer;
  font-family: inherit;
  transition: background-color .15s ease;
}
.cb-model-option:hover { background-color: var(--cb-muted); }
.cb-model-option.active {
  background-color: var(--cb-secondary);
  color: var(--cb-secondary-foreground);
  font-weight: 600;
}

/* Icon buttons + send */
.cb-actions-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cb-icon-btn {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--cb-muted-foreground);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all .2s cubic-bezier(.22, 1, .36, 1);
}
.cb-icon-btn:hover {
  color: var(--cb-foreground);
  background-color: var(--cb-muted);
  transform: translateY(-1px);
}
.cb-icon-btn svg { width: 16px; height: 16px; }
.cb-send-btn {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background-image: var(--grad-135);
  color: #ffffff;
  border: none;
  cursor: pointer;
  margin-inline-start: 4px;
  transition: all .2s cubic-bezier(.22, 1, .36, 1);
}
.cb-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px 4px var(--glow-nf);
}
.cb-send-btn:active { transform: translateY(0) scale(.96); }
.cb-send-btn svg { width: 16px; height: 16px; }

/* Keyframes */
@keyframes cb-cursor-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes cb-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes cb-scale-in {
  from { opacity: 0; transform: scale(.95) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Send arrow points with the reading direction */
[dir="ltr"] .cb-rtl-flip { transform: rotate(180deg); }

@media (max-width: 480px) {
  .cb-hide-mobile { display: none !important; }
  .cb-hero-wrapper { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cb-badge-icon, .cb-typewriter-cursor { animation: none !important; }
}
