/* ================================
   CHAT TOGGLE BUBBLE
   ================================ */
#sh-chat-widget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#sh-toggle-chat {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #007cba;
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

#sh-toggle-chat:hover {
    background: #006ba1;
    transform: scale(1.05);
}

/* ================================
   CHAT WINDOW STRUCTURE
   ================================ */
#sh-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 370px;
    height: 500px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s, transform 0.3s;
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
}

#sh-chat-window.sh-active {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

.sh-hidden {
    display: none !important;
}

/* ================================
   CHAT HEADER
   ================================ */
#sh-chat-header {
    background: #007cba;
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

#sh-close-chat {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* ================================
   PRE-CHAT FORM
   ================================ */
#sh-pre-chat-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#sh-pre-chat-form p {
    margin: 0 0 10px 0;
    color: #555;
    font-size: 14px;
}

#sh-pre-chat-form input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

#sh-start-chat-btn {
    background: #007cba !important;
    border: none;
    color: #fff !important;
    padding: 10px !important;
    border-radius: 4px !important;
    cursor: pointer;
    font-weight: 600;
}

/* ================================
   ACTIVE CHAT AREA
   ================================ */
#sh-active-chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

#sh-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f4f4f4;
}

.sh-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.4;
    word-wrap: break-word;
}

.sh-msg.user {
    background: #007cba;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.sh-msg.admin {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.sh-msg.system {
    background: #fff3cd;
    color: #856404;
    align-self: center;
    font-size: 12px;
    text-align: center;
    border: 1px solid #ffeeba;
    border-radius: 12px;
}

/* ================================
   CHAT INPUT AREA
   ================================ */
#sh-input-area {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

#sh-user-message {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 60px;
}

#sh-user-message:focus {
    border-color: #007cba;
}

#sh-send-message-btn {
    background: #007cba;
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ================================
   MOBILE RESPONSIVENESS FIX
   ================================ */
@media (max-width: 480px) {
    #sh-chat-widget {
        bottom: 15px;
        right: 15px;
    }

    #sh-toggle-chat {
        width: 55px;
        height: 55px;
    }

    #sh-chat-window {
        /* Calculate width to prevent left cutoff, leaving safe margin */
        width: calc(100vw - 30px);
        right: 0;
        height: 450px;
        bottom: 70px;
    }
}
