/* chatbox.css (FULL FILE) */

.chat-container {
    position: fixed;
    bottom: 2vh;
    right: 2vw;
    width: 30%;
    max-width: 450px;
    height: 60vh;
    background: #fff;
    border: 2px solid #662d91;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .2);
    display: none;
    flex-direction: column;
    z-index: 11111;
    overflow: auto;
}

@media (max-width: 1080px) {
    .chat-container {
        width: 50%;
        height: 60vh;
        bottom: 2vh;
        right: 2vw;
        border-radius: 15px;
    }
}

@media (max-width: 768px) {
    .chat-container {
        margin: auto;
        width: 95%;
        height: 97vh;
        bottom: 2vh;
        right: 1.5vw;
        left: 1.5vw;
        border-radius: 15px;
        z-index: 111111;
    }
}

@media (min-width: 1600px) {
    .chat-container {
        width: 450px;
    }
}

.chatbox-header {
    background: #662d91;
    color: #fff;
    padding: 12px;
    font-weight: bold;
    text-align: center;
    position: relative;
    border-radius: 9px 9px 0px 0px;
}

#close-chat {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 29px;
    position: absolute;
    right: 10px;
    top: 45%;
    transform: translateY(-50%);
    cursor: pointer;
}

.message {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 80%;
}

.bot {
    background-color: #e6f2ff;
    text-align: left;
}

.user {
    background-color: #d1e7fd;
    text-align: right;
    margin-left: auto;
}

.chatbox-footer {
    border-top: 1px solid #ddd;
    padding: 10px;
    display: flex;
    background-color: #fff;
    position: sticky;
    bottom: 0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

#chat-input {
    flex: 1;
    border: 1px solid #662d91;
    border-radius: 20px 0px 0px 20px;
    padding: 10px 15px;
    outline: none;
    background-color: #f9f9f9;
    color: #333;
    transition: border 0.3s ease-in-out;
}

#chat-input:focus {
    border-color: #2B3990;
    background-color: #fff;
}

#chat-submit {
    background-color: #662d91;
    color: #fff;
    border: 1px solid #662d91;
    border-radius: 0px 20px 20px 0px;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease-in-out;
}

#chat-submit:hover {
    background-color: #2B3990;
}

.chat-icon {
    z-index: 1;
    position: fixed;
    bottom: 15px;
    right: 80px;
    background: #662d91;
    color: white;
    width: 55px;
    height: 55px;
    line-height: 55px;
    text-align: center;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(75, 0, 130, 0.5);
    font-size: 26px;
    transition: background 0.3s ease, transform 0.2s ease;
}

.chat-icon-label {
    border-radius: 10px;
    height: 55px;
    z-index: 1;
    position: fixed;
    padding-top: 13px;
    padding-bottom: 8px;
    padding-left: 25px;
    padding-right: 25px;
    bottom: 15px;
    right: 145px;
    background: #662d91;
    color: #fff;
    line-height: 1;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease, color 0.3s ease;
}

.chat-icon-label label{
    cursor: pointer;
}

.chat-icon-label, .chat-icon {
    transition: all 0.3s ease;
}

.chat-icon-a:hover .chat-icon-label,
.chat-icon-a:hover .chat-icon {
    background: #2B3990;
    color: #fff;
}

.chat-icon-a:hover .chat-icon-label {
    transform: scale(1.05);
}

.chat-icon-a:hover .chat-icon {
    transform: scale(1.1) rotate(15deg);
}

.typing-indicator { font-style: italic; color: #999; align-self: flex-start; }

.chatbox-body {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    overflow-y: auto;
    padding: 15px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    gap: 5px;
}

.chatbox-body-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.bot-message,
.user-message {
    line-height: 1.2em;
    background: #e3f2fd;
    color: #000000;
    border-radius: 15px;
    padding: 10px 10px;
    max-width: 75%;
    align-self: flex-start;
    font-size: 0.9em;
}

.user-message {
    background: #d1ecf1;
    align-self: flex-end;
}

.accordion-item-header {
    font-size: 0.9rem;
    padding: 0rem 3rem 0rem 1rem;
    min-height: 3.5rem;
    line-height: 1.25rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.accordion-item-header::after {
    content: "\002B";
    font-size: 1.5rem;
    position: absolute;
    right: 30px;
}

.accordion-item-header.active::after {
    content: "\2212";
}

.accordion-item-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
}

.accordion-item-body-content {
    line-height: 1rem;
    border-top: 1px solid #662d91;
}

.accordion-item-body-content ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.accordion-item-body-content li {
    background-color: #f3e5f5;
    border-bottom: 1px solid #662d91;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.3sease-in-out;
}

.accordion-item-body-content li:hover {
    background-color: #e1bee7;
}

.chatbox-clear-button {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #800080;
    color: white;
    border: none;
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 9999;
}
.chatbox-clear-button:hover {
    background-color: #660066;
}

#chat-history .user-message,
#chat-history .bot-message {
    margin-bottom: 12px;
}

#chat-history .bot-message {
    background-color: #EEE3FF;
    color: #000;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 12px;
    max-width: 85%;
    align-self: flex-start;
}

/* (kept as-is from your file) */
.chatbox-clear-button{
    position: 'absolute';
    top: '10px';
    left: '10px';
    background: '#800080';
    color: '#fff';
    border: 'none';
    padding: '6px 10px';
    font-size: '12px';
    border-radius: '4px';
    cursor: 'pointer';
    z-index: '9999'
}

#chat-history {
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

/* ==========================================================
   Resizable + Draggable (PATCH)
   ========================================================== */

.chat-container {
  resize: both;
  min-width: 320px;
  min-height: 420px;
  max-width: 95vw;
  max-height: 95vh;
  box-sizing: border-box;
  overflow: auto;
}

.chatbox-header {
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

@media (max-width: 768px) {
  .chat-container { resize: none; }
}

.chat-container .chatbox-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden !important;
}

.chat-container .chatbox-body-inner,
.chat-container #chat-history {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: none !important;
  overflow-y: auto !important;
}

/* ==========================================================
   Maximize/Restore button + Truly-on-top (PATCH)
   ========================================================== */

.chat-container,
.chat-icon,
.chat-icon-label,
.chat-icon-a {
  z-index: 2147483647 !important;
}

/* Move button 5px further LEFT from the X (both states) */
#chat-max-toggle {
  background: transparent;
  border: none;
  position: absolute;
  right: 49px; /* was 44px; moved 5px left */
  top: 45%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
}

/* Square: 3px smaller all around (18px -> 15px), and move DOWN 3px */
#chat-max-toggle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(50% + 3px); /* move square down 3px */
  width: 15px;         /* was 18px */
  height: 15px;        /* was 18px */
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  box-sizing: border-box;
}

/* Underscore: keep position (as you said it's fine), but make it 3px shorter */
#chat-max-toggle.is-restore::before {
  width: 15px;        /* was 18px; 3px shorter */
  height: 0;
  border: none;
  border-bottom: 2px solid #fff;
  top: 62%;
  left: 50%;
  transform: translate(-50%, -50%);
}
