/**
 * ITT WhatsApp Business Live Chat Popup Styles
 */
.itt-wa-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99990;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.45;
    box-sizing: border-box;
}

.itt-wa-widget *,
.itt-wa-widget *::before,
.itt-wa-widget *::after {
    box-sizing: border-box;
}

/* Floating Toggle Button */
.itt-wa-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #25D366;
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.38), 0 2px 6px rgba(0, 0, 0, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.itt-wa-toggle:hover,
.itt-wa-toggle:focus-visible {
    background-color: #20bd5a;
    transform: scale(1.06);
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.48), 0 4px 10px rgba(0, 0, 0, 0.2);
}

.itt-wa-toggle:active {
    transform: scale(0.97);
}

.itt-wa-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.itt-wa-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.7);
    pointer-events: none;
}

.itt-wa-widget.is-open .itt-wa-icon-whatsapp {
    opacity: 0;
    transform: rotate(90deg) scale(0.7);
    pointer-events: none;
}

.itt-wa-widget.is-open .itt-wa-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Unread notification badge on button */
.itt-wa-toggle-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #e53935;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.itt-wa-widget.is-open .itt-wa-toggle-badge,
.itt-wa-widget.has-interacted .itt-wa-toggle-badge {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

/* Popup Window */
.itt-wa-popup {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.24s;
    pointer-events: none;
}

.itt-wa-widget.is-open .itt-wa-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.itt-wa-header {
    background: linear-gradient(135deg, #075E54 0%, #128C7E 100%);
    color: #ffffff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.itt-wa-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.itt-wa-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.itt-wa-online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background-color: #25D366;
    border: 2px solid #075E54;
}

.itt-wa-header-text {
    min-width: 0;
}

.itt-wa-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.itt-wa-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.88);
    margin-top: 2px;
}

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

.itt-wa-close:hover,
.itt-wa-close:focus-visible {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Chat Body */
.itt-wa-body {
    background-color: #ECE5DD;
    background-image: radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 0);
    background-size: 16px 16px;
    padding: 20px 16px 18px;
    min-height: 170px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.itt-wa-message-bubble {
    position: relative;
    background-color: #ffffff;
    border-radius: 0 12px 12px 12px;
    padding: 10px 14px 8px;
    max-width: 88%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    color: #111b21;
    align-self: flex-start;
}

.itt-wa-message-bubble::before {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 0 solid transparent;
    border-right: 8px solid #ffffff;
    border-bottom: 10px solid transparent;
}

.itt-wa-message-sender {
    font-size: 12px;
    font-weight: 700;
    color: #075E54;
    margin-bottom: 4px;
}

.itt-wa-message-text {
    font-size: 14px;
    color: #111b21;
    word-wrap: break-word;
}

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

/* Vehicle Context Badge */
.itt-wa-vehicle-badge {
    background-color: #dcf8c6;
    border-left: 3px solid #25D366;
    border-radius: 6px;
    padding: 8px 11px;
    font-size: 12.5px;
    color: #111b21;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.itt-wa-vehicle-label {
    font-size: 11px;
    color: #075E54;
    font-weight: 600;
}

.itt-wa-vehicle-title {
    font-weight: 700;
    color: #111b21;
}

/* Footer / Input Area */
.itt-wa-footer {
    background-color: #f0f2f5;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.itt-wa-input {
    flex: 1;
    height: 42px;
    border-radius: 21px;
    border: 1px solid #d1d7db;
    background-color: #ffffff;
    padding: 0 16px;
    font-size: 14px;
    color: #111b21;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.itt-wa-input::placeholder {
    color: #8696a0;
}

.itt-wa-input:focus {
    border-color: #25D366;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.18);
}

.itt-wa-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #25D366;
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.itt-wa-send:hover,
.itt-wa-send:focus-visible {
    background-color: #20bd5a;
    transform: scale(1.04);
}

.itt-wa-send:active {
    transform: scale(0.96);
}

@media (max-width: 480px) {
    .itt-wa-widget {
        bottom: 16px;
        right: 16px;
    }

    .itt-wa-popup {
        width: calc(100vw - 32px);
        bottom: 72px;
    }

    .itt-wa-toggle {
        width: 56px;
        height: 56px;
    }
}
