/* Public styles for Azure OpenAI Assistant */
.azure-openai-chat-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    resize: vertical;
    min-height: 300px;
}

/* Resizer handle */
.azure-openai-chat-resizer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 10px;
    cursor: ns-resize;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.05));
    z-index: 5;
}

.azure-openai-chat-resizer:hover,
.azure-openai-chat-resizer:active {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.1));
}

/* Header styles */
.azure-openai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background-color: #f1f1f1;
    border-bottom: 1px solid #ddd;
}

.azure-openai-chat-model-selector select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.azure-openai-chat-actions {
    display: flex;
    gap: 8px;
}

.azure-openai-chat-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.azure-openai-chat-actions button:hover {
    background-color: #e4e4e4;
}

/* Conversations panel */
.azure-openai-chat-conversations {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background-color: white;
    border-left: 1px solid #ddd;
    z-index: 10;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.azure-openai-chat-conversations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.azure-openai-chat-conversations-header h3 {
    margin: 0;
    font-size: 16px;
}

.azure-openai-chat-close-conversations {
    background: none;
    border: none;
    cursor: pointer;
}

.azure-openai-chat-conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.azure-openai-chat-conversation-item {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s;
}

.azure-openai-chat-conversation-item:hover {
    background-color: #f9f9f9;
}

.azure-openai-chat-conversation-title {
    font-weight: bold;
    margin-bottom: 4px;
    padding-right: 20px;
}

.azure-openai-chat-conversation-date {
    font-size: 12px;
    color: #666;
}

.azure-openai-chat-delete-conversation {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
}

.azure-openai-chat-delete-conversation:hover {
    color: #d63638;
}

.azure-openai-chat-no-conversations {
    color: #666;
    font-style: italic;
}

/* Save dialog */
.azure-openai-chat-save-dialog {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.azure-openai-chat-save-dialog-content {
    background-color: white;
    padding: 20px;
    border-radius: 4px;
    width: 80%;
    max-width: 400px;
}

.azure-openai-chat-save-dialog-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.azure-openai-chat-save-title {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.azure-openai-chat-save-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.azure-openai-chat-save-actions button {
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.azure-openai-chat-save-confirm {
    background-color: #0073aa;
    color: white;
    border: none;
}

.azure-openai-chat-save-cancel {
    background-color: #f1f1f1;
    border: 1px solid #ddd;
}

/* Messages */
.azure-openai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background-color: #f9f9f9;
}

.azure-openai-chat-message {
    margin-bottom: 10px;
    max-width: 80%;
}

.azure-openai-chat-message-user {
    margin-left: auto;
    text-align: right;
}

.azure-openai-chat-message-assistant {
    margin-right: auto;
    text-align: left;
}

.azure-openai-chat-message-system {
    margin: 0 auto;
    text-align: center;
    font-style: italic;
    color: #666;
    max-width: 90%;
}

.azure-openai-chat-message-error {
    margin: 0 auto;
    text-align: center;
    color: #f00;
}

.azure-openai-chat-message-content {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 18px;
    background-color: #f1f1f1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.azure-openai-chat-message-user .azure-openai-chat-message-content {
    background-color: #0073aa;
    color: #fff;
}

.azure-openai-chat-message-system .azure-openai-chat-message-content {
    background-color: #f9f9f9;
    color: #666;
    border: 1px dashed #ddd;
    box-shadow: none;
}

/* Markdown formatting */
.azure-openai-chat-message-content pre {
    background-color: #f4f4f4;
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 10px 0;
}

.azure-openai-chat-message-content code {
    background-color: #f4f4f4;
    padding: 2px 4px;
    border-radius: 3px;
}

.azure-openai-chat-input-container {
    padding: 10px;
    border-top: 1px solid #ddd;
    background-color: #fff;
}

.azure-openai-chat-form {
    display: flex;
    align-items: center;
}

.azure-openai-chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

.azure-openai-chat-input:focus {
    border-color: #0073aa;
}

.azure-openai-chat-submit {
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    margin-left: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.azure-openai-chat-submit:hover {
    background-color: #005f8b;
}

.azure-openai-chat-submit:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.azure-openai-chat-attach-button {
    background: none;
    border: none;
    color: #666;
    margin-right: 8px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.azure-openai-chat-attach-button:hover {
    color: #0073aa;
}

.azure-openai-chat-image-preview {
    margin-top: 10px;
    position: relative;
    display: inline-block;
    max-width: 200px;
}

.azure-openai-chat-image-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.azure-openai-chat-remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    padding: 0;
}

.azure-openai-chat-remove-image .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    line-height: 1;
}

.azure-openai-chat-remove-image:hover {
    background: #d32f2f;
}

.azure-openai-chat-message-loading .azure-openai-chat-message-content {
    display: flex;
    align-items: center;
}

.azure-openai-chat-message-loading .azure-openai-chat-message-content:after {
    content: ".";
    animation: dots 1.5s steps(5, end) infinite;
    width: 18px;
    text-align: left;
}

@keyframes dots {
    0%, 20% {
        content: ".";
    }
    40% {
        content: "..";
    }
    60% {
        content: "...";
    }
    80%, 100% {
        opacity: 0;
        content: "...";
    }
}

@media (max-width: 480px) {
    .azure-openai-chat-message {
        max-width: 90%;
    }
}

/* Embeddings interface styles */
.azure-openai-embeddings-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: #f9f9f9;
}

.azure-openai-embeddings-header {
    padding: 12px 15px;
    background-color: #f1f1f1;
    border-bottom: 1px solid #ddd;
}

.azure-openai-embeddings-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.azure-openai-embeddings-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.azure-openai-embeddings-upload,
.azure-openai-embeddings-search {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.azure-openai-embeddings-upload {
    border-right: 1px solid #ddd;
}

.azure-openai-embeddings-upload h4,
.azure-openai-embeddings-search h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
}

.azure-openai-embeddings-upload-form,
.azure-openai-embeddings-search-form {
    margin-bottom: 15px;
}

.azure-openai-embeddings-file-input-container {
    margin-bottom: 10px;
}

.azure-openai-embeddings-file-list {
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
}

.azure-openai-embeddings-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-bottom: 5px;
    background-color: #fff;
}

.azure-openai-embeddings-file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.azure-openai-embeddings-file-remove {
    background: none;
    border: none;
    color: #d63638;
    cursor: pointer;
    padding: 0 5px;
}

.azure-openai-embeddings-upload-button,
.azure-openai-embeddings-search-button {
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
}

.azure-openai-embeddings-upload-button:hover,
.azure-openai-embeddings-search-button:hover {
    background-color: #005a87;
}

.azure-openai-embeddings-search-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.azure-openai-embeddings-results {
    margin-top: 15px;
}

.azure-openai-embeddings-result-item {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    background-color: #fff;
}

.azure-openai-embeddings-result-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.azure-openai-embeddings-result-score {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.azure-openai-embeddings-result-content {
    font-size: 14px;
    white-space: pre-line;
}

.azure-openai-embeddings-status {
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
}

.azure-openai-embeddings-status.success {
    background-color: #ecf9ec;
    color: #1e7e34;
    border: 1px solid #c3e6cb;
}

.azure-openai-embeddings-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.azure-openai-embeddings-processing-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.azure-openai-embeddings-processing-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 4px;
    text-align: center;
    max-width: 80%;
}

.azure-openai-embeddings-processing-spinner {
    margin: 15px auto;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .azure-openai-embeddings-content {
        flex-direction: column;
    }
    
    .azure-openai-embeddings-upload {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
}
