/*
Plugin Name: Smart Owl AI
Description: Stylesheet for Smart Owl AI. This file controls the visual appearance of the prompt form, AI responses, and debug features, now including support for Perplexity and Anthropic Claude Ai models.
Version: 5.0.9.3.1
Author: Anthony Franck
*/

/* Main container and layout styles */
.ai-prompt-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Layout modes */
.combined-layout .smart-owl-flex-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 15px;
}

.combined-layout .prompt-response-wrapper,
.combined-layout .prompt-form-wrapper {
    flex: 1;
    min-width: 45%;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    margin: 0;
    position: relative;
}

.split-layout .prompt-form-wrapper,
.split-layout .prompt-response-wrapper {
    width: 100%;
    margin-bottom: 20px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
}

/* Form elements */
#ai-prompt-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#ai-prompt-form label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    display: block;
    font-size: 14px;
}

#ai-prompt-input {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    background: #fff;
    transition: all 0.3s ease;
    font-family: inherit;
}

#ai-prompt-input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

#ai-prompt-input::placeholder {
    color: #757575;
    font-style: italic;
}

.character-count {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 4px;
    transition: color 0.3s ease;
}

.character-count.over-limit {
    color: #dc3232;
    font-weight: 600;
}

/* Submit Button styles */
#ai-prompt-form button[type="submit"] {
    background: #2271b1;
    color: #ffffff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    height: 40px;
    position: relative;
    overflow: hidden;
}

#ai-prompt-form button[type="submit"][data-state="loading"] {
    background: #135e96;
    cursor: wait;
}

#ai-prompt-form button[type="submit"][data-state="retry"] {
    background: #dc3232;
}

#ai-prompt-form button[type="submit"]:hover:not(:disabled) {
    background: #135e96;
    transform: translateY(-1px);
}

#ai-prompt-form button[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

/* Model selection container */
.model-selection {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.model-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

/* Updated Model Button (with dropdown) Styles */
.model-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    flex-grow: 1;
    max-width: 250px;
}

.model-option:hover {
    background: #f0f0f0;
    border-color: #2271b1;
}

.model-option.selected {
    background: #2271b1;
    color: #ffffff;
    border-color: #2271b1;
}

.model-option.selected:hover {
    background: #135e96;
}

/* The checkbox itself is hidden */
.model-option input[type="checkbox"] {
    display: none;
}

.model-option.selected .model-name,
.model-option.selected .current-model,
.model-option.selected .dropdown-arrow-icon,
.model-option.selected .lock-icon {
    color: #ffffff;
}

/* Corrected Checkbox visual */
.model-checkbox-container {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    flex-shrink: 0;
}

.model-checkbox-container:before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1px solid #999;
    background: #fff;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    position: relative;
    z-index: 1;
}

.model-option.selected .model-checkbox-container:before {
    background: #2271b1;
    border-color: #2271b1;
}

.model-option.selected .model-checkbox-container:after {
    content: '\2713';
    font-size: 12px;
    color: #ffffff;
    position: absolute;
    left: 8px; /* Corrected positioning to center within the box */
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.model-name {
    font-weight: 500;
}

/* Dropdown toggle section */
.model-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 0;
    background: transparent;
    border: none;
    position: relative;
    flex-grow: 1;
    text-align: right;
}

.current-model {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.model-option.selected .current-model {
    color: #ffffff;
}

.lock-icon {
    font-size: 12px;
    cursor: pointer;
    color: #333;
    margin-right: 5px;
    display: none;
}

.lock-icon.locked {
    display: block;
    color: #dc3232;
}

.model-option.selected .lock-icon.locked {
    color: #ffffff;
}

.dropdown-arrow-icon {
    font-size: 10px;
    color: #333;
    transition: transform 0.2s ease;
}

.model-option.selected .dropdown-arrow-icon {
    color: #ffffff;
}

.dropdown-arrow-icon.rotated {
    transform: rotate(180deg);
}

.dropdown-list-menu {
    position: absolute;
    top: 100%;
    left: -1px;
    min-width: calc(100% + 2px);
    max-height: 200px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: none;
    flex-direction: column;
}

.dropdown-list-menu.active {
    display: flex;
}

.dropdown-item {
    padding: 8px 12px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: #f0f0f0;
}

.dropdown-item.default-model {
    font-weight: bold;
}

/* Response container styles */
#ai-response-container {
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 15px;
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

#ai-response-container::-webkit-scrollbar {
    width: 6px;
}

#ai-response-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#ai-response-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#ai-response-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.response-model {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-left: 4px solid #2271b1;
    border-radius: 0 4px 4px 0;
    animation: slideIn 0.3s ease-out;
}

.response-model[data-model="gemini"] {
    border-left-color: #8e44ef;
}

.response-model[data-model="gpt"] {
    border-left-color: #19c37d;
}

.response-model[data-model="deepseek"] {
    border-left-color: #2271b1;
}

.response-model[data-model="grok"] {
    border-left-color: #1DA1F2;
}

.response-model[data-model="perplexity"] {
    border-left-color: #5436DA;
}

.response-model[data-model="anthropic"] {
    border-left-color: #2e6660;
}

.response-model:last-child {
    margin-bottom: 0;
}

.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.response-model h3 {
    margin: 0;
    color: #1d2327;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.response-content {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.copy-response {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.copy-response:hover {
    opacity: 1;
}

.copy-response.copied {
    color: #2271b1;
    opacity: 1;
}

.copy-response.copied svg {
    fill: #2271b1;
}

/* Loading state styles */
.loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #666;
    padding: 15px;
    background: #f7f7f7;
    border-left: 4px solid #646970;
    border-radius: 0 4px 4px 0;
    animation: pulse 1.5s infinite;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #646970;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

button[data-state="loading"] .loading-spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
    border-color: #ffffff;
    border-top-color: transparent;
}
/* Debug section styles */
.debug-section {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.debug-toggle-wrapper {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    margin: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
}

input:checked + .slider {
    background-color: #2271b1;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2271b1;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 26px;
}

.slider.round:before {
    border-radius: 50%;
}

.debug-status {
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.debug-status .status-text {
    color: #2271b1;
    font-weight: 600;
}

.debug-model-info {
    margin-bottom: 15px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.debug-model-info h4 {
    margin: 0 0 8px 0;
    color: #2271b1;
    font-size: 13px;
    font-weight: 600;
}

.debug-model-info pre {
    margin: 0;
    padding: 8px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 11px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
}

/* Message styles */
.error {
    color: #dc3232;
    background: #fff6f6;
    border-left: 4px solid #dc3232;
    padding: 12px 15px;
    margin: 10px 0;
    font-size: 14px;
    border-radius: 0 4px 4px 0;
    animation: slideIn 0.3s ease-out;
}

.notice {
    background: #fff8e5;
    border-left: 4px solid #dba617;
    padding: 12px 15px;
    margin: 10px 0;
    font-size: 14px;
    border-radius: 0 4px 4px 0;
}

/* Code block styles */
.code-block {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    margin: 10px 0;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    overflow-x: auto;
}

/* Animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-10px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive design */
@media screen and (max-width: 768px) {
    .ai-prompt-container {
        padding: 15px;
        margin: 10px;
    }

    .combined-layout .smart-owl-flex-container {
        flex-direction: column;
    }

    .combined-layout .prompt-response-wrapper,
    .combined-layout .prompt-form-wrapper {
        width: 100%;
        min-width: 100%;
    }

    .model-options {
        flex-direction: column;
        gap: 8px;
    }

    .model-option {
        width: 100%;
        justify-content: flex-start;
    }

    #ai-prompt-form button[type="submit"] {
        width: 100%;
    }

    .debug-toggle-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #ai-response-container {
        max-height: 400px;
    }
}

/* Print styles */
@media print {
    .ai-prompt-container {
        box-shadow: none;
        margin: 0;
        padding: 0;
    }

    .prompt-form-wrapper,
    .debug-toggle-wrapper {
        display: none !important;
    }

    #ai-response-container {
        border: none;
        max-height: none;
        overflow: visible;
    }

    .response-model {
        break-inside: avoid;
        border-left: 2px solid #000;
    }

    .debug-section {
        display: none !important;
    }

    .copy-response {
        display: none !important;
    }
}