/* WhatsApp Live Chat Widget Styles */

:root {
    --whatsapp-green: #25D366;
    --whatsapp-dark-green: #128C7E;
    --whatsapp-light-green: #DCF8C6;
    --text-dark: #303030;
    --text-light: #667781;
    --background-white: #fff;
    --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-strong: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* Main Widget Container */
.whatsapp-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* WhatsApp Button */
.whatsapp-button {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-dark-green) 100%);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-strong);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInUp 0.5s ease-out;
}

.whatsapp-button:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 40px rgba(37, 211, 102, 0.4);
}

.whatsapp-button:active {
    transform: scale(0.95);
}

/* WhatsApp Icon */
.whatsapp-icon {
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 2;
}

/* Pulse Animation */
.whatsapp-pulse {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: var(--whatsapp-green);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    opacity: 0.6;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Notification Badge */
.whatsapp-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FF3B30;
    color: white;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
    border: 2px solid white;
    animation: bounce 2s ease-in-out infinite;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.whatsapp-notification-badge.show {
    opacity: 1;
    transform: scale(1);
    display: flex;
}

.whatsapp-notification-badge.hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* Pulse Animation for Button */
.whatsapp-button.pulse-animation {
    animation: pulse-button 0.6s ease-in-out;
}

@keyframes pulse-button {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.15);
    }

    50% {
        transform: scale(1.05);
    }

    75% {
        transform: scale(1.12);
    }

    100% {
        transform: scale(1);
    }
}

/* Chat Box */
.whatsapp-chat-box {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: var(--background-white);
    border-radius: 16px;
    box-shadow: var(--shadow-strong);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideInUp 0.3s ease-out;
    max-height: calc(100vh - 120px);
}

.whatsapp-chat-box.active {
    display: flex;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--whatsapp-dark-green) 0%, #0d6e62 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

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

.chat-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-avatar svg {
    width: 28px;
    height: 28px;
}

.chat-info h4 {
    color: #fff;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    background: #4EF763;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(78, 247, 99, 0.7);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(78, 247, 99, 0);
    }
}

.chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

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

/* Chat Body */
.chat-body {
    background: #E5DDD5;
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 255, 255, .03) 10px, rgba(255, 255, 255, .03) 20px),
        repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(0, 0, 0, .02) 10px, rgba(0, 0, 0, .02) 20px);
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    max-height: 400px;
}

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

.chat-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

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

.chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Chat Messages */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.received {
    align-self: flex-start;
}

.message.sent {
    align-self: flex-end;
}

.message-content {
    background: white;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message.received .message-content {
    border-top-left-radius: 2px;
}

.message.sent .message-content {
    background: var(--whatsapp-light-green);
    border-top-right-radius: 2px;
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-dark);
}

.message-content p+p {
    margin-top: 6px;
}

.message-time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    padding: 0 6px;
    align-self: flex-end;
}

/* Chat Footer */
.chat-footer {
    background: white;
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.start-chat-button {
    width: 100%;
    background: var(--whatsapp-green);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.start-chat-button:hover {
    background: #22c55e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.start-chat-button:active {
    transform: translateY(0);
}

.chat-footer-note {
    margin: 8px 0 0;
    font-size: 11px;
    color: var(--text-light);
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .whatsapp-chat-widget {
        bottom: 15px;
        right: 15px;
    }

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

    .whatsapp-icon {
        width: 28px;
        height: 28px;
    }

    .whatsapp-chat-box {
        width: calc(100vw - 30px);
        bottom: 75px;
        right: -7.5px;
    }

    .chat-body {
        max-height: 350px;
    }
}

/* Hidden State */
.whatsapp-button.hidden-by-user {
    display: none;
}

/* Accessibility */
.whatsapp-button:focus,
.chat-close:focus,
.start-chat-button:focus {
    outline: 2px solid var(--whatsapp-green);
    outline-offset: 2px;
}

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