/* === Floating container & launcher === */
.rag-chat-container {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9999;
	bottom: calc(16px + env(safe-area-inset-bottom));
}

/* Launcher button */
.rag-launcher {
    width: 100px;
    height: 100px;
    border: 2px solid #111827;
    border-radius: 50%;
    background: #02c0ee00;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 1);
    display: grid;
    place-items: center;
}

    .rag-launcher:focus {
        outline: 2px solid #60a5fa;
        outline-offset: 2px;
    }

.rag-launcher-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #111827;
}

/* === Chat box === */
.rag-chat-box {
    position: absolute;
    right: 0;
    bottom: 110px;
    width: 340px;
    height: 480px;
    display: none;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
    transform: translateY(8px);
    opacity: 0;
    transition: all 0.25s ease;
    font-family: "Segoe UI", sans-serif;
}

.rag-chat-container.open .rag-chat-box {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* Responsive: Mobile */
@media (max-width: 480px) {
  .rag-chat-box {
    width: calc(100vw - 24px);
    right: -4px;
    bottom: 72px;
    height: 70vh;              /* fallback */
    height: 70dvh;             /* modern browsers */
  }
}

/* === Chat header === */
.rag-chat-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    color: #111827;
}

/* === Messages === */
.rag-chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    background: #ffffff;
}

.rag-chat-form {
	padding-bottom: calc(14px + env(safe-area-inset-bottom));
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	align-items: center;         /* keep them aligned center */
	padding: 14px;
	border-top: 1px solid #e5e7eb;
	background: #fafafa;
	-webkit-appearance: none;    /* iOS: neutralize default form styles */
}

#rag-input {
  flex: 1;
  height: 40px;                /* explicit height to match the button */
  padding: 10px 14px;
  border: 1px solid #131518;
  border-radius: 10px;
  font-size: 14px;
  min-width: 0;
  -webkit-appearance: none;
}

#rag-send {
	height: auto;
  min-height: 40px;           /* iOS friendly tap target */
  padding: 0 16px;
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  -webkit-appearance: none;   /* avoid odd default styling on iOS */
}

/* === Message bubbles === */
.rag-msg {
    padding: 10px 14px;
    border-radius: 18px;
    margin: 8px 0;
    max-width: 85%;
    width: fit-content;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

    .rag-msg.rag-bot {
        background: #02c0ee;
        color: #ffffff;
        border-top-left-radius: 0px;
    }

    .rag-msg.rag-user {
        background: #1d2327;
        color: #fafafa;
        margin-left: auto;
        border-top-right-radius: 0px;
    }

.rag-msg a {
    color: #2563eb; /* nice blue */
    text-decoration: underline;
    word-break: break-word;
}

.rag-msg a:hover {
    color: #1d4ed8; /* darker blue */
}
/* Optional: timestamps */
.rag-time {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

#rag-reset {
	height: auto;
	min-height: 40px;           /* iOS friendly tap target */
	padding: 0 16px;
	background: #111827;
	color: #fff;
	border: none;
	border-radius: 10px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	-webkit-appearance: none;
}

#rag-reset:hover {
    background: #dc2626;
}

/* === Nudging text bar (points to launcher) === */
.rag-textbar {
	text-align: center;
	height: 85px;
	width: 209px;
	position: absolute;
	right: 110px; /* sits left of the launcher */
	bottom: calc(env(safe-area-inset-bottom));
	background: #111827;
	color: #fff;
	padding: 10px 14px;
	border-radius: 9px;
	font-weight: 600;
	font-size: 14px;
	box-shadow: 0 12px 24px rgba(0,0,0,.32); /* nice, soft shadow */
	transform-origin: 100% 100%; /* "hinge" near the launcher side */
	animation: rag-sway 2.5s ease-in-out infinite;
	cursor: pointer;
	z-index: 10000; /* above everything in the container */
	user-select: none;
}

.rag-textbar::after {
	/* triangle pointer aimed at the launcher */
	content: "";
	position: absolute;
	right: -10px;
	top: 50%;
	transform: translateY(-50%);
	width: 0;
	height: 0;
	border-top: 8px solid transparent;
	border-bottom: 8px solid transparent;
	border-left: 10px solid #111827; /* same as bubble background */
	filter: drop-shadow(0 2px 3px rgba(0,0,0,.25));
}

@keyframes rag-sway {
	0%   { transform: rotate(0deg) translateY(0); }
	50%  { transform: rotate(-2.5deg) translateY(-10px); }
	100% { transform: rotate(0deg) translateY(0); }
}

/* hide class applied after click */
.rag-textbar--hidden { display: none; }

@media (max-width: 480px) {
  .rag-textbar {
    right: 86px;
    bottom: calc(28px + env(safe-area-inset-bottom));
    font-size: 13px;
    padding: 8px 12px;
  }
}

