.tms-pw-root {
    position: fixed;
    z-index: 999999;
    display: flex;
    flex-direction: column; /* Default for Top positions */
    gap: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 100%;
    
    /* CRITICAL FIX: Allows clicking through the empty container space */
    pointer-events: none;
}

/* Re-enable clicking on the actual button and panel */
.tms-pw-button, .tms-pw-panel {
    pointer-events: auto;
}

/* LAYOUT FIX: 
   For Bottom positions, reverse the column so the Button is at the bottom 
   and the Panel stacks *above* it. This prevents the button from "jumping" 
   when the panel collapses.
*/
.tms-pw-root.pos-br, .tms-pw-root.pos-bl {
    flex-direction: column-reverse;
}

/* Alignment within the flex container */
.tms-pw-root.pos-br, .tms-pw-root.pos-tr { align-items: flex-end; }
.tms-pw-root.pos-bl, .tms-pw-root.pos-tl { align-items: flex-start; }

.tms-pw-button {
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s, background-color 0.2s;
    white-space: nowrap;
}

.tms-pw-button:hover {
    background: #005177;
    transform: scale(1.05);
}

.tms-pw-panel {
    background: #fff;
    width: 350px;
    max-width: calc(100vw - 40px);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    
    /* Animation hooks */
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease;
    visibility: visible;
}

.tms-pw-header {
    background: #f3f4f6;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    font-weight: bold;
    color: #374151;
}

.tms-pw-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    color: #6b7280;
}

.tms-pw-close:hover {
    color: #ef4444;
}

.tms-pw-body {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Collapsed State */
.tms-pw-root.is-collapsed .tms-pw-panel {
    opacity: 0;
    
    /* Slight movement effect for exit animation */
    transform: translateY(10px) scale(0.95);
    
    visibility: hidden;
    height: 0;
    margin: 0;
    overflow: hidden; /* Ensure content doesn't spill during transition */
}