/* AI Vet Chat Widget Styles */

.ai-chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.ai-chat-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.ai-chat-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

.ai-chat-button {
    position: absolute;
    bottom: 0;
    right: 0;
    width: auto;
    height: auto;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s ease;
}

.ai-chat-button:hover {
    transform: scale(1.05);
}

.ai-chat-button.open {
    display: none;
}

.ai-chat-icon {
    width: 70px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.3s ease;
}

.ai-chat-button:hover .ai-chat-icon {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ai-chat-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    background: white;
    padding: 6px 12px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.ai-chat-window {
    position: absolute;
    bottom: 0;
    width: 350px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-size: 14px;
}

.ai-chat-window.open {
    display: flex;
}

.ai-chat-widget.bottom-right .ai-chat-window {
    right: 0;
}

.ai-chat-widget.bottom-left .ai-chat-window {
    left: 0;
}

.ai-chat-header {
    background-color: var(--chat-color, #4CAF50);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 0px;
    border: 2px solid white;
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.ai-chat-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: #f5f5f5;
}

.ai-chat-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.ai-chat-message.user {
    align-items: flex-end;
}

.ai-chat-message.assistant {
    align-items: flex-start;
}

.ai-chat-message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 13px;
}

.ai-chat-message-bubble a {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
}

.ai-chat-message.user .ai-chat-message-bubble a {
    color: white;
}

.ai-chat-message.assistant .ai-chat-message-bubble a {
    color: #1976D2;
}

.ai-chat-message-bubble a:hover {
    text-decoration: none;
    opacity: 0.8;
}

.ai-chat-message.user .ai-chat-message-bubble {
    background-color: var(--chat-color, #4CAF50);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-chat-message.assistant .ai-chat-message-bubble {
    background-color: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-chat-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

.ai-chat-typing {
    display: none;
    padding: 10px 14px;
    background-color: white;
    border-radius: 18px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ai-chat-typing.show {
    display: block;
}

.ai-chat-typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

.ai-chat-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.ai-chat-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
}

.ai-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    font-family: inherit;
}

.ai-chat-input:focus {
    border-color: var(--chat-color, #4CAF50);
}

.ai-chat-send {
    background-color: var(--chat-color, #4CAF50);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.ai-chat-send:hover:not(:disabled) {
    opacity: 0.9;
}

.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-whatsapp-prompt {
    background-color: #E8F5E9;
    padding: 12px;
    margin: 12px;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
}

.ai-chat-whatsapp-prompt p {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

.ai-chat-whatsapp-button {
    background-color: #25D366;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.ai-chat-whatsapp-button:hover {
    background-color: #20BA5A;
}

.ai-chat-whatsapp-button::before {
    content: "💬";
    font-size: 18px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    /* Make chat button more visible on mobile */
    .ai-chat-button {
        bottom: 10px;
        right: 10px;
    }

    .ai-chat-widget.bottom-right {
        bottom: 10px;
        right: 10px;
    }

    .ai-chat-widget.bottom-left {
        bottom: 10px;
        left: 10px;
    }

    /* Full width chat window on tablets */
    .ai-chat-window {
        width: calc(100vw - 32px);
        max-width: 400px;
        height: 500px;
    }

    /* Adjust header padding */
    .ai-chat-header {
        padding: 12px 16px;
    }

    .ai-chat-header h3 {
        font-size: 16px;
    }

    .ai-chat-header-icon {
        width: 36px;
        height: 36px;
    }

    /* Adjust messages area */
    .ai-chat-messages {
        padding: 12px;
    }

    /* Improve message bubble readability */
    .ai-chat-message-bubble {
        max-width: 85%;
        font-size: 14px;
        padding: 8px 12px;
    }

    /* Adjust input area */
    .ai-chat-input-area {
        padding: 10px;
    }

    .ai-chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 8px 12px;
    }

    .ai-chat-send {
        width: 38px;
        height: 38px;
        flex-shrink: 0;
    }

    /* Phone form adjustments */
    .ai-chat-phone-form {
        padding: 20px 16px;
    }

    .ai-chat-phone-content {
        max-width: 100%;
    }

    .ai-chat-phone-content h4 {
        font-size: 18px;
    }

    .ai-chat-phone-input,
    .ai-chat-phone-submit {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .ai-chat-widget.bottom-right,
    .ai-chat-widget.bottom-left {
        bottom: 0;
        left: 0;
        right: 0;
    }

    /* Full screen chat on small phones */
    .ai-chat-window {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    /* Chat button positioning */
    .ai-chat-button {
        position: fixed;
        bottom: 15px;
        right: 15px;
        left: auto;
    }

    /* Smaller chat icon for very small screens */
    .ai-chat-icon {
        width: 60px;
        height: 70px;
    }

    .ai-chat-label {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* Header adjustments for full screen */
    .ai-chat-header {
        padding: 14px 16px;
    }

    .ai-chat-header h3 {
        font-size: 16px;
    }

    /* Better touch targets */
    .ai-chat-close {
        width: 36px;
        height: 36px;
        font-size: 28px;
    }

    /* Message area takes remaining space */
    .ai-chat-messages {
        flex: 1;
        padding: 12px;
    }

    /* Larger touch targets for buttons */
    .ai-chat-send {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }

    /* WhatsApp button full width on mobile */
    .ai-chat-whatsapp-button {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 15px;
    }

    /* Footer adjustments */
    .ai-chat-footer {
        padding: 10px 12px;
        font-size: 10px;
    }

    /* Phone form full width */
    .ai-chat-phone-form {
        padding: 24px 20px;
    }

    .ai-chat-phone-content h4 {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .ai-chat-phone-content p {
        font-size: 15px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .ai-chat-window {
        height: 90vh;
        max-height: 90vh;
    }
}

/* Prevent body scroll when chat is open on mobile */
@media (max-width: 480px) {
    body.ai-chat-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
}

/* Touch device improvements */
@media (pointer: coarse) {
    /* Larger touch targets */
    .ai-chat-send,
    .ai-chat-close {
        min-width: 44px;
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .ai-chat-button:hover {
        transform: none;
    }

    .ai-chat-send:hover:not(:disabled),
    .ai-chat-close:hover,
    .ai-chat-whatsapp-button:hover {
        opacity: 1;
    }
}

/* Scrollbar styling */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Phone form */
.ai-chat-phone-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
    background: white;
}

.ai-chat-phone-content {
    max-width: 300px;
    width: 100%;
    text-align: center;
}

.ai-chat-phone-content h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 20px;
}

.ai-chat-phone-content p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.ai-chat-phone-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.ai-chat-phone-input:focus {
    outline: none;
    border-color: var(--chat-color, #4CAF50);
}

.ai-chat-phone-submit {
    width: 100%;
    padding: 12px 16px;
    background: var(--chat-color, #4CAF50);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s;
}

.ai-chat-phone-submit:hover {
    opacity: 0.9;
}

.ai-chat-phone-submit:active {
    opacity: 0.8;
}

/* Footer branding */
.ai-chat-footer {
    padding: 8px 12px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Character counter inside footer */
.ai-chat-char-counter {
    font-size: 11px;
    color: #999;
    transition: color 0.3s;
}

.ai-chat-char-count {
    font-weight: 500;
}

.ai-chat-footer a {
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

.ai-chat-footer a:hover {
    color: var(--chat-color, #4CAF50);
}
