/* AI Pet Care Chat Widget Styles */

/* Chat Widget Container */
.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Chat Toggle Button */
.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4d8532 0%, #2e5c23 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(77, 133, 50, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(77, 133, 50, 0.4);
}

.chat-toggle:active {
    transform: scale(0.95);
}

/* Pulse Animation for Attention */
.chat-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: rgba(77, 133, 50, 0.6);
    animation: pulse 2s infinite;
    z-index: -1;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    70% {
        transform: scale(1.4);
        opacity: 0;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Chat Toggle Icons */
.chat-icon,
.close-icon {
    transition: all 0.3s ease;
    position: absolute;
}

.close-icon {
    opacity: 0;
    transform: rotate(180deg);
}

.chat-toggle.active .chat-icon {
    opacity: 0;
    transform: rotate(-180deg);
}

.chat-toggle.active .close-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e5e5;
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Close Button for Chat Header */
.chat-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.chat-close-btn:active {
    transform: scale(0.9) rotate(90deg);
}

/* Mobile Responsive Styles - Professional Modal Design */
@media (max-width: 768px) {
    .ai-chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-toggle {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    
    .chat-window {
        position: fixed;
        bottom: 20px;
        right: 15px;
        left: 15px;
        width: auto;
        height: 75vh;
        max-height: 600px;
        border-radius: 20px;
        transform: translateY(20px) scale(0.95);
    }
    
    .chat-window.active {
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 480px) {
    .ai-chat-widget {
        bottom: 12px;
        right: 12px;
    }
    
    .chat-toggle {
        width: 52px;
        height: 52px;
        font-size: 20px;
    }
    
    .chat-window {
        bottom: 15px;
        right: 10px;
        left: 10px;
        height: 70vh;
        max-height: 550px;
        border-radius: 18px;
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #4d8532 0%, #2e5c23 100%);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    position: relative;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Ccircle cx='7' cy='7' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    opacity: 0.3;
}

.chat-header-content {
    position: relative;
    z-index: 1;
}

.chat-title {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-subtitle {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    font-weight: 400;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.8;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: linear-gradient(135deg, #f8fffe 0%, #f0f8f2 100%);
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(77, 133, 50, 0.3);
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(77, 133, 50, 0.5);
}

/* Message Bubbles */
.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: fadeInUp 0.3s ease;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #4d8532;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    font-weight: 600;
}

.message.user .message-avatar {
    background: #6b7280;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.ai .message-content {
    background: white;
    color: #2c3e50;
    border: 1px solid #e5e5e5;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message.user .message-content {
    background: #4d8532;
    color: white;
    border-bottom-right-radius: 6px;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(77, 133, 50, 0.05);
}

.typing-indicator.active {
    display: flex;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4d8532;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

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

/* Quick Actions */
.quick-actions {
    padding: 15px 20px;
    background: rgba(77, 133, 50, 0.02);
    border-top: 1px solid #f0f0f0;
    display: none;
}

.quick-actions.show {
    display: block;
}

.quick-actions-title {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-button {
    background: white;
    border: 1px solid #e5e5e5;
    color: #4d8532;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-button:hover {
    background: #4d8532;
    color: white;
    border-color: #4d8532;
    transform: translateY(-1px);
}

/* Chat Input */
.chat-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #f0f0f0;
    border-radius: 0 0 16px 16px;
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.input-container:focus-within {
    border-color: #4d8532;
    box-shadow: 0 0 0 3px rgba(77, 133, 50, 0.1);
}

.chat-input-field {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 16px;
    font-size: 14px;
    color: #2c3e50;
    resize: none;
    outline: none;
    max-height: 100px;
    min-height: 20px;
    line-height: 1.4;
}

.chat-input-field::placeholder {
    color: #9ca3af;
}

.send-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4d8532;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    background: #2e5c23;
    transform: scale(1.05);
}

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

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
    color: #6b7280;
}

.welcome-message .pet-icon {
    font-size: 48px;
    color: #4d8532;
    margin-bottom: 16px;
}

.welcome-message h3 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.welcome-message p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .chat-header {
        padding: 16px 50px 16px 16px;
        border-radius: 20px 20px 0 0;
    }
    
    .chat-close-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
        top: 18px;
        right: 14px;
    }
    
    .chat-title {
        font-size: 16px;
    }
    
    .chat-subtitle {
        font-size: 13px;
    }
    
    .chat-messages {
        padding: 16px;
        gap: 12px;
    }
    
    .message-content {
        max-width: 80%;
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .chat-input {
        padding: 12px 16px;
        border-radius: 0;
    }
    
    .input-container {
        padding: 6px;
        border-radius: 22px;
    }
    
    .chat-input-field {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .send-button {
        width: 38px;
        height: 38px;
    }
    
    .quick-actions {
        padding: 12px 16px;
    }
    
    .quick-button {
        font-size: 12px;
        padding: 7px 10px;
    }
    
    .product-recommendation {
        padding: 10px;
        gap: 8px;
    }
    
    .product-recommendation img {
        width: 50px;
        height: 50px;
    }
    
    .product-info h5 {
        font-size: 13px;
    }
    
    .product-price {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 14px 46px 14px 14px;
        border-radius: 18px 18px 0 0;
    }
    
    .chat-close-btn {
        width: 28px;
        height: 28px;
        font-size: 13px;
        top: 16px;
        right: 12px;
    }
    
    .chat-title {
        font-size: 15px;
    }
    
    .chat-subtitle {
        font-size: 12px;
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .message-content {
        font-size: 13px;
        padding: 9px 12px;
    }
    
    .chat-input {
        padding: 10px 12px;
    }
    
    .chat-input-field {
        font-size: 13px;
    }
    
    .send-button {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .product-recommendation img {
        width: 45px;
        height: 45px;
    }
}

/* Link Styles in Messages */
.message-content a {
    color: #4d8532;
    text-decoration: underline;
    font-weight: 500;
}

.message.user .message-content a {
    color: rgba(255, 255, 255, 0.9);
}

.message-content a:hover {
    text-decoration: none;
}

/* Product Recommendations */
.product-recommendation {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
    transition: all 0.2s ease;
}

.product-recommendation:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.product-recommendation img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.product-info h5 {
    margin: 0 0 4px 0;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
}

.product-info p {
    margin: 0;
    font-size: 12px;
    color: #6b7280;
}

.product-recommendation .btn {
    margin-left: auto;
    padding: 4px 12px;
    font-size: 11px;
    border-radius: 15px;
    text-decoration: none;
    background: #4d8532;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.product-recommendation .btn:hover {
    background: #2e5c23;
}