/* WhatsApp Widget Styles */
.sas-whatsapp-widget {
    position: fixed;
    z-index: 9999;
    transition: all 0.3s ease;
}

.sas-whatsapp-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.sas-whatsapp-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

.sas-whatsapp-widget.top-right {
    top: 20px;
    right: 20px;
}

.sas-whatsapp-widget.top-left {
    top: 20px;
    left: 20px;
}

.sas-whatsapp-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #25D366;
    color: white;
    padding: 12px 16px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.sas-whatsapp-button:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.6);
    color: white;
    text-decoration: none;
}

.sas-whatsapp-button svg {
    flex-shrink: 0;
}

.sas-whatsapp-button span {
    white-space: nowrap;
}

/* Shortcode styles */
.sas-whatsapp-shortcode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #25D366;
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

.sas-whatsapp-shortcode:hover {
    background: #128C7E;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.sas-whatsapp-shortcode svg {
    flex-shrink: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sas-whatsapp-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .sas-whatsapp-widget.bottom-left {
        left: 15px;
    }
    
    .sas-whatsapp-widget.top-right {
        top: 15px;
        right: 15px;
    }
    
    .sas-whatsapp-widget.top-left {
        top: 15px;
        left: 15px;
    }
    
    .sas-whatsapp-button {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .sas-whatsapp-button span {
        display: none;
    }
}

/* WhatsApp Chat Interface */
.sas-whatsapp-chat {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    height: 400px;
    background: #f0f0f0;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sas-chat-header {
    background: #25D366;
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sas-chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sas-chat-info {
    flex: 1;
}

.sas-chat-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.sas-chat-status {
    font-size: 13px;
    opacity: 0.8;
}

.sas-chat-close {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    font-size: 20px;
    transition: background 0.2s;
}

.sas-chat-close:hover {
    background: rgba(255,255,255,0.2);
}

.sas-chat-messages {
    padding: 20px 15px;
    height: 280px;
    overflow-y: auto;
    background: #e5ddd5;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><pattern id="chat-bg" x="0" y="0" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23chat-bg)"/></svg>');
}

.sas-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.sas-message-received {
    align-items: flex-start;
}

.sas-message-sent {
    align-items: flex-end;
}

.sas-message-text {
    background: white;
    padding: 8px 12px;
    border-radius: 18px;
    max-width: 250px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.sas-message-received .sas-message-text {
    background: white;
    border-bottom-left-radius: 4px;
}

.sas-message-sent .sas-message-text {
    background: #dcf8c6;
    border-bottom-right-radius: 4px;
}

.sas-message-time {
    font-size: 11px;
    color: #667781;
    margin-top: 4px;
    padding: 0 8px;
}

.sas-chat-input {
    background: white;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #e0e0e0;
}

.sas-chat-textbox {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 15px;
    border-radius: 20px;
    background: #f0f0f0;
    font-size: 14px;
}

.sas-chat-send {
    width: 40px;
    height: 40px;
    background: #25D366;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sas-chat-send:hover {
    background: #128C7E;
}

.sas-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Mobile: Hide chat interface, show only button */
@media (max-width: 768px) {
    .sas-whatsapp-chat {
        display: none !important;
    }
    
    .sas-whatsapp-button {
        pointer-events: auto;
    }
}

.sas-whatsapp-widget.bottom-right .sas-whatsapp-welcome {
    bottom: 70px;
    right: 0;
}

.sas-whatsapp-widget.bottom-left .sas-whatsapp-welcome {
    bottom: 70px;
    left: 0;
}

.sas-whatsapp-widget.top-right .sas-whatsapp-welcome {
    top: 70px;
    right: 0;
}

.sas-whatsapp-widget.top-left .sas-whatsapp-welcome {
    top: 70px;
    left: 0;
}

.sas-whatsapp-welcome.show {
    opacity: 1;
    transform: translateY(0);
}

.sas-whatsapp-welcome-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border: 8px solid transparent;
}

.sas-whatsapp-widget.bottom-right .sas-whatsapp-welcome-arrow,
.sas-whatsapp-widget.bottom-left .sas-whatsapp-welcome-arrow {
    bottom: -16px;
    left: 20px;
    border-top-color: white;
}

.sas-whatsapp-widget.top-right .sas-whatsapp-welcome-arrow,
.sas-whatsapp-widget.top-left .sas-whatsapp-welcome-arrow {
    top: -16px;
    left: 20px;
    border-bottom-color: white;
}

.sas-whatsapp-welcome-text {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #25D366;
    width: 0;
    animation: typing 3s steps(40, end) forwards, blink-caret 0.75s step-end infinite;
}

/* Typing animation */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #25D366; }
}

/* Pulse animation */
@keyframes whatsapp-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.sas-whatsapp-widget.pulse .sas-whatsapp-button {
    animation: whatsapp-pulse 2s infinite;
}

/* Mobile responsive for welcome text */
@media (max-width: 768px) {
    .sas-whatsapp-welcome {
        max-width: 150px;
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .sas-whatsapp-welcome-text {
        animation: typing 2s steps(30, end), blink-caret 0.75s step-end infinite;
    }
}
