/* ============================================
   ABROADREADY.ORG — Tools Specific Styles (AI Advisor & SOP Builder)
   ============================================ */

.tool-layout {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chat Layout */
.chat-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-6);
  padding: var(--space-6);
  height: calc(100vh - 69px); /* Full viewport minus the non-sticky navbar */
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Tool pages are full-viewport apps — keep the site header in normal flow,
   not sticky, so it never overlaps the chat area. */
.tool-layout .site-header {
  position: relative;
  top: auto;
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.context-pill {
  background: var(--bg-blue);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  border: 1.5px solid var(--border-blue);
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.context-pill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 1;
}

.context-pill:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.chat-suggestion {
  background: var(--bg-green);
  border: 1.5px solid var(--border-green);
  color: #047857;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  text-align: left;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: var(--transition-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.chat-suggestion::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--gradient-forest);
}

.chat-suggestion:hover {
  background: var(--bg-green-medium);
  transform: translateX(4px);
  box-shadow: var(--shadow-green);
  border-color: var(--forest-light);
}

.chat-main {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Message Bubbles */
.message {
  display: flex;
  gap: var(--space-3);
  max-width: 80%;
}

.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.user-message .msg-avatar {
  background: var(--gradient-gold);
}

.msg-bubble {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  line-height: 1.5;
}

.ai-message .msg-bubble {
  background: var(--bg-blue);
  border: 1.5px solid var(--border-blue);
  border-top-left-radius: 0;
  color: var(--ink);
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.ai-message .msg-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 1;
}

.ai-message .msg-bubble:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-blue);
}

.user-message .msg-bubble {
  background: var(--primary);
  color: white;
  border-top-right-radius: 0;
}

.msg-bubble p {
  margin-bottom: var(--space-2);
}

.msg-bubble p:last-child {
  margin-bottom: 0;
}

.msg-bubble ul {
  padding-left: var(--space-4);
  margin-bottom: var(--space-2);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--primary-light);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

/* Chat Input */
.chat-input-area {
  padding: var(--space-4) var(--space-6);
  background: var(--paper);
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

.chat-form {
  position: relative;
}

.chat-form .form-input {
  border-color: rgba(0,0,0,0.1);
  padding-right: 60px;
}

@media (max-width: 768px) {
  .chat-container { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .message { max-width: 95%; }
}

/* Assistant result cards */
.chat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.chat-card { background: white; border: 1.5px solid var(--border-teal); border-radius: var(--radius-md); padding: 12px; transition: var(--transition-fast); position: relative; overflow: hidden; }
.chat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(135deg, #14b8a6, #2dd4bf); opacity: 1; }
.chat-card:hover { border-color: #2dd4bf; box-shadow: var(--shadow-teal); transform: translateY(-2px); }
.cc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cc-flag { display: flex; align-items: center; }
.cc-flag img { border-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.cc-status { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 2px 8px; border-radius: var(--radius-full); }
.cc-status.st-open { background: rgba(16,185,129,0.12); color: #047857; }
.cc-status.st-closing { background: rgba(244,63,94,0.12); color: #be123c; }
.cc-status.st-rolling { background: rgba(139,92,246,0.12); color: #6d28d9; }
.cc-status.st-closed { background: rgba(107,114,128,0.12); color: #4b5563; }
.cc-status.st-upcoming { background: rgba(245,158,11,0.12); color: #92400e; }
.cc-heart { margin-left: auto; border: none; background: none; cursor: pointer; font-size: 1.15rem; color: #cbd5e1; line-height: 1; }
.cc-heart:hover, .cc-heart.is-saved { color: var(--accent); }
.cc-name { font-weight: 700; font-size: var(--text-sm); color: var(--ink); line-height: 1.25; margin-bottom: 3px; }
.cc-meta { font-size: var(--text-xs); color: #64748b; margin-bottom: 8px; }
.cc-link { font-size: var(--text-xs); font-weight: 700; color: var(--primary-dark); text-decoration: none; }
.cc-link:hover { text-decoration: underline; }
@media (max-width: 600px) { .chat-cards { grid-template-columns: 1fr; } }

/* ============================================
   AI ADVISOR 2.0 — POLISH
   ============================================ */

.chat-sidebar {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
}

.ai-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.ai-avatar {
  width: 54px; height: 54px; border-radius: 16px;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}
.ai-avatar .robo, .chat-head-avatar .robo, .msg-avatar .robo { width: 26px; height: 26px; color: #fff; }
.ai-title { font-size: 1.05rem; line-height: 1.25; margin: 0 0 4px; color: var(--ink); }
.ai-sub { font-size: var(--text-xs); line-height: 1.5; color: #64748b; margin: 0; }

.ai-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 22px; }
.ai-stat {
  background: var(--bg-blue); border: 1.5px solid var(--border-blue);
  border-radius: var(--radius-md); padding: 10px 6px; text-align: center;
}
.ai-stat span { display: block; font-weight: 800; font-size: 1.05rem; color: var(--primary-dark); line-height: 1.2; }
.ai-stat small { color: #64748b; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; }

.ai-side-h { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: #94a3b8; margin: 0 0 10px; }
.ai-chips { display: flex; flex-direction: column; gap: 8px; }
.ai-side-note { margin-top: 20px; padding-top: 14px; border-top: 1px dashed #e2e8f0; font-size: 0.72rem; color: #94a3b8; text-align: center; }

.quick-chip {
  white-space: nowrap;
  text-align: left;
  font-size: 0.74rem;
  font-weight: 600;
  color: #4f46e5;
  background: #fff;
  border: 1.5px solid var(--border-indigo);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.quick-chip:hover {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.chat-main {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  background: #fff;
}
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  background: var(--gradient-primary);
  color: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.chat-head-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center; color: #fff;
  flex-shrink: 0;
}
.chat-head-title { font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.chat-head-status { font-size: 0.74rem; opacity: 0.92; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.chat-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,0.25); animation: arPulse 1.8s infinite; }
.chat-head-badge { margin-left: auto; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.07em; background: rgba(255,255,255,0.2); padding: 4px 10px; border-radius: var(--radius-full); }
@keyframes arPulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(52,211,153,0.25); } 50% { box-shadow: 0 0 0 5px rgba(52,211,153,0.12); } }

.chat-messages {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  scrollbar-width: thin;
  scrollbar-color: #c7d2fe transparent;
}
.chat-messages::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: var(--radius-full); }
.chat-messages::-webkit-scrollbar-thumb:hover { background: #a5b4fc; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }

.msg-lead { border-left: 3px solid var(--primary); padding-left: 12px; }
.msg-lead p { margin-bottom: var(--space-2); }
.msg-lead p:last-child { margin-bottom: 0; }
.msg-extra { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d8dee9; }

.ai-message .msg-bubble {
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
}
.user-message .msg-bubble {
  background: var(--gradient-primary);
  box-shadow: var(--shadow-purple);
}
.msg-bubble a { color: var(--primary-dark); font-weight: 600; }
.user-message .msg-bubble a { color: #dbeafe; }

.chat-input-area {
  background: #fff;
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid #eef2f7;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.chat-form { display: flex; align-items: center; gap: 10px; }
.chat-form .form-input {
  flex: 1;
  border-radius: var(--radius-full);
  border: 1.5px solid #e2e8f0;
  padding: 12px 18px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(15,23,42,0.03);
  transition: all 0.15s ease;
}
.chat-form .form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(59,130,246,0.14); }
.chat-send {
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: var(--gradient-primary); color: #fff; font-size: 1.05rem;
  cursor: pointer; flex-shrink: 0;
  box-shadow: var(--shadow-glow);
  transition: all 0.15s ease;
}
.chat-send:hover { transform: translateY(-1px) scale(1.05); }
.chat-disclaimer { font-size: 0.7rem; color: #94a3b8; text-align: center; margin-top: 10px; }
