/* =============================================================================
   FlexiFocus — ARIA Widget Styles
   Add to your static/css folder or paste into your main stylesheet.
   ============================================================================= */

/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --aria-red: #8B1A2B;
  --aria-red-dark: #6B1420;
  --aria-red-light: #f9f0f1;
  --aria-green: #4CAF50;
  --aria-radius: 16px;
  --aria-z: 9999;
  --aria-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
}

/* ─── Trigger button ─────────────────────────────────────────────────────────── */
#aria-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: var(--aria-z);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--aria-red);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 22px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 18px rgba(139, 26, 43, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

#aria-trigger:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 22px rgba(139, 26, 43, 0.55);
}

#aria-trigger svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.aria-live-dot {
  width: 8px;
  height: 8px;
  background: var(--aria-green);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ─── Panel ──────────────────────────────────────────────────────────────────── */
#aria-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: var(--aria-z);
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 56px);
  background: #fff;
  border-radius: var(--aria-radius);
  border: 0.5px solid #ddd;
  box-shadow: var(--aria-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Header ─────────────────────────────────────────────────────────────────── */
.aria-header {
  background: var(--aria-red);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.aria-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.aria-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.aria-avatar svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
}

.aria-name {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0.5px;
}

.aria-subtitle {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.aria-live-badge {
  background: var(--aria-green);
  color: #fff;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

#aria-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
  flex-shrink: 0;
}

#aria-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

#aria-close svg {
  width: 16px;
  height: 16px;
}

/* ─── Mode toggle bar ────────────────────────────────────────────────────────── */
.aria-mode-bar {
  background: #f5f5f5;
  border-bottom: 0.5px solid #e5e5e5;
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.aria-mode-btn {
  flex: 1;
  padding: 7px 4px;
  border: 0.5px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  color: #666;
  transition: all 0.15s;
  font-family: inherit;
  line-height: 1.3;
}

.aria-mode-btn:hover {
  border-color: var(--aria-red);
  color: var(--aria-red);
}

.aria-mode-btn.aria-mode-active {
  background: var(--aria-red);
  border-color: var(--aria-red);
  color: #fff;
}

/* ─── Messages area ──────────────────────────────────────────────────────────── */
#aria-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #fafafa;
  scroll-behavior: smooth;
}

#aria-messages::-webkit-scrollbar { width: 4px; }
#aria-messages::-webkit-scrollbar-track { background: transparent; }
#aria-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* Welcome */
.aria-welcome-text {
  text-align: center;
  font-size: 13px;
  color: #888;
  margin: 6px 0 16px;
  line-height: 1.55;
}

.aria-suggestions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.aria-suggestion {
  background: #fff;
  border: 0.5px solid #e5e5e5;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
  font-size: 12.5px;
  color: #333;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}

.aria-suggestion:hover {
  border-color: var(--aria-red);
  background: var(--aria-red-light);
  color: var(--aria-red-dark);
}

/* Message rows */
.aria-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.aria-msg-row--user {
  flex-direction: row-reverse;
}

.aria-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--aria-red);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.aria-msg-avatar svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
}

/* Bubbles */
.aria-bubble {
  max-width: 80%;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
}

.aria-bubble--user {
  background: var(--aria-red);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}

.aria-bubble--assistant {
  background: #fff;
  color: #222;
  border-radius: 14px 14px 14px 4px;
  border: 0.5px solid #e5e5e5;
}

/* Confidence badges inside assistant bubbles */
.aria-badge {
  display: inline-block;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 700;
  margin-top: 6px;
}

.aria-badge--high {
  background: #e8f5e9;
  color: #1b5e20;
}

.aria-badge--medium {
  background: #fff8e1;
  color: #7b5800;
}

.aria-badge--review {
  background: #fce4ec;
  color: #880e4f;
}

/* Typing indicator */
.aria-typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.aria-dot {
  width: 7px;
  height: 7px;
  background: var(--aria-red);
  border-radius: 50%;
  display: inline-block;
  animation: aria-bounce 1.3s ease-in-out infinite;
}

.aria-dot:nth-child(2) { animation-delay: 0.2s; }
.aria-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes aria-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* ─── Input area ─────────────────────────────────────────────────────────────── */
.aria-input-area {
  padding: 10px 14px 8px;
  border-top: 0.5px solid #e5e5e5;
  background: #fff;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

#aria-input {
  flex: 1;
  border: 0.5px solid #ccc;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.5;
  color: #222;
  background: #fff;
  transition: border-color 0.15s;
}

#aria-input:focus {
  border-color: var(--aria-red);
}

#aria-input::placeholder {
  color: #aaa;
}

#aria-send {
  background: #e5e5e5;
  border: none;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  cursor: not-allowed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s;
}

#aria-send:not(:disabled) {
  background: var(--aria-red);
  cursor: pointer;
}

#aria-send:not(:disabled):hover {
  background: var(--aria-red-dark);
}

#aria-send svg {
  width: 15px;
  height: 15px;
  stroke: #fff;
}

#aria-send:disabled svg {
  stroke: #aaa;
}

/* ─── Disclaimer ─────────────────────────────────────────────────────────────── */
.aria-disclaimer {
  padding: 4px 14px 10px;
  font-size: 10.5px;
  color: #aaa;
  text-align: center;
  background: #fff;
  line-height: 1.4;
  flex-shrink: 0;
}

/* ─── Mobile ─────────────────────────────────────────────────────────────────── */
@media (max-width: 460px) {
  #aria-panel,
  #aria-trigger {
    bottom: 16px;
    right: 16px;
  }

  #aria-panel {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
  }
}
