/**
 * ChatGPT Chat Agent - Styles
 */

/* Chat Widget Container */
.chatgpt-chat-widget {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    background: #ffffff;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Error States */
.chatgpt-chat-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.chatgpt-chat-error .error-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.chatgpt-chat-error .error-message {
    color: #666;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.4;
}

.chatgpt-chat-error .retry-button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.chatgpt-chat-error .retry-button:hover {
    background: #005a87;
}

/* Loading States */
.chatgpt-chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f9f9f9;
}

.chatgpt-chat-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: chatgpt-spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .chatgpt-chat-widget {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0;
    }
}

/* Integration with WordPress Themes */
.wp-block-chatgpt-chat .chatgpt-chat-widget {
    margin: 20px 0;
}

.widget .chatgpt-chat-widget {
    width: 100% !important;
    height: 400px !important;
}

/* Float/Fixed Positioning Support */
.chatgpt-chat-widget.chatgpt-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 320px !important;
    height: 480px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.chatgpt-chat-widget.chatgpt-float.chatgpt-minimized {
    height: 60px !important;
    cursor: pointer;
}

/* Custom Scrollbar for Chat */
.chatgpt-chat-widget ::-webkit-scrollbar {
    width: 6px;
}

.chatgpt-chat-widget ::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chatgpt-chat-widget ::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chatgpt-chat-widget ::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Admin Settings Page Styles */
.wrap .card h2 {
    margin-top: 0;
}

.chatgpt-chat-agent-admin .form-table th {
    width: 200px;
}

.chatgpt-chat-agent-admin .regular-text {
    width: 400px;
}

.chatgpt-chat-agent-admin .description {
    font-style: italic;
    color: #666;
}

/* Shortcode Examples */
.chatgpt-shortcode-examples {
    background: #f9f9f9;
    padding: 15px;
    border-left: 4px solid #0073aa;
    margin-top: 10px;
}

.chatgpt-shortcode-examples code {
    background: #fff;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: Consolas, Monaco, monospace;
}

/* WordPress Block Editor Support */
.wp-block-chatgpt-chat-agent {
    margin: 1em 0;
}

.wp-block-chatgpt-chat-agent .chatgpt-chat-widget {
    border: 2px dashed #ccc;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-block-chatgpt-chat-agent .chatgpt-chat-widget:before {
    content: 'ChatGPT Chat Widget';
    color: #666;
    font-size: 14px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .chatgpt-chat-widget {
        background: #1a1a1a;
        border: 1px solid #333;
    }
    
    .chatgpt-chat-error {
        background: #2a2a2a;
        border-color: #444;
        color: #ccc;
    }
    
    .chatgpt-chat-loading {
        background: #2a2a2a;
    }
}

/* Accessibility */
.chatgpt-chat-widget:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.chatgpt-chat-error .retry-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .chatgpt-chat-widget {
        display: none !important;
    }
}