/* Chat icon floating button */
#chat-icon {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: #ffd700;
    color: #000;
    font-size: 22px;
    padding: 14px 16px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 9999;
}

.chatimg {
    align-items: center;
}

/* Chat window */
#chat-window {
    position: fixed;
    bottom: 80px;
    left: 24px;
    width: 100%;
    max-width: 450px;
    min-height: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    background: #1a1a1a;
    z-index: 9999;
    transition: all 0.3s ease;
}

#chat-window.hidden {
    display: none;
}

#chat-header {
    background: #262626;
    color: white;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

#chat-header button {
    background: #ffd700;
    color: #000;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: background 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

#chat-header button:hover {
    background: #ffc400;
}

/* Chat message area */
#chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: #111;
    color: white;
    font-size: 14px;
    scroll-behavior: smooth;
}

/* Chat form input */
#chat-form {
    display: flex;
    border-top: 1px solid #333;
}

#chat-form input {
    flex: 1;
    border: none;
    padding: 10px;
    background: #222;
    color: white;
    font-size: 14px;
}

#chat-form button {
    background: #ffd700;
    color: #000;
    border: none;
    padding: 10px;
    cursor: pointer;
}

.chat-link {
    color: #ffd700;
    text-decoration: underline;
    word-break: break-word;
}

/* Message formatting with avatar outside the bubble */
.chat-message-wrapper {
    display: flex;
    align-items: flex-end;
    margin-bottom: 12px;
}

.chat-message-wrapper.user {
    justify-content: flex-start;
    flex-direction: row;
}

.chat-message-wrapper.bot {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.user-message,
.bot-message {
    max-width: 75%;
    padding: 12px 15px;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.user-message {
    background: #333;
    border-radius: 12px 12px 4px 12px;
}

.bot-message {
    background: #444;
    border-radius: 12px 12px 12px 4px;
}

/* Avatar styles */
.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 8px;
    border: 2px solid #000;
    background: white;
}

/* Enhanced list styling for bot messages */
.bot-message ul {
    list-style-type: none;
    margin: 12px 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    color: white;
}

.bot-message li {
    position: relative;
    margin-bottom: 10px;
    padding-left: 20px;
    color: #e0e0e0;
}

.bot-message li:before {
    content: "•";
    color: #ffd700;
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 0;
}

.bot-message li:last-child {
    margin-bottom: 0;
}

/* Bold text styling */
.bot-message strong {
    color: #ffd700;
    font-weight: bold;
}

.user-message strong {
    color: #fff;
    font-weight: bold;
}

/* Paragraph spacing inside bot messages */
.bot-message p {
    margin: 8px 0;
    color: #e0e0e0;
}

.bot-message p:first-child {
    margin-top: 0;
}

.bot-message p:last-child {
    margin-bottom: 0;
}

/* Style for nested content in lists */
.bot-message li a {
    color: #ffd700;
    text-decoration: underline;
}

.bot-message li a:hover {
    color: #ffed4e;
    text-decoration: none;
}

/* User message styling */
.user-message p {
    margin: 4px 0;
}

.user-message p:first-child {
    margin-top: 0;
}

.user-message p:last-child {
    margin-bottom: 0;
}

#chat-nudge {
  position: fixed;
  left: 24px;
  bottom: 84px;
  max-width: 260px;
  background: #262626;
  color: #ffbb00;
  border: 1px solid #03fff7;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,.35);
  font-size: 14px;
  line-height: 1.35;
  z-index: 10000;
  opacity: 0;                /* hidden by default */
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
#chat-nudge.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#chat-nudge .nudge-text { display:block; }
#chat-nudge .nudge-close {
  position: absolute;
  top: 6px; right: 8px;
  background: transparent; border: 0; color: #bbb;
  font-size: 16px; cursor: pointer;
}
#chat-nudge::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: -8px;
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #262626;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #chat-nudge { transition: none; }
}

/* Mobile Responsive Chat Window */
@media (max-width: 768px) {
    #chat-window {
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
        height: 80vh;
        border-radius: 10px;
        max-width: none;
    }

    .user-message,
    .bot-message {
        max-width: 85%;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    #chat-window {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .chat-avatar {
        width: 28px;
        height: 28px;
        margin: 0 6px;
    }

    .user-message,
    .bot-message {
        max-width: 90%;
        padding: 10px 12px;
        font-size: 13px;
    }
}