/* Fidelity palette */
:root {
  --cwi-blue: #11237d;
  --cwi-green: #4dc247;
  --cwi-white: #e8e8e8;
  --cwi-deep-blue: #0b1a5a;
  --cwi-muted: #f5f7fb;
  --cwi-text: #0e1222;
  --cwi-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cwi-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 92px;
  height: 64px;
  border-radius: 50%;
  /* background: linear-gradient(135deg, var(--cwi-blue), var(--cwi-green)); */
  box-shadow: var(--cwi-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* color: var(--cwi-white); */
  cursor: pointer;
  z-index: 99998;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cwi-launcher:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
}

.cwi-launcher-image {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.cwi-launcher-badge {
  position: absolute;
  /* bottom: 64px; */
  background: var(--cwi-blue);
  color: var(--cwi-white);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  box-shadow: var(--cwi-shadow);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.cwi-launcher-badge-text {
  color: var(--cwi-white);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 6px 8px;
  border-radius: 6px;
  box-shadow: var(--cwi-shadow);
  /* float: left; */
  background: linear-gradient(122deg, var(--cwi-blue), var(--cwi-green));
}
.cwi-launcher:hover .cwi-launcher-badge {
  opacity: 1;
  transform: translateY(0);
}
/* .cwi-chat {
	position: fixed;
	top: 0;
	bottom: 0;
	right: 0; 
	width: min(550px, calc(100vw - 32px));
	height: 80vh; 
	background: var(--cwi-white);
	border-radius: 0; 
	box-shadow: var(--cwi-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 99999;
}


@media (max-width: 580px) {
  .cwi-chat {
    width: min(450px, calc(100vw - 32px));
    height: 79vh;
    border-radius: 0;
    right: 0;
    left: 0;
  }
} */

/* Main chat container */
/* .cwi-chat {
	position: fixed;
	top: 10px;
	right: 10px;
	width: min(90vw, 480px);
	max-width: min(90vw, 480px); 
	height: 78vh;          
	background: var(--cwi-white);
	border-radius: 12px;
	box-shadow: var(--cwi-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 99999;
} */

/* Mobile-first adjustment */
/* @media (max-width: 600px) {
  .cwi-chat {
    left: 10px;  
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    height: 85vh; 
    border-radius: 10px;
  }
}  */

.cwi-chat {
  position: fixed;
  top: 0; /* stick to top */
  right: 0;
  left: auto;
  width: min(90vw, 450px); /* responsive width */
  height: 72.8vh; /* almost full height */
  max-height: 100vh;
  background: var(--cwi-white);
  border-radius: 12px 12px 0 12px; /* rounded only at bottom */
  box-shadow: var(--cwi-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
}

/* Mobile adjustment */
@media (max-width: 600px) {
  .cwi-chat {
    left: 0;
    right: 0;
    width: 78vw; /* take full width on small screens */
    height: 77vh; /* nearly full height */
    border-radius: 12px 12px 0 12px; /* full screen look */
  }
}

.cwi-header {
  background: linear-gradient(90deg, var(--cwi-blue), var(--cwi-deep-blue));
  color: var(--cwi-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 3px solid var(--cwi-green);
}

.cwi-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cwi-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cwi-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.cwi-title-group {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.cwi-title {
  font-weight: 700;
  font-size: 15px;
}

.cwi-subtitle {
  opacity: 0.8;
  font-size: 12px;
}

.cwi-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cwi-btn {
  background: transparent;
  border: 1px solid rgba(239, 56, 56, 0.4);
  color: var(--cwi-white);
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  font-size: 18px;
}
.cwi-btn2 {
  background: transparent;
  border: 1px solid rgba(56, 239, 71, 0.4);
  color: var(--cwi-white);
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  font-size: 18px;
}

.cwi-btn:hover {
  background: rgba(239, 56, 56, 0.822);
  transform: translateY(-1px);
}
.cwi-btn2:hover {
  background: rgba(56, 239, 71, 0.284);
  transform: translateY(-1px);
}

.cwi-suggested {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 10px 10px 10px;
  background: var(--cwi-muted);
  border-top: 1px solid #e6e9f2;
}

.cwi-suggested .cwi-chip {
  background: var(--cwi-white);
  border: 1px solid #e6e9f2;
  border-left: 3px solid var(--cwi-green);
  color: var(--cwi-text);
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.cwi-suggested .cwi-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.cwi-messages {
  flex: 1;
  padding: 14px 12px;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  overflow-y: auto;
}

/* Embedded iframe container */
.cwi-embed {
  position: relative;
  flex: 1;
  width: 100%;
  background: #ffffff;
}

.cwi-embed .swal2-container {
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.cwi-embed .swal2-popup {
  font-size: 14px; /* smaller text */
  /* padding: 1rem;       */
  width: 280px !important; /* smaller width */
  height: 300px !important; /* smaller width */
  max-width: 90%; /* keep responsive on small screens */
  border-radius: 8px; /* optional rounded look */
}

.cwi-embed-frame {
  /* width: 100%;
	height: 100%;
	border: 0;
	display: block; */
  width: 100%;
  height: 100%;

  border: none;
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Typing indicator */
.cwi-msg.cwi-typing {
  background: #eef6ff;
  color: #0e2a5e;
  border-left: 3px solid var(--cwi-green);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cwi-typing-text {
  font-size: 12px;
  opacity: 0.8;
}

.cwi-dot {
  width: 6px;
  height: 6px;
  background: #0e2a5e;
  border-radius: 50%;
  display: inline-block;
  opacity: 0.5;
  animation: cwi-bounce 1s infinite ease-in-out;
}

.cwi-typing .cwi-dot:nth-of-type(1) {
  animation-delay: 0s;
}
.cwi-typing .cwi-dot:nth-of-type(2) {
  animation-delay: 0.15s;
}
.cwi-typing .cwi-dot:nth-of-type(3) {
  animation-delay: 0.3s;
}

@keyframes cwi-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.cwi-msg {
  display: inline-flex;
  max-width: 88%;
  margin: 6px 0;
  padding: 10px 12px;
  border-radius: 14px;
  line-height: 1.35;
  font-size: 14px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.cwi-msg.user {
  background: var(--cwi-blue);
  color: var(--cwi-white);
  border-bottom-right-radius: 4px;
  margin-left: auto;
  float: right;
}

.cwi-msg.bot {
  background: #eef6ff;
  color: #0e2a5e;
  border-left: 3px solid var(--cwi-green);
  border-bottom-left-radius: 4px;
}

.cwi-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px 12px;
  border-top: 1px solid #e6e9f2;
  background: #fafcff;
}

.cwi-text {
  flex: 1;
  border: 1px solid #e1e6f2;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cwi-text:focus {
  border-color: var(--cwi-green);
  box-shadow: 0 0 0 3px rgba(77, 194, 71, 0.18);
}

.cwi-send {
  background: var(--cwi-green);
  color: var(--cwi-white);
  border: none;
  border-radius: 12px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.1s ease;
  cursor: pointer;
}

.cwi-send:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.cwi-send:active {
  transform: translateY(0);
}

/* Visibility helpers */
.cwi-hidden {
  display: none !important;
}
.cwi-chat[hidden] {
  display: none !important;
}
.cwi-chat.cwi-hidden {
  display: none !important;
}
