/* WhatsApp Chat Widget */
.whatsapp-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
}

/* WhatsApp Button (ca în poza) */
.whatsapp-button {
    position: relative;
    width: 60px;
    height: 60px;
    background: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    animation: whatsappBounce 2s infinite;
}

.whatsapp-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.6);
}

.whatsapp-button i {
    font-size: 2rem;
    color: white;
}

/* Pulse Animation */
.whatsapp-pulse {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid #25d366;
    border-radius: 50%;
    animation: whatsappPulse 2s infinite;
    opacity: 0;
}

@keyframes whatsappPulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.3;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

@keyframes whatsappBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Chat Window */
.whatsapp-chat {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-width: calc(100vw - 4rem);
    max-height: calc(100vh - 160px);
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.whatsapp-chat.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    background: #25d366;
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-avatar i {
    font-size: 1.5rem;
    color: white;
}

.chat-info {
    flex: 1;
}

.chat-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: white;
}

.chat-status {
    font-size: 0.8rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-status .online {
    color: #4ade80;
    font-size: 0.6rem;
}

.chat-close {
    width: 2rem;
    height: 2rem;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Content (container pentru tot conținutul cu scroll) */
.chat-content {
    flex: 1;
    overflow-y: auto;
    background: #f0f2f5;
    min-height: 0;
}

/* Chat Messages */
.chat-messages {
    padding: 1rem 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
    animation: messageSlideIn 0.3s ease;
}

.chat-message.incoming {
    background: white;
    align-self: flex-start;
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-message.outgoing {
    background: #dcf8c6;
    align-self: flex-end;
    border-bottom-right-radius: 0.25rem;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing Indicator */
.chat-typing {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #64748b;
}

.typing-indicator {
    display: flex;
    gap: 0.25rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingAnimation {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Quick Replies */
.chat-quick-replies {
    padding: 0.5rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quick-reply {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 1.5rem;
    padding: 0.75rem 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: #374151;
}

.quick-reply:hover {
    background: #e2e8f0;
    border-color: #25d366;
    transform: translateX(5px);
}

.quick-reply i {
    margin-right: 0.5rem;
    color: #25d366;
}

/* Chat Input */
.chat-input {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.chat-send-btn {
    width: 100%;
    background: #25d366;
    color: white;
    border: none;
    border-radius: 1.5rem;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.chat-send-btn:hover {
    background: #128c7e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.chat-send-btn i {
    font-size: 1.125rem;
}

/* Responsive pentru WhatsApp Widget */
@media (max-width: 768px) {
    .whatsapp-widget {
        bottom: 1.5rem;
        right: 1.5rem;
    }
    
    .whatsapp-button {
        width: 55px;
        height: 55px;
    }
    
    .whatsapp-button i {
        font-size: 1.75rem;
    }
    
    .whatsapp-chat {
        width: 300px;
        max-width: calc(100vw - 3rem);
        bottom: 75px;
        right: -10px;
        max-height: calc(100vh - 140px);
    }
}

@media (max-width: 480px) {
    .whatsapp-widget {
        bottom: 1rem;
        right: 1rem;
    }
    
    .whatsapp-button {
        width: 50px;
        height: 50px;
    }
    
    .whatsapp-button i {
        font-size: 1.5rem;
    }
    
    .whatsapp-chat {
        width: 280px;
        max-width: calc(100vw - 2rem);
        bottom: 70px;
        right: 0;
        max-height: calc(100vh - 120px);
    }
    
    .chat-header {
        padding: 0.875rem;
    }
    
    .chat-name {
        font-size: 0.9rem;
    }
    
    .chat-status {
        font-size: 0.75rem;
    }
    
    .chat-messages {
        padding: 0.875rem 0.875rem 0.5rem;
    }
    
    .chat-message {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
    }
    
    .quick-reply {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
    }
    
    .chat-input {
        padding: 0.875rem;
    }
    
    .chat-send-btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.85rem;
    }
    
    .chat-quick-replies {
        padding: 0.5rem 0.875rem 0.875rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .whatsapp-chat {
        width: calc(100vw - 1rem);
        right: 0.5rem;
        max-height: calc(100vh - 100px);
    }
    
    .chat-quick-replies {
        padding: 0.5rem 0.875rem 0.875rem;
    }
}

/* Print styles */
@media print {
    .whatsapp-widget {
        display: none !important;
    }
}

/* Accessibility */
.whatsapp-button:focus,
.chat-close:focus,
.chat-send-btn:focus,
.quick-reply:focus {
    outline: 2px solid #25d366;
    outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .whatsapp-chat {
        background: #1e293b;
    }
    
    .chat-messages {
        background: #0f172a;
    }
    
    .chat-message.incoming {
        background: #374151;
        color: #e2e8f0;
    }
    
    .quick-reply {
        background: #374151;
        border-color: #475569;
        color: #e2e8f0;
    }
    
    .quick-reply:hover {
        background: #475569;
    }
    
    .chat-input {
        background: #1e293b;
        border-color: #374151;
    }
    
    .chat-typing {
        background: #0f172a;
        border-color: #374151;
    }
}
