/* WP Chat Contact - Frontend Styles */

#wp-chat-contact-widget {
    --primary-color: #25D366;
    --secondary-color: #075E54;
    --text-color: #333;
    --light-text: #fff;
    --chat-bg: #ECE5DD;
    --bubble-in: #DCF8C6;
    --bubble-out: #fff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-color);
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* Chat Icon */
#wp-chat-contact-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease;
}

#wp-chat-contact-icon:hover {
    transform: scale(1.1);
}

#wp-chat-contact-icon img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.wp-chat-contact-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #FF3B30;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: var(--shadow);
}

/* Chat Container */
#wp-chat-contact-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    height: 400px;
    background-color: var(--chat-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

#wp-chat-contact-container.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Chat Header */
#wp-chat-contact-header {
    background-color: var(--secondary-color);
    color: var(--light-text);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wp-chat-contact-profile {
    display: flex;
    align-items: center;
}

.wp-chat-contact-profile img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.wp-chat-contact-profile span {
    font-weight: 600;
}

.wp-chat-contact-close {
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* Chat Messages */
#wp-chat-contact-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wp-chat-contact-message {
    display: flex;
    margin-bottom: 10px;
}

.wp-chat-contact-message.outgoing {
    justify-content: flex-end;
}

.wp-chat-contact-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    background-color: var(--bubble-in);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

.wp-chat-contact-message.outgoing .wp-chat-contact-bubble {
    background-color: var(--bubble-out);
}

.wp-chat-contact-text {
    word-wrap: break-word;
}

.wp-chat-contact-text p:first-child {
    margin-top: 0;
}

.wp-chat-contact-text p:last-child {
    margin-bottom: 0;
}

.wp-chat-contact-time {
    font-size: 11px;
    color: #999;
    text-align: right;
    margin-top: 3px;
}

/* Typing Indicator */
.wp-chat-contact-typing {
    background-color: #E6E6E6;
    min-width: 60px;
    animation: typingPulse 1.5s infinite;
}

@keyframes typingPulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Quick Links */
.wp-chat-contact-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.wp-chat-contact-quick-link {
    background-color: var(--primary-color);
    color: var(--light-text);
    padding: 6px 12px;
    border-radius: 16px;
    text-decoration: none;
    font-size: 13px;
    display: inline-block;
    transition: background-color 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.wp-chat-contact-quick-link:hover {
    background-color: var(--secondary-color);
    color: var(--light-text);
}

/* Input Area */
#wp-chat-contact-input-area {
    background-color: white;
    padding: 10px;
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

#wp-chat-contact-input {
    flex: 1;
    border: none;
    padding: 8px 12px;
    border-radius: 18px;
    background-color: #F0F0F0;
    outline: none;
}

#wp-chat-contact-input:focus {
    background-color: #E8E8E8;
}

#wp-chat-contact-send {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    margin-left: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

#wp-chat-contact-send:hover {
    background-color: var(--secondary-color);
}

#wp-chat-contact-send i {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 14px !important;
    color: white !important;
    width: auto !important;
    height: auto !important;
}

/* Hide any potential conflicting elements */
#wp-chat-contact-send svg {
    display: none !important;
}

/* WhatsApp-style Message */
.wp-chat-contact-bubble::before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    bottom: 0;
    left: -6px;
    background-color: var(--bubble-in);
    clip-path: polygon(0 0, 100% 100%, 100% 0);
}

.wp-chat-contact-message.outgoing .wp-chat-contact-bubble::before {
    left: auto;
    right: -6px;
    background-color: var(--bubble-out);
    clip-path: polygon(0 100%, 100% 0, 0 0);
}

/* Animation for bubbles */
@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wp-chat-contact-message {
    animation: bubbleIn 0.3s ease;
}

/* Hide elements */
.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    #wp-chat-contact-container {
        width: calc(100vw - 40px);
        height: 400px;
        bottom: 80px;
    }
}

/* Mobile: Bubble (Sprechblase) ausblenden - nur Icon sichtbar */
@media (max-width: 768px) {
    #wp-chat-contact-bubble {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* Custom Scrollbar */
#wp-chat-contact-messages::-webkit-scrollbar {
    width: 6px;
}

#wp-chat-contact-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

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

/* Neue Nachrichtenblase-Styles */
#wp-chat-contact-bubble {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 280px;
    background-color: white !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    cursor: pointer !important;
    z-index: 9998 !important;
    display: block !important;
    /* Striktes Styling, um Konflikte zu vermeiden */
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    text-align: left !important;
}

#wp-chat-contact-bubble.hidden {
    opacity: 0 !important;
    transform: translateY(20px) !important;
    pointer-events: none !important;
    display: none !important;
}

.wp-chat-contact-bubble-header {
    display: flex !important;
    align-items: center !important;
    padding: 8px 12px !important;
    background-color: #075E54 !important; /* Benutze die vordefinierten Farben */
    color: white !important;
}

.wp-chat-contact-bubble-header img {
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    margin-right: 8px !important;
    object-fit: cover !important;
}

.wp-chat-contact-bubble-header span {
    font-weight: 600 !important;
    font-size: 13px !important;
    color: white !important;
}

.wp-chat-contact-bubble-content {
    padding: 10px 12px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    background-color: white !important;
    color: #333 !important;
    max-height: 200px !important;
    overflow-y: auto !important;
    position: relative !important;
}

.wp-chat-contact-bubble-content p {
    margin: 0 0 10px 0 !important;
}

.wp-chat-contact-bubble-content p:last-child {
    margin-bottom: 0 !important;
}

/* Pfeil am unteren Ende der Blase */
.wp-chat-contact-bubble-content::after {
    content: "" !important;
    position: absolute !important;
    bottom: -8px !important;
    right: 24px !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 8px solid transparent !important;
    border-right: 8px solid transparent !important;
    border-top: 8px solid white !important;
}

/* Animation für die Nachrichtenblase */
@keyframes bubble-in {
    0% { opacity: 0; transform: translateY(20px) scale(0.8); }
    70% { opacity: 1; transform: translateY(-5px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

#wp-chat-contact-bubble:not(.hidden) {
    animation: bubble-in 0.5s ease-out forwards !important;
}