/* ============================================================
   Multi-Agent WhatsApp Chat — Isolated Styles (mawc- prefix)
   ============================================================ */

/* ---------- Reset / Base ---------- */
.mawc-widget *,
.mawc-widget *::before,
.mawc-widget *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.mawc-widget {
    position: fixed !important;
    z-index: 999999 !important;
    bottom: 24px !important;
    left: 24px !important;
    right: auto !important;
    top: auto !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Floating Action Button ---------- */
.mawc-fab {
    position: relative;
    z-index: 2;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.mawc-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45);
    background: #20bd5a;
}

.mawc-fab:focus-visible {
    outline: 3px solid #075e54;
    outline-offset: 4px;
}

.mawc-fab svg {
    display: block;
}

/* ---------- Popup Card ---------- */
.mawc-popup {
    position: absolute;
    bottom: 68px;
    left: 0;
    right: auto;
    top: auto;
    width: 360px;
    max-width: calc(100vw - 48px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.94);
    transform-origin: bottom left;
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s 0.28s;
    pointer-events: none;
}

.mawc-popup.mawc-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s 0s;
    pointer-events: auto;
}

/* ---------- Popup Header ---------- */
.mawc-popup-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    padding: 20px 20px 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.mawc-header-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.mawc-header-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mawc-header-text {
    display: flex;
    flex-direction: column;
}

.mawc-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.mawc-subtitle {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2px;
}

.mawc-close-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.mawc-close-btn:hover {
    background: rgba(255, 255, 255, 0.32);
}

.mawc-close-btn:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}

.mawc-close-btn svg {
    display: block;
}

/* ---------- Popup Body / Agent List ---------- */
.mawc-popup-body {
    padding: 6px 0;
    max-height: 340px;
    overflow-y: auto;
}

/* Agent Row */
.mawc-agent-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    text-decoration: none;
    color: inherit;
    position: relative;
    cursor: pointer;
    transition: background 0.18s ease;
}

.mawc-agent-row:hover {
    background: #f0fdf4;
}

.mawc-agent-row:focus-visible {
    outline: 2px solid #25D366;
    outline-offset: -2px;
    border-radius: 0;
}

/* Subtle divider between rows */
.mawc-agent-row::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 68px;
    right: 20px;
    height: 1px;
    background: #f0f0f0;
}

.mawc-agent-row:last-child::after {
    display: none;
}

/* ---------- Avatar ---------- */
.mawc-avatar {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: #e8f5e9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mawc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mawc-avatar-initials {
    font-size: 18px;
    font-weight: 700;
    color: #2e7d32;
    line-height: 1;
    user-select: none;
}

/* ---------- Agent Info ---------- */
.mawc-agent-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.mawc-agent-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

.mawc-agent-dept {
    font-size: 13px;
    font-weight: 400;
    color: #888;
    margin-top: 1px;
}

/* Arrow indicator */
.mawc-agent-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.45;
    transition: opacity 0.2s ease;
}

.mawc-agent-row:hover .mawc-agent-arrow {
    opacity: 0.8;
}

/* ---------- Scrollbar ---------- */
.mawc-popup-body::-webkit-scrollbar {
    width: 5px;
}

.mawc-popup-body::-webkit-scrollbar-track {
    background: transparent;
}

.mawc-popup-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.mawc-popup-body::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .mawc-widget {
        bottom: 16px !important;
        left: 16px !important;
        right: auto !important;
        top: auto !important;
    }

    .mawc-popup {
        width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        bottom: 64px;
    }

    .mawc-fab {
        width: 50px;
        height: 50px;
    }

    .mawc-fab svg {
        width: 24px;
        height: 24px;
    }
}
