/**
 * Enhanced WhatsApp Integration Styles
 * Modern, responsive design with animations and accessibility features
 */

/* WhatsApp Integration Container */
.whatsapp-integration {
    position: relative;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Floating WhatsApp Button */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.whatsapp-button {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: whatsapp-float 3s ease-in-out infinite;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.whatsapp-button:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 20px 40px rgba(37, 211, 102, 0.4);
    background: linear-gradient(135deg, #128c7e, #075e54);
}

.whatsapp-button.chat-open {
    background: linear-gradient(135deg, #128c7e, #075e54);
    transform: scale(0.9);
}

.whatsapp-icon {
    color: white;
    font-size: 28px;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.whatsapp-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.3);
    animation: whatsapp-pulse 2s infinite;
}

.whatsapp-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #1a1a1a;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.whatsapp-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid #1a1a1a;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.whatsapp-button:hover .whatsapp-tooltip {
    opacity: 1;
    visibility: visible;
    right: 80px;
}

@keyframes whatsapp-float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
    }
    50% { 
        transform: translateY(-10px) rotate(2deg); 
    }
}

@keyframes whatsapp-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* WhatsApp Chat Widget */
.whatsapp-chat-widget {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: translateX(400px) scale(0.8);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.whatsapp-chat-widget.active {
    transform: translateX(0) scale(1);
    opacity: 1;
}

.chat-header {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.chat-status {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: status-pulse 2s infinite;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

@keyframes status-pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.5; 
        transform: scale(1.2);
    }
}

.chat-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.message {
    margin-bottom: 16px;
    max-width: 80%;
    animation: message-slide-in 0.3s ease-out;
}

.message.received {
    margin-right: auto;
}

.message.sent {
    margin-left: auto;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.received .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message.sent .message-content {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 4px;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

.message.received .message-time {
    text-align: left;
}

.chat-actions {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.quick-action-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #495057;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: #e9ecef;
    color: #212529;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.quick-action-btn i {
    margin-right: 4px;
    font-size: 10px;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

#chat-input:focus {
    outline: none;
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.send-btn {
    background: linear-gradient(135deg, #25d366, #128c7e);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Typing Indicator */
.typing-indicator {
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 60px;
}

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

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* WhatsApp CTA Banner */
.whatsapp-cta-banner {
    position: fixed;
    bottom: 100px;
    left: 30px;
    right: 30px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(37, 211, 102, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.whatsapp-cta-banner.show {
    transform: translateY(0);
    opacity: 1;
}

.whatsapp-cta-banner.hide {
    transform: translateY(100px);
    opacity: 0;
}

.cta-content {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
}

.cta-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    animation: cta-bounce 2s infinite;
}

@keyframes cta-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.cta-text {
    flex: 1;
}

.cta-text h4 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
}

.cta-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.cta-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cta-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cta-btn.primary {
    background: white;
    color: #25d366;
}

.cta-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.3);
}

.cta-btn.secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.cta-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.cta-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
}

.cta-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Owner Modal */
.owner-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
    animation: fadeInModal 0.3s ease-out;
}

.owner-modal-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInModal 0.3s ease-out;
}

.owner-modal-header {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    padding: 24px;
    text-align: center;
    position: relative;
}

.owner-modal-header i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.owner-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.owner-modal-body {
    padding: 24px;
}

.owner-modal-body p {
    margin: 0 0 20px 0;
    color: #666;
    line-height: 1.6;
}

#owner-message {
    width: 100%;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#owner-message:focus {
    outline: none;
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.owner-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px;
}

.owner-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInModal {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Product Share Button */
.share-product-whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.share-product-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.4);
}

.share-product-whatsapp:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
    }

    .whatsapp-button {
        width: 55px;
        height: 55px;
    }

    .whatsapp-icon {
        font-size: 24px;
    }

    .whatsapp-chat-widget {
        bottom: 80px;
        right: 20px;
        left: 20px;
        width: auto;
        height: 70vh;
        max-height: 500px;
    }

    .whatsapp-cta-banner {
        bottom: 80px;
        left: 20px;
        right: 20px;
    }

    .cta-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .cta-actions {
        justify-content: center;
    }

    .owner-modal-content {
        width: 95%;
        margin: 20px;
    }
}

@media (max-width: 480px) {
    .whatsapp-chat-widget {
        bottom: 70px;
        right: 10px;
        left: 10px;
        height: 60vh;
    }

    .chat-header {
        padding: 16px;
    }

    .chat-messages {
        padding: 16px;
    }

    .chat-actions {
        padding: 12px 16px;
    }

    .quick-actions {
        gap: 6px;
    }

    .quick-action-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .message {
        max-width: 90%;
    }

    .whatsapp-cta-banner {
        bottom: 70px;
        left: 10px;
        right: 10px;
        padding: 16px;
    }

    .cta-text h4 {
        font-size: 16px;
    }

    .cta-text p {
        font-size: 13px;
    }

    .cta-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .whatsapp-chat-widget {
        background: #1a1a1a;
        border-color: #333;
    }

    .chat-messages {
        background: #0f0f0f;
    }

    .message-content {
        color: #e5e7eb;
    }

    .message.sent .message-content {
        background: linear-gradient(135deg, #25d366, #128c7e);
        color: white;
    }

    .message.received .message-content {
        background: #2a2a2a;
        color: #e5e7eb;
        border-color: #333;
    }

    .chat-actions {
        background: #1a1a1a;
        border-color: #333;
    }

    .quick-action-btn {
        background: #2a2a2a;
        border-color: #333;
        color: #e5e7eb;
    }

    .quick-action-btn:hover {
        background: #333;
        color: white;
    }

    #chat-input {
        background: #2a2a2a;
        border-color: #333;
        color: #e5e7eb;
    }

    #chat-input:focus {
        background: #1a1a1a;
        border-color: #25d366;
    }

    .whatsapp-cta-banner {
        background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
        border-color: #333;
    }

    .cta-text h4 {
        color: #e5e7eb;
    }

    .cta-text p {
        color: #9ca3af;
    }

    .cta-btn.secondary {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
    }

    .cta-btn.secondary:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .owner-modal-content {
        background: #1a1a1a;
        color: #e5e7eb;
    }

    .owner-modal-body p {
        color: #9ca3af;
    }

    #owner-message {
        background: #2a2a2a;
        border-color: #333;
        color: #e5e7eb;
    }

    #owner-message:focus {
        background: #1a1a1a;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .whatsapp-button {
        border: 3px solid white;
    }

    .message {
        border: 2px solid currentColor;
    }

    .quick-action-btn {
        border: 2px solid currentColor;
    }

    #chat-input {
        border: 2px solid currentColor;
    }

    .cta-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .whatsapp-button,
    .whatsapp-chat-widget,
    .whatsapp-cta-banner,
    .message,
    .typing-dots span,
    .cta-icon,
    .status-dot {
        animation: none;
        transition: none;
    }
}

/* Focus Styles for Accessibility */
.whatsapp-button:focus,
.chat-close:focus,
.send-btn:focus,
.cta-btn:focus,
.cta-close:focus,
.owner-modal-close:focus,
.quick-action-btn:focus {
    outline: 3px solid #25d366;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .whatsapp-integration {
        display: none !important;
    }
} 