/* ChatPickle Styles */
.chatpickle-container {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 9999 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.4;
    /* Ensure the container doesn't take up space in the page flow */
    width: 0 !important;
    height: 0 !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
}

.chatpickle-box {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 350px !important;
    background: white !important;
    border-radius: 10px !important;
    box-shadow: 0 0 10px rgba(0,0,0,0.2) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    z-index: 99999 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

.chatpickle-header {
    color: white;
    padding: 10px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.chatpickle-body {
    height: 300px;
    overflow-y: auto;
    padding: 15px;
    background: #f9f9f9;
}

.chatpickle-messages {
    display: flex;
    flex-direction: column;
}

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

.chatpickle-user-message {
    align-self: flex-end;
    background: #e6f7ff;
    color: #333;
}

.chatpickle-bot-message {
    align-self: flex-start;
    background: white;
    color: #333;
    border: 1px solid #eee;
}

.chatpickle-input {
    display: flex;
    padding: 10px;
    background: white;
    border-top: 1px solid #eee;
}

.chatpickle-user-input {
    flex-grow: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 15px;
    outline: none;
}

.chatpickle-send-button {
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatpickle-minimize-button {
    background: transparent;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.chatpickle-typing {
    align-self: flex-start;
    background: white;
    padding: 8px 12px;
    border-radius: 15px;
    margin-bottom: 10px;
    display: none;
    border: 1px solid #eee;
}

.chatpickle-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
    margin-right: 3px;
    animation: chatpickle-typing 1s infinite;
}

.chatpickle-dot:nth-child(2) { animation-delay: 0.2s; }
.chatpickle-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatpickle-typing {
    0% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
    60% { transform: translateY(0); }
    100% { transform: translateY(0); }
}

.chatpickle-error {
    background-color: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #ef9a9a;
    margin: 10px 0;
    font-weight: bold;
}

.chatpickle-custom-icon {
    max-width: 40px;
    max-height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.chatpickle-button {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 0 10px rgba(0,0,0,0.2) !important;
    color: white !important;
    z-index: 99998 !important;
    transition: transform 0.2s ease !important;
    margin: 0 !important;
    padding: 0 !important;
}

.chatpickle-button:hover {
    transform: scale(1.05);
}

/* Markdown styling for bot messages */
.chatpickle-bot-message h1,
.chatpickle-bot-message h2,
.chatpickle-bot-message h3,
.chatpickle-bot-message h4,
.chatpickle-bot-message h5,
.chatpickle-bot-message h6 {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    font-weight: bold;
}

.chatpickle-bot-message h1 { font-size: 1.5em; }
.chatpickle-bot-message h2 { font-size: 1.3em; }
.chatpickle-bot-message h3 { font-size: 1.2em; }
.chatpickle-bot-message h4 { font-size: 1.1em; }
.chatpickle-bot-message h5 { font-size: 1em; }
.chatpickle-bot-message h6 { font-size: 0.9em; }

.chatpickle-bot-message p {
    margin-bottom: 0.5em;
}

.chatpickle-bot-message ul,
.chatpickle-bot-message ol {
    padding-left: 1.5em;
    margin-bottom: 0.5em;
}

.chatpickle-bot-message code {
    background-color: #f0f0f0;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

.chatpickle-bot-message pre {
    background-color: #f0f0f0;
    padding: 8px;
    border-radius: 3px;
    overflow-x: auto;
    margin-bottom: 0.5em;
}

.chatpickle-bot-message pre code {
    background-color: transparent;
    padding: 0;
}

.chatpickle-bot-message blockquote {
    border-left: 3px solid #ddd;
    padding-left: 10px;
    margin-left: 5px;
    color: #666;
}

.chatpickle-bot-message a {
    color: #4a69bd;
    text-decoration: underline;
}

.chatpickle-bot-message table {
    border-collapse: collapse;
    margin-bottom: 0.5em;
    width: 100%;
}

.chatpickle-bot-message table th,
.chatpickle-bot-message table td {
    border: 1px solid #ddd;
    padding: 4px 8px;
}

.chatpickle-bot-message table th {
    background-color: #f0f0f0;
}

@media (max-width: 480px) {
    .chatpickle-box {
        width: calc(100% - 40px);
        right: 20px;
    }
}

/* Admin styles */
.parameter-row,
.header-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.parameter-row input,
.header-row input {
    margin-right: 10px;
}

#chatpickle-parameters-container,
#chatpickle-headers-container {
    margin-bottom: 15px;
}

.parameter-mode-selector {
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.parameter-mode-selector label {
    margin-right: 20px;
    font-weight: bold;
}

#json_template {
    font-family: monospace;
    white-space: pre;
}

.chatpickle-shortcode {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}
