/* Root Container */
#wmac-widget-root,
.wmac-widget-root-preview {
    position: fixed;
    z-index: 999999;
    font-family: 'Roboto', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    /* Material Design 3 Variables */
    --wmac-primary: #0073aa;
    --wmac-on-primary: #ffffff;
    --wmac-surface: #ffffff;
    --wmac-on-surface: #1d1b20;
    --wmac-surface-container: #f7f2fa;
    --wmac-outline: #79747e;
    --wmac-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --wmac-shadow-3: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
}

/* Chat Bubble Container */
.wmac-bubble-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Bubble (FAB) */
.wmac-bubble {
    width: 56px;
    height: 56px;
    background-color: var(--wmac-primary);
    border-radius: 50%;
    /* Material 3 FAB shape */
    box-shadow: var(--wmac-shadow-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0.0, 0, 1), box-shadow 0.2s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    overflow: hidden;
    position: relative;
    z-index: 100;
}

.wmac-bubble:hover {
    box-shadow: 0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.3);
    /* Elevation 4 */
    transform: scale(1.05);
    /* Subtle scale */
}

.wmac-bubble:active {
    transform: scale(0.95);
    cursor: grab;
}

.wmac-bubble-icon {
    width: 32px;
    height: 32px;
    fill: var(--wmac-text, #ffffff);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.3s ease;

    /* Absolute Center for Stacking */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.wmac-icon-main {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.wmac-icon-close {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5) rotate(-90deg);
}

/* Open State */
.wmac-bubble.wmac-state-open .wmac-icon-main {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
}

.wmac-bubble.wmac-state-open .wmac-icon-close {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
}

/* Removed wmac-pop-in keyframes in favor of state transitions */

.wmac-bubble img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

/* Bubble Label */
.wmac-bubble-label {
    position: absolute;
    right: 70px;
    /* Default */
    top: 50%;
    transform: translateY(-50%);
    background: var(--wmac-label-bg);
    color: var(--wmac-label-text);
    padding: 6px 16px;
    border-radius: 20px;
    /* Pill shape */
    box-shadow: var(--wmac-shadow-1);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 90;
}

/* Mod: Label to Right (for Left Anchors) */
.wmac-bubble-label.wmac-label-left {
    right: auto;
    left: 70px;
}


/* Agent List window (Card) */
.wmac-agent-list {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    /* Standard width */
    max-width: 90vw;
    background-color: var(--wmac-surface);
    border-radius: 28px;
    /* Material 3 Container Radius */
    box-shadow: var(--wmac-shadow-3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transform-origin: bottom right;
    transition: opacity 0.3s cubic-bezier(0.2, 0.0, 0, 1),
        transform 0.3s cubic-bezier(0.2, 0.0, 0, 1),
        visibility 0.3s;
    pointer-events: none;
}

/* Open State */
.wmac-agent-list.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Alignments */
.wmac-agent-list.wmac-align-left {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.wmac-agent-list.wmac-open-down {
    bottom: auto;
    top: 80px;
    transform-origin: top right;
}

.wmac-agent-list.wmac-open-down.wmac-align-left {
    transform-origin: top left;
}


/* Header */
.wmac-header {
    background-color: var(--wmac-primary);
    color: var(--wmac-text);
    padding: 24px 24px 20px;
    text-align: left;
}

.wmac-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 500;
    /* Regular */
    color: inherit;
    line-height: 28px;
}

.wmac-header p {
    margin: 4px 0 0;
    font-size: 14px;
    opacity: 0.9;
    color: inherit;
    font-weight: 400;
    letter-spacing: 0.25px;
}

/* List */
.wmac-agents {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    max-height: 400px;
    overflow-y: auto;
    background-color: var(--wmac-surface);
}

.wmac-agent {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    overflow: hidden;
    /* Ripple container */
}

/* State Layer */
.wmac-agent:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.wmac-agent:active {
    background-color: rgba(0, 0, 0, 0.1);
}

.wmac-agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    flex-shrink: 0;
    overflow: hidden;
    background-color: var(--wmac-surface-container);
    color: var(--wmac-primary);
}

.wmac-agent-avatar svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.wmac-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wmac-agent-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wmac-agent-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--wmac-on-surface);
    line-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wmac-agent-info p {
    margin: 0;
    font-size: 14px;
    color: var(--wmac-outline);
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}