/**
 * Interactive Tools Styling
 */

/* Tool container */
.aichat-tool-container {
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    background-color: #f9f9f9;
    position: relative;
}

/* Highlighted tool container to make tools more visible */
.aichat-tool-highlight {
    border: 1px solid #4a90e2;
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.15);
    animation: tool-highlight-pulse 2s infinite alternate;
}

@keyframes tool-highlight-pulse {
    0% {
        box-shadow: 0 2px 10px rgba(74, 144, 226, 0.15);
    }

    100% {
        box-shadow: 0 2px 15px rgba(74, 144, 226, 0.3);
    }
}

/* Tool indicator icon */
.aichat-tool-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.aichat-tool-icon {
    font-size: 16px;
    line-height: 1;
}

.aichat-tool-header {
    padding: 12px 15px;
    background-color: #f2f2f2;
    border-bottom: 1px solid #ddd;
}

.aichat-tool-header h4 {
    margin: 0 0 5px;
    font-size: 16px;
    color: #333;
}

.aichat-tool-description {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Tool form */
.aichat-tool-form-wrapper {
    padding: 15px;
}

.aichat-tool-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tool-form-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.tool-form-field label {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
    color: #444;
}

.tool-form-field input[type="text"],
.tool-form-field input[type="email"],
.tool-form-field input[type="number"],
.tool-form-field input[type="date"],
.tool-form-field select,
.tool-form-field textarea {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    width: 100%;
}

.tool-form-field textarea {
    min-height: 100px;
    resize: vertical;
}

.tool-form-field select {
    height: 38px;
}

.tool-form-field input[type="checkbox"] {
    margin-right: 8px;
}

.tool-form-field .description {
    margin-top: 5px;
    font-size: 12px;
    color: #777;
}

/* Radio buttons */
.tool-form-field .radio-option {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.tool-form-field .radio-option label {
    font-weight: normal;
    margin-bottom: 0;
    margin-left: 8px;
}

/* Form actions */
.tool-form-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 10px;
}

.aichat-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-tool-form {
    background-color: #2271b1;
    color: white;
}

.submit-tool-form:hover {
    background-color: #135e96;
}

.cancel-tool-interaction {
    background-color: #f2f2f2;
    color: #555;
}

.cancel-tool-interaction:hover {
    background-color: #e2e2e2;
}

/* Tool errors */
.aichat-tool-error {
    padding: 10px;
    margin-bottom: 15px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    font-size: 14px;
}

/* Tool result styling */
.aichat-tool-result {
    padding: 15px;
}

.aichat-tool-executed {
    background-color: #f0f8ff;
}

.aichat-search-results {
    list-style: none;
    padding: 0;
    margin: 0;
}

.aichat-search-result {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.aichat-search-result:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.aichat-search-result h5 {
    margin: 0 0 5px;
    font-size: 16px;
}

.aichat-search-snippet {
    margin: 5px 0;
    font-size: 14px;
    line-height: 1.4;
}

.aichat-search-url {
    margin: 5px 0 0;
    font-size: 12px;
    color: #006621;
}

/* Generic result summary styling for tools that return a user-facing message */
.aichat-tool-result .aichat-result-text {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

.aichat-tool-result .aichat-result-meta {
    margin-top: 6px;
    font-size: 12px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aichat-result-meta-item strong {
    font-weight: 600;
}

.aichat-result-meta-separator {
    margin: 0 4px;
    color: #bbb;
}

/**
 * Enhancement: Tool Loading Placeholder Styles
 * Generic loading indicator shown while tool form is being prepared
 * No hardcoded tool-specific styling - works for all interactive tools
 */
.aichat-tool-loading-placeholder {
    padding: 16px 20px;
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    text-align: center;
    margin: 10px 0;
}

.aichat-tool-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.aichat-tool-loading-spin {
    animation: aichat-tool-spin 1s linear infinite;
    color: #4a90e2;
}

.aichat-tool-loading-text {
    color: #666;
    font-size: 14px;
}

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