/* Sreejith AI portfolio chatbot — scoped so it does not alter portfolio UI */
.chat-toggle,
.chat-widget,
.chat-widget * {
  box-sizing: border-box;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.chat-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999999;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: #ff2a2a;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(255, 42, 42, .30);
}

.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 82px;
  z-index: 1000000;
  width: min(360px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 102px));
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  color: #f4f4f4;
  background: #101010;
  border: 1px solid #303030;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .72);
  isolation: isolate;
}

.chat-widget.hidden { display: none; }

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  color: #fff;
  background: #171717;
  border-bottom: 1px solid #2c2c2c;
}

.chat-header strong {
  display: block;
  font-size: 17px;
  line-height: 1.15;
  font-weight: 800;
}

.chat-header small {
  display: block;
  margin-top: 4px;
  color: #ff2a2a;
  font-size: 12px;
  line-height: 1.2;
}

.chat-header button {
  border: 0;
  padding: 2px 4px;
  background: transparent;
  color: #a5a5a5;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.chat-header button:hover { color: #fff; }

.chat-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 15px 16px;
  background: #0d0d0d;
  scrollbar-width: thin;
  scrollbar-color: #343434 transparent;
}

.message {
  max-width: 86%;
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  line-height: 1.42;
  font-size: 13px;
}

.assistant {
  background: #1c1c1c;
  color: #ededed;
  border: 1px solid #303030;
}

.user {
  margin-left: auto;
  background: #ff2a2a;
  color: #fff;
}

.error {
  color: #ffaaaa;
  background: #341313;
  border: 1px solid #8b2929;
}

.sources {
  margin: 7px 0 13px;
  color: #777;
  font-size: 11px;
}

.sources a {
  display: block;
  margin-top: 4px;
  color: #ff2a2a;
  text-decoration: none;
}

.quick-actions {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 9px 10px;
  border-top: 1px solid #252525;
  background: #121212;
  scrollbar-width: none;
}

.quick-actions::-webkit-scrollbar { display: none; }

.quick-actions button {
  flex: 0 0 auto;
  border: 1px solid #383838;
  border-radius: 999px;
  background: #1a1a1a;
  color: #ddd;
  padding: 6px 9px;
  font-size: 11.5px;
  line-height: 1.2;
  cursor: pointer;
}

.quick-actions button:hover {
  border-color: #ff2a2a;
  color: #fff;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  padding: 10px;
  border-top: 1px solid #272727;
  background: #121212;
}

.chat-form input {
  min-width: 0;
  width: 100%;
  padding: 10px 11px;
  color: #fff;
  background: #1a1a1a;
  border: 1px solid #373737;
  border-radius: 11px;
  outline: none;
  font-size: 12.5px;
}

.chat-form input::placeholder { color: #9ca3af; }
.chat-form input:focus { border-color: #ff2a2a; }

.chat-form button {
  border: 0;
  padding: 0 14px;
  border-radius: 11px;
  color: #fff;
  background: #ff2a2a;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 800;
}

/* Portfolio social icons use z-30; chatbot deliberately stays above all page content. */
#chat-widget,
#chat-toggle {
  position: fixed !important;
}

#chat-widget { z-index: 1000000 !important; }
#chat-toggle { z-index: 999999 !important; }

@media (max-width: 520px) {
  .chat-widget {
    right: 12px;
    bottom: 74px;
    width: calc(100vw - 24px);
    height: min(520px, calc(100vh - 92px));
    border-radius: 18px;
  }

  .chat-toggle {
    right: 12px;
    bottom: 12px;
    width: 50px;
    height: 50px;
  }

  .chat-header { padding: 14px 16px; }
  .chat-messages { padding: 13px 14px; }
}
