/* ═══════════════════════════════════════════════════════════════════════════
   LAYER 3 FEATURE COMPONENT: OracleChatHub (`components/chat/OracleChatHub.css`)
   Dedicated Oracle AI Chat Studio modeled on AtletIQ (`CoachChatTab.module.css`
   & `CoachChatSidebar.module.css` & `CoachChatMessageList.module.css`)
   ═══════════════════════════════════════════════════════════════════════════ */

.atq-chat-page {
  padding: 20px 24px 32px;
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.atq-chat-container {
  display: flex;
  height: calc(100dvh - 122px);
  min-height: 600px;
  max-height: 880px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 40%, rgba(0, 0, 0, 0.5) 100%), rgba(14, 16, 22, 0.94);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  overflow: hidden;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.atq-chat-mobile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 40;
}

/* ─── LEFT CONVERSATION SIDEBAR (280px) ──────────────────────────────────── */
.atq-chat-sidebar {
  width: 288px;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(6, 8, 13, 0.55);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 50;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.atq-sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.atq-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.atq-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.atq-sparkles-box {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25) 0%, rgba(59, 130, 246, 0.2) 100%);
  border: 1px solid rgba(56, 189, 248, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  flex-shrink: 0;
}

.atq-sidebar-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.atq-sidebar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.atq-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.atq-icon-btn:hover,
.atq-icon-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.atq-icon-btn-danger:hover {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fb7185;
}

.atq-new-chat-btn {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22) 0%, rgba(59, 130, 246, 0.22) 100%);
  border: 1px solid rgba(56, 189, 248, 0.42);
  border-radius: 8px;
  color: #38bdf8;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.atq-new-chat-btn:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.32) 0%, rgba(59, 130, 246, 0.32) 100%);
  color: #ffffff;
}

.atq-search-wrap {
  margin-top: 10px;
}

.atq-search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  padding: 7px 11px;
  color: #ffffff;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
}

.atq-search-input:focus {
  border-color: rgba(56, 189, 248, 0.55);
}

.atq-sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.atq-sec-label {
  font-size: 10px;
  font-weight: 800;
  color: #38bdf8;
  padding: 6px 8px 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 5px;
}

.atq-sec-label.muted {
  color: #64748b;
}

.atq-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.15s ease;
}

.atq-session-row:hover {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.1);
}

.atq-session-row.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16) 0%, rgba(59, 130, 246, 0.09) 100%);
  border-color: rgba(56, 189, 248, 0.36);
}

.atq-session-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.atq-session-icon {
  color: #64748b;
  flex-shrink: 0;
  display: inline-flex;
}

.atq-session-row.active .atq-session-icon {
  color: #38bdf8;
}

.atq-session-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.atq-session-row.active .atq-session-title {
  font-weight: 700;
  color: #ffffff;
}

.atq-session-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0.72;
  transition: opacity 0.15s ease;
}

.atq-session-row:hover .atq-session-actions,
.atq-session-row.active .atq-session-actions {
  opacity: 1;
}

.atq-inline-act {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.atq-inline-act:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.atq-inline-act.pinned {
  color: #38bdf8;
}

.atq-inline-act.danger:hover {
  background: rgba(244, 63, 94, 0.18);
  color: #fb7185;
}

.atq-rename-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.atq-rename-input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 6px;
  color: #ffffff;
  font-size: 12px;
  padding: 4px 7px;
  outline: none;
}

.atq-sidebar-empty {
  padding: 42px 16px;
  text-align: center;
  color: #64748b;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.atq-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

/* ─── MAIN CHAT AREA ─────────────────────────────────────────────────────── */
.atq-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.atq-chat-topbar {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(6, 8, 14, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.atq-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.atq-mobile-history-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.atq-active-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.atq-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.atq-meter-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
}

/* ─── MESSAGES STREAM & ATLETIQ EMPTY HERO ───────────────────────────────── */
.atq-chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.atq-chat-hero {
  margin: auto;
  max-width: 660px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 8px;
}

.atq-hero-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22) 0%, rgba(59, 130, 246, 0.16) 100%);
  border: 1px solid rgba(56, 189, 248, 0.42);
  box-shadow: 0 12px 32px rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
}

.atq-hero-title {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.025em;
}

.atq-hero-subtitle {
  margin: 0;
  font-size: 13.5px;
  color: #94a3b8;
  line-height: 1.5;
  max-width: 520px;
}

.atq-prompts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.atq-prompt-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
  color: #f8fafc;
}

.atq-prompt-card:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.38);
  transform: translateY(-2px);
}

.atq-prompt-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.atq-prompt-label {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 3px;
}

.atq-prompt-sub {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.35;
}

/* ─── ATTACHED NEWS CONTEXT BANNER ───────────────────────────────────────── */
.atq-news-context-banner {
  background: linear-gradient(135deg, rgba(29, 155, 240, 0.12) 0%, rgba(15, 23, 42, 0.75) 100%);
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 14px;
  padding: 11px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

.atq-news-context-meta {
  font-size: 11px;
  font-weight: 800;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.atq-news-context-text {
  font-size: 12.5px;
  color: #e2e8f0;
  line-height: 1.4;
}

/* ─── MESSAGE BUBBLES ────────────────────────────────────────────────────── */
.atq-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  gap: 5px;
}

.atq-msg-row.user {
  align-self: flex-end;
  align-items: flex-end;
}

.atq-msg-row.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.atq-msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

.atq-msg-bubble {
  padding: 13px 16px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.atq-msg-row.user .atq-msg-bubble {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}

.atq-msg-row.assistant .atq-msg-bubble {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: #f1f5f9;
  border-bottom-left-radius: 4px;
}

.atq-msg-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.atq-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.atq-copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* ─── BOTTOM INPUT BAR (`CoachChatInputBar` style) ───────────────────────── */
.atq-input-footer {
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(8, 10, 16, 0.72);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.atq-input-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 19, 30, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 8px 10px 8px 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.atq-input-pill:focus-within {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.atq-text-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 13.5px;
  min-width: 0;
}

.atq-text-input::placeholder {
  color: #64748b;
}

.atq-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: none;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.32);
  transition: all 0.15s ease;
}

.atq-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.atq-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 860px) {
  .atq-chat-page {
    padding: 10px 10px 92px;
  }

  .atq-chat-container {
    height: calc(100dvh - 150px);
    min-height: 460px;
    border-radius: 18px;
  }

  .atq-chat-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    background: #0d1018;
    transform: translateX(-100%);
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.8);
  }

  .atq-chat-sidebar.open-mobile {
    transform: translateX(0);
  }

  .atq-mobile-history-btn {
    display: inline-flex;
  }

  .atq-prompts-grid {
    grid-template-columns: 1fr;
  }

  .atq-chat-feed {
    padding: 16px;
  }
}
