/* Entel Chatbots - Responsive Styles */

/* Mobile compatibility and animation fallbacks */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner,
    .icon-spinner-md,
    .icon-spinner-lg,
    .typing-indicator .dot,
    .history-loading .loading-spinner {
        animation: none !important;
    }
    .typing-indicator .dot {
        opacity: 0.8 !important;
    }
    .loading-spinner::after,
    .icon-spinner-md::after,
    .icon-spinner-lg::after {
        content: "•••" !important;
        animation: none !important;
        font-size: 8px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        border: none !important;
        background: none !important;
        width: auto !important;
        height: auto !important;
    }
}

/* Tablet and smaller desktop adjustments */
@media screen and (max-width: 768px) {
    .entel-chatbot {
        bottom: 10px;
        right: 10px;
    }
    
    .chatbot-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .chatbot-modal.active {
        transform: translateY(0);
    }
    
    .chatbot-launcher {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }
    
    .chatbot-launcher img {
        width: 28px;
        height: 28px;
    }

    /* Prevent iOS zoom on form focus */
    .message-input {
        font-size: 16px !important;
    }

    /* History Modal on mobile */
    .chatbot-history-modal {
        padding: 0;
    }
    
    .history-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .history-modal-body {
        padding: 16px;
    }

    /* Inline Mode on mobile */
    .entel-chatbot-inline {
        margin: 10px !important;
        max-width: none !important;
    }
    
    .chatbot-inline-container {
        min-height: 400px;
        max-height: 500px;
    }
    
    .chatbot-inline-messages {
        min-height: 250px;
        max-height: 300px;
        padding: 15px;
    }
    
    .chatbot-inline-messages .message .message-bubble {
        max-width: 85%;
        font-size: 14px;
    }
    
    .chatbot-inline-input {
        padding: 12px 15px;
    }

    .user-message-actions {
        padding-left: 0;
        margin-left: 0;
    }
    
    .user-regenerate-btn {
        width: 20px;
        height: 20px;
    }
    
    .user-regenerate-btn .action-icon {
        flex-shrink: 0;
    }
}

/* Mobile-specific adjustments */
@media screen and (max-width: 480px) {
    .chat-messages {
        padding: 16px;
    }
    
    .chat-input-area {
        padding: 12px 16px;
    }
    
    .message-bubble {
        max-width: 90%;
    }

    /* Inline mode on small mobile */
    .chatbot-inline-messages {
        padding: 10px;
    }
    
    .chatbot-inline-messages .message .message-bubble {
        max-width: 90%;
        padding: 10px 14px;
    }
    
    .chatbot-inline-input .input-container {
        padding: 6px 10px;
    }
    
    .chatbot-inline-input .send-button,
    .chatbot-inline-input .stop-button,
    .chatbot-inline-input .enhancement-button {
        width: var(--entel-input-button-size, 32px);
        height: var(--entel-input-button-size, 32px);
        font-size: var(--entel-input-icon-size, 14px);
    }

    /* Modal on small mobile */
    .entel-delete-modal-overlay {
        padding: 10px;
    }
    
    .entel-delete-modal {
        max-width: none;
    }
    
    .entel-delete-modal-header,
    .entel-delete-modal-content,
    .entel-delete-modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .chatbot-modal {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .chat-messages {
        background-color: #1a1a1a;
    }
    
    .message.assistant .message-bubble {
        background-color: #2d2d2d;
        color: #e0e0e0;
    }
    
    .message-input {
        background: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .message-input:focus {
        border-color: #2271b1;
    }
    
    .chat-input-area,
    .chat-footer {
        background: #1a1a1a;
        border-color: #444;
    }

    /* Dark mode for markdown */
    .message-content code {
        background: rgba(255, 255, 255, 0.15);
    }
    
    .message-content pre {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .message-content blockquote {
        border-left-color: rgba(255, 255, 255, 0.3);
        color: rgba(255, 255, 255, 0.8);
    }
    
    .message-content hr {
        border-top-color: rgba(255, 255, 255, 0.3);
    }
    
    .message-content th,
    .message-content td {
        border-color: rgba(255, 255, 255, 0.3);
    }
    
    .message-content th {
        background: rgba(255, 255, 255, 0.15);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .chatbot-modal {
        border: 2px solid #000;
    }
    
    .message-bubble {
        border: 1px solid currentColor;
    }
    
    .send-button,
    .stop-button,
    .chatbot-launcher {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .chatbot-modal,
    .chatbot-launcher,
    .action-button,
    .send-button,
    .stop-button {
        transition: none;
    }
    
    .typing-dots span {
        animation: none;
    }
    
    .loading-spinner,
    .icon-spinner-md,
    .icon-spinner-lg {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .entel-chatbot, .chatbot-history-modal {
        display: none !important;
    }
}
