/**
 * Biru SaaS - Conversational Chatbot Styles (Moonlit / Claude theme)
 */

:root {
  --bg-main: #F4F1EA;
  --bg-sidebar: #EBE6DA;
  --accent: #C2703D;
  --accent-dark: #A85A2E;
  --text-main: #2B2620;
  --text-muted: #8A8276;
  --border-soft: #E1DBCB;
  --bubble-user: #E7DFCC;
  --bubble-bot: #FFFFFF;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
}

body.chatbot-body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
}

/* Custom Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-soft) transparent; }
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-soft); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.app-chat-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
}

/* Chat Sidebar */
.chat-sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  flex-shrink: 0;
}

.chat-brand {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 18px 8px;
  text-decoration: none;
}
.chat-brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(194, 112, 61, 0.15);
}

.btn-newchat {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  transition: opacity 0.15s ease;
  cursor: pointer;
}
.btn-newchat:hover { opacity: 0.9; color: #fff; }

.side-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 6px 10px 4px 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 600;
}

.side-item {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  text-decoration: none;
  display: block;
}
.side-item:hover { background: rgba(0, 0, 0, 0.05); color: var(--text-main); }
.side-item.active { background: rgba(0, 0, 0, 0.08); font-weight: 600; }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-radius: 10px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.03);
}
.sidebar-footer:hover { background: rgba(0, 0, 0, 0.06); color: var(--text-main); }

/* Main Chat Area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.chat-topbar {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.chat-topbar .model-pill {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  padding: 5px 12px;
  border-radius: 20px;
}
.chat-topbar .admin-link {
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: #fff;
  transition: all 0.15s ease;
}
.chat-topbar .admin-link:hover {
  background: var(--accent);
  color: #fff;
}

#biruform {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.vertical-align {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  height: 100%;
}
.vertical-align .container {
  max-width: 760px;
  width: 100%;
  padding: 8px 20px 16px 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.vertical-align .row, .vertical-align .col {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
}
.card.no-border {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Conversation wrapper */
.conv-form-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  position: relative;
}

.wrapper-messages {
  display: flex !important;
  flex-direction: column !important;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px 8px 16px 4px;
}
#messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: auto !important;
}

.spinLoader {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 34px 0;
}
.spinLoader::before { content: "Tunggu sedang dihubungkan..."; }
.spinLoader.d-none { display: none; }

/* Animations */
@keyframes slideUpFadeIn {
  0% {
    opacity: 0;
    transform: translateY(26px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes firstDialogSlideUp {
  0% {
    opacity: 0;
    transform: translateY(45px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Bubbles & Message Rows */
.message-row.to {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 88%;
  align-self: flex-start;
  animation: slideUpFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.first-dialog-entrance {
  animation: firstDialogSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.bot-avatar-wrap {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 2px;
  flex-shrink: 0;
}

.bot-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.bot-avatar-emoji {
  font-size: 20px;
  line-height: 1;
}

.bot-content-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.bot-name-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-left: 4px;
  letter-spacing: 0.2px;
}

.message {
  max-width: 78%;
  padding: 11px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.55;
  word-wrap: break-word;
}

.message-row.to .message.to {
  max-width: 100%;
  align-self: flex-start;
}

.message.to {
  align-self: flex-start;
  background: var(--bubble-bot);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.message.from {
  align-self: flex-end;
  background: var(--bubble-user);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  animation: slideUpFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message table {
  font-size: 0.88rem;
  width: 100%;
  border-collapse: collapse;
}

.message table td {
  padding: 4px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Typing animation */
@keyframes typingBounce {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.1); }
}

.message.typing {
  display: flex;
  align-items: center;
  min-width: 54px;
  min-height: 42px;
}

.message.typing .typing_loader {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 18px;
}

.message.typing .typing_loader::before,
.message.typing .typing_loader span,
.message.typing .typing_loader::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.3s infinite ease-in-out;
}

.message.typing .typing_loader::before { animation-delay: 0s; }
.message.typing .typing_loader span { animation-delay: 0.2s; }
.message.typing .typing_loader::after { animation-delay: 0.4s; }

/* Smooth Human Typewriter Effect */
.message.is-typewriting {
  position: relative;
  min-height: auto;
  cursor: pointer;
}
.message.is-typewriting::after {
  content: '▋';
  display: inline-block;
  margin-left: 3px;
  font-size: 0.78em;
  line-height: 1;
  color: var(--accent, #C2703D);
  vertical-align: baseline;
  animation: typingCaretBlink 0.6s infinite ease-in-out;
}

@keyframes typingCaretBlink {
  0%, 100% { opacity: 1; transform: scaleY(1); }
  50% { opacity: 0; transform: scaleY(0.7); }
}

/* Quick-reply options (Inside Chat Stream - Aligned Right under previous answers) */
.chat-options-container {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  align-self: flex-end !important;
  max-width: 95% !important;
  margin-top: 6px !important;
  margin-bottom: 12px !important;
  margin-left: auto !important;
  margin-right: 0 !important;
  position: relative;
  z-index: 5;
  animation: slideUpFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.chat-options-list {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  width: 100%;
}

.chat-option-btn {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto !important;
  position: relative;
  z-index: 6;
}

.chat-option-btn:hover {
  background: #FAF7F2;
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.chat-option-btn:active {
  transform: scale(0.97);
  background: #F0ECE4;
}

.chat-option-btn.selected {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(194, 112, 61, 0.25);
}

.btn-chat-options-submit {
  margin-top: 8px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 10px 20px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto !important;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-end;
  box-shadow: 0 3px 10px rgba(194, 112, 61, 0.3);
  transition: all 0.18s ease;
}

.btn-chat-options-submit:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* Fallback options inside composer area (if used) */
.options {
  display: none !important;
}

/* Chat Controls Area (Area Kontrol Input, Dropzone, & Composer di Bagian Bawah) */
.chat-controls-area {
  padding: 10px 18px 22px 18px !important;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

@media (max-width: 768px) {
  .chat-controls-area {
    padding: 8px 12px 18px 12px !important;
  }
}

/* Composer pinned at bottom */
.BiruChatFormDynamic {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  padding: 10px 10px 10px 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
  margin-top: auto;
  position: relative;
  z-index: 5;
}
.userInputDynamic {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.96rem;
  color: var(--text-main);
  max-height: 140px;
  line-height: 1.5;
  padding: 4px 0;
}
.userInputDynamic::placeholder { color: var(--text-muted); }
.userInputDynamic.error { color: #C0392B; }
.userInputDynamic:disabled { color: var(--text-muted); }

button.submit {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  transition: opacity 0.15s ease;
}
button.submit:hover { opacity: 0.9; }
button.submit.glow { box-shadow: 0 0 0 4px rgba(194, 112, 61, 0.25); }

/* Option mode hides text input */
.BiruChatFormDynamic:has(.options .option) {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0 4px;
}
.BiruChatFormDynamic:has(.options .option) .userInputDynamic,
.BiruChatFormDynamic:has(.options .option) button.submit {
  display: none !important;
}
.BiruChatFormDynamic:has(.options .option) .options {
  padding: 0 0 4px 0;
}

/* Dropzone Styles */
.dropzone-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 2px;
}
.dropzone-area {
  border: 2px dashed var(--accent) !important;
  background: #FAF7F2 !important;
  border-radius: 18px !important;
  padding: 18px 14px !important;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
.dropzone-area:hover, .dropzone-area.dz-drag-hover {
  background: #FFFDF9 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.dz-message {
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.dz-icon { color: var(--accent); }
.dz-text-main { font-size: 0.9rem; font-weight: 600; color: var(--text-main); }
.dz-text-main span { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.dz-text-sub { font-size: 0.76rem; color: var(--text-muted); }

.dropzone-area .dz-preview {
  display: inline-flex !important;
  flex-direction: column;
  align-items: center;
  margin: 4px !important;
  min-height: auto !important;
}
.dropzone-area .dz-preview .dz-image {
  border-radius: 12px !important;
  width: 90px !important;
  height: 90px !important;
  border: 2px solid var(--border-soft);
  overflow: hidden;
}
.dropzone-area .dz-preview .dz-image img { width: 100%; height: 100%; object-fit: cover; }
.dropzone-area .dz-preview .dz-details {
  font-size: 0.75rem;
  color: var(--text-main);
  padding: 4px 0;
}
.dropzone-area .dz-preview .dz-filename {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropzone-area .dz-error-message {
  color: #C0392B;
  font-size: 0.76rem;
  margin-top: 4px;
}

.dz-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 4px 0;
}
.btn-dz-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn-dz-submit:hover { opacity: 0.9; }
.btn-dz-cancel {
  background: #fff;
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.86rem;
  cursor: pointer;
}
.btn-dz-cancel:hover { background: rgba(0, 0, 0, 0.03); color: var(--text-main); }

.BiruChatFormDynamic:has(.dropzone-box:not(.d-none)) {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0 4px;
}
.BiruChatFormDynamic:has(.dropzone-box:not(.d-none)) .userInputDynamic,
.BiruChatFormDynamic:has(.dropzone-box:not(.d-none)) button.submit,
.BiruChatFormDynamic:has(.dropzone-box:not(.d-none)) .options {
  display: none !important;
}

.chat-photo-bubble { display: flex; flex-direction: column; gap: 6px; }
.chat-photo-bubble img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border-soft);
  display: block;
}
.chat-photo-bubble .photo-name { font-size: 0.75rem; color: var(--text-muted); }

.stage-footer-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding-top: 8px;
  flex-shrink: 0;
  line-height: 1.4;
}

.footer-shield-icon {
  display: inline-block;
  font-size: 0.88em;
  margin-right: 4px;
  vertical-align: -1px;
}

.footer-biru-link {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.2s ease;
}

.footer-biru-link:hover {
  opacity: 0.8;
}

@media (max-width: 768px) {
  .chat-sidebar { display: none; }
  .message { max-width: 88%; }
  .vertical-align .container { padding: 6px 10px 10px 10px; }
  .stage-footer-hint {
    padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));
  }
}

/* =========================================================================
 * SUMMARY PREVIEW BUBBLE STYLES (Clean, Human-Readable, Mobile-Optimized)
 * ========================================================================= */
.summary-full-row {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 10px 0 !important;
  padding: 0 !important;
  align-self: stretch !important;
  animation: slideUpFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-sizing: border-box;
}

.summary-full-row .chat-summary-bubble {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box;
}

.chat-summary-bubble {
  background: #FFFFFF;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 0.92rem;
  line-height: 1.5;
  width: 100%;
  box-shadow: 0 6px 20px rgba(43, 38, 32, 0.05);
  box-sizing: border-box;
}

.summary-bubble-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  color: var(--accent);
  font-size: 1.05rem;
  margin-bottom: 6px;
}
.summary-bubble-header .summary-header-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.summary-intro-text {
  font-size: 0.92rem;
  color: var(--text-main);
  margin-bottom: 12px;
  line-height: 1.5;
  font-weight: 500;
}

/* Scrollable List for Summary QA Items */
.summary-items-scroll {
  max-height: 48vh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 4px 8px 0;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.summary-item {
  background: #FAF8F4;
  border: 1px solid rgba(225, 219, 203, 0.7);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.summary-item:hover {
  background: #F5EFE6;
  border-color: var(--accent);
}

.summary-item-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.summary-item-label::before {
  content: '•';
  color: var(--accent);
  font-size: 1rem;
  line-height: 0.8;
}

.summary-item-val {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
  white-space: pre-line;
  line-height: 1.5;
  padding-left: 10px;
}

.summary-val-empty {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}

.summary-thumb-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding-left: 10px;
}

.summary-thumb {
  max-width: 72px;
  max-height: 72px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.summary-thumb:hover {
  transform: scale(1.04);
}

.summary-file-name {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.summary-bubble-closing {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(194, 112, 61, 0.07);
  border-left: 3.5px solid var(--accent);
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.55;
  font-weight: 500;
}

/* Embedded Redirect Box inside Summary */
.summary-redirect-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

/* =========================================================================
 * REDIRECT & CLOSING CARD STYLES (Versi Semua: Desktop & Mobile)
 * ========================================================================= */
.chat-redirect-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #FAF7F2 100%);
  border: 1.5px solid var(--border-soft);
  border-radius: 20px;
  padding: 22px 20px;
  margin: 4px 0;
  box-shadow: 0 8px 26px rgba(43, 38, 32, 0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}

.chat-redirect-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, #D48858 50%, var(--accent) 100%);
}

.redirect-badge-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 2px;
}

.redirect-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(194, 112, 61, 0.12);
  color: var(--accent);
  border: 1px solid rgba(194, 112, 61, 0.25);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
}

.redirect-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
  margin: 0;
}

.redirect-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  max-width: 440px;
}

.redirect-actions-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.btn-redirect-action {
  width: 100%;
  max-width: 360px;
  background: var(--accent);
  color: #FFFFFF !important;
  text-decoration: none !important;
  padding: 13px 22px;
  border-radius: 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  box-shadow: 0 5px 18px rgba(194, 112, 61, 0.32);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.btn-redirect-action:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(194, 112, 61, 0.42);
  color: #FFFFFF !important;
}

.btn-redirect-action:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(194, 112, 61, 0.25);
}

.btn-redirect-action .btn-arrow {
  font-size: 1.15rem;
  transition: transform 0.2s ease;
  line-height: 1;
}

.btn-redirect-action:hover .btn-arrow {
  transform: translate(3px, -2px);
}

.btn-redirect-reset {
  background: #FFFFFF;
  color: var(--text-main) !important;
  border: 1.5px solid var(--border-soft);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.btn-redirect-reset:hover {
  background: #FAF7F2;
  border-color: var(--accent);
  color: var(--accent) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.redirect-countdown {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}

.redirect-countdown .countdown-sec {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 700;
  border-radius: 50%;
  font-size: 0.75rem;
}

/* Mobile Responsive Optimization for Summary & Redirect */
@media (max-width: 768px) {
  .message-row.to:has(.chat-summary-bubble),
  .message-row.to:has(.chat-redirect-card) {
    max-width: 98% !important;
    width: 98% !important;
  }
  .chat-summary-bubble {
    padding: 14px 12px;
    border-radius: 16px;
  }
  .summary-items-scroll {
    max-height: 44vh;
  }
  .summary-item {
    padding: 9px 12px;
  }
  .btn-redirect-action {
    width: 100%;
    max-width: 100%;
    padding: 12px 16px;
    font-size: 0.94rem;
  }
  .chat-redirect-card {
    padding: 18px 16px;
    border-radius: 16px;
  }
}
