/* ═══════════════════════════════════════════════════════════════════
   ARIA FLOATING CHAT — v4
   Compact: bottom-right modal (320px)
   Expanded: taller/wider bottom-right modal (480px, near full height)
   Mobile: bottom sheet (portrait) / full screen (landscape)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Suppress old sidebar from style.css ── */
@media (min-width: 1101px) { .aria-sidebar { display: none !important; } }
@media (min-width: 769px) and (max-width: 1100px) { .aria-sidebar { display: none !important; } }

/* ─────────────────────────────────────────────────────────────────
   FLOATING BUBBLE
   ───────────────────────────────────────────────────────────────── */

.aria-bubble {
  position: fixed !important;
  bottom: 2rem;
  right: 1.5rem;
  z-index: 9000;
  display: block !important;
}

.aria-bubble-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 0, 110, 0.35);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(255,0,110,0.15);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  padding: 0;
  overflow: hidden;
  animation: aria-bubble-pulse 3s ease-in-out infinite;
}

@keyframes aria-bubble-pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(255,0,110,0.15); }
  50%       { box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 30px rgba(255,0,110,0.3); }
}

.aria-bubble-icon:hover {
  transform: scale(1.12);
  border-color: rgba(255, 0, 110, 0.6);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 30px rgba(255,0,110,0.35);
}

.aria-bubble-icon:active { transform: scale(0.95); }

/* ─────────────────────────────────────────────────────────────────
   FLOATING CHAT WINDOW — compact (320px bottom-right)
   ───────────────────────────────────────────────────────────────── */

.aria-chat-window {
  position: fixed;
  z-index: 9001;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;

  /* Glass effect */
  background: rgba(10, 10, 18, 0.68);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    0 24px 80px rgba(0,0,0,0.55),
    0 0 40px rgba(255,0,110,0.07),
    inset 0 0 0 1px rgba(255,255,255,0.05),
    inset 0 1px 0 rgba(255,255,255,0.08);

  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.aria-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Desktop compact */
@media (min-width: 769px) {
  .aria-chat-window {
    bottom: 2rem;
    right: 1.5rem;
    width: 320px;
    height: 540px;
    border-radius: 20px;
  }
}

/* Mobile portrait — bottom sheet */
@media (max-width: 768px) {
  .aria-chat-window {
    bottom: 0;
    left: 0;
    right: 0;
    height: 75vh;
    width: 100% !important;
    max-width: 100vw;
    border-radius: 20px 20px 0 0;
  }

  #aria-input { font-size: 16px; }
}

/* Mobile landscape — full screen, input always visible */
@media (max-height: 500px) and (orientation: landscape) {
  .aria-chat-window {
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
  }

  .aria-messages {
    max-height: calc(100vh - 130px);
    overflow-y: auto;
  }

  .aria-input-area {
    flex-shrink: 0;
  }
}

/* ─────────────────────────────────────────────────────────────────
   EXPANDED MODE — taller/wider, same position bottom-right
   ───────────────────────────────────────────────────────────────── */

@media (min-width: 769px) {
  .aria-chat-window.aria-expanded {
    bottom: 2rem;
    right: 1.5rem;
    width: 480px !important;
    height: calc(100vh - 4rem) !important;
    border-radius: 20px;
    z-index: 9003;
  }
}

@media (max-width: 768px) {
  .aria-chat-window.aria-expanded {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh !important;
    width: 100% !important;
    border-radius: 0;
    z-index: 9003;
  }
}

/* Larger font in expanded mode */
.aria-chat-window.aria-expanded .aria-message {
  font-size: 0.94rem;
  line-height: 1.65;
}

/* ─────────────────────────────────────────────────────────────────
   CHAT HEADER
   ───────────────────────────────────────────────────────────────── */

.aria-chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.aria-chat-header-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: contain;
}

.aria-chat-header-info {
  flex: 1;
  min-width: 0;
}

.aria-chat-header-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.5px;
}

.aria-chat-header-topic {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aria-header-btns {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.aria-chat-close,
.aria-chat-expand {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.aria-chat-close:hover {
  background: rgba(255, 80, 80, 0.15);
  border-color: rgba(255, 80, 80, 0.3);
  color: #ff5050;
}

.aria-chat-expand:hover {
  background: rgba(0, 255, 245, 0.1);
  border-color: rgba(0, 255, 245, 0.3);
  color: #00fff5;
}

.aria-chat-expand.is-expanded {
  background: rgba(0, 255, 245, 0.1);
  border-color: rgba(0, 255, 245, 0.3);
  color: #00fff5;
}

/* ─────────────────────────────────────────────────────────────────
   MESSAGES AREA
   ───────────────────────────────────────────────────────────────── */

.aria-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.aria-messages::-webkit-scrollbar { width: 5px; }
.aria-messages::-webkit-scrollbar-track { background: transparent; }
.aria-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.aria-messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

.aria-message p {
  margin: 0 0 0.4rem;
  line-height: 1.55;
}
.aria-message p:last-child { margin-bottom: 0; }

.aria-message ul,
.aria-message ol {
  padding-left: 1.2rem;
  margin: 0.2rem 0 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.aria-message li {
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

.aria-message strong { opacity: 0.95; }

.aria-message code {
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-family: 'Source Code Pro', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 0.82em;
}

.aria-message pre.aria-code-block {
  background: rgba(0,0,0,0.4);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0.4rem 0;
  overflow-x: auto;
  font-size: 0.82em;
  line-height: 1.5;
}

.aria-message pre.aria-code-block code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 1em;
}

.aria-message {
  padding: 0.7rem 1rem;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  word-wrap: break-word;
  animation: aria-msg-in 0.25s ease-out;
  max-width: 85%;
}

@keyframes aria-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.aria-message.aria-text {
  background: linear-gradient(135deg, #ff0a72 0%, #f20086 100%);
  color: #ffffff;
  border: none;
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}

.aria-message.user-text {
  background: linear-gradient(135deg, #7b2cff 0%, #6c28e8 100%);
  color: #ffffff;
  border: none;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}

.aria-context-divider {
  text-align: center;
  padding: 0.6rem 0;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0.5rem 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.aria-topic-btn {
  background: linear-gradient(135deg, #ff006e, #BC244A);
  border: none;
  color: #fff;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  margin: 0.3rem 0;
  display: inline-block;
  font-family: 'Outfit', sans-serif;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(255,0,110,0.2);
}

.aria-topic-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255,0,110,0.3);
}

/* ─────────────────────────────────────────────────────────────────
   INPUT AREA
   ───────────────────────────────────────────────────────────────── */

.aria-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

#aria-input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: 0.2s;
}

#aria-input:focus {
  background: rgba(255,255,255,0.07);
  border-color: #ff006e;
  box-shadow: 0 0 10px rgba(255,0,110,0.25);
}

#aria-input::placeholder { color: rgba(255,255,255,0.25); }

#aria-send {
  background: linear-gradient(135deg, #ff006e, #BC244A);
  border: none;
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 1rem;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255,0,110,0.2);
}

#aria-send:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255,0,110,0.35);
}

#aria-send:active:not(:disabled) { transform: translateY(0); }
#aria-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─────────────────────────────────────────────────────────────────
   TEXT SELECTION PILL
   ───────────────────────────────────────────────────────────────── */

.aria-selection-pill {
  position: fixed;
  z-index: 9500;
  background: linear-gradient(135deg, #ff006e, #BC244A);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(255,0,110,0.35);
  display: none;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
  pointer-events: auto;
}

.aria-selection-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,0,110,0.5);
}

.aria-selection-pill.visible { display: flex; }

/* ─────────────────────────────────────────────────────────────────
   EXAM MODE
   ───────────────────────────────────────────────────────────────── */

body.exam-mode #aria-bubble,
body.exam-mode #aria-chat-window,
body.exam-mode .aria-selection-pill {
  display: none !important;
}

/* ─────────────────────────────────────────────────────────────────
   MOBILE — Hide hero images, show topic title
   ───────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {

  .content-block img {
    display: none;
  }

  .content-container h1 {
    display: block !important;
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    padding-top: 0.5rem;
  }

}
