/* Chat Section Styles */
.chat-section {
    margin-top: 0.5rem;
    background-color: var(--pwf-chat-surface);
    border-radius: 8px;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-messages-container {
    max-height: 180px;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    scroll-behavior: smooth;
}

.chat-message {
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    line-height: 1.4;
}

.chat-message-username {
    font-weight: bold;
    color: #2ecc71;
}

.chat-message-time {
    opacity: 0.8;
    font-size: 0.75rem;
}

.chat-empty-state {
    text-align: center;
    color: rgba(255, 255, 255, 0.75);
    font-style: italic;
    padding: 2rem 1rem;
}

.chat-input-form {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem;
    align-items: center;
}

.chat-input-form .chat-input-field {
    flex: 1 1 auto !important;
    min-width: 0;
    width: auto !important;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    color: white;
    font-size: 0.875rem;
    margin: 0 !important;
    height: 36px;
    box-sizing: border-box;
}

.chat-input-field::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.chat-input-field:focus {
    outline: 2px solid #27ae60;
    outline-offset: 1px;
    background-color: rgba(255, 255, 255, 0.15);
}

.chat-input-form .chat-send-button {
    background-color: var(--pwf-success);
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
    height: 36px;
    flex: 0 0 auto !important;
    font-size: 0.875rem;
    width: auto !important;
    margin: 0 !important;
    box-sizing: border-box;
}

.chat-send-button:hover {
    background-color: var(--pwf-success-hover);
}

.chat-send-button:active {
    transform: scale(0.98);
}

/* Chat Collapse/Expand Styles */
.chat-toggle-btn {
    background: none;
    border: none;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.chat-toggle-icon {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
}

.chat-section:not(.chat-collapsed) .chat-toggle-icon {
    transform: rotate(90deg);
}

.chat-collapsed .chat-body {
    display: none;
}

/* Mobile Responsive Styles for Chat */
@media (max-width: 768px) {
    .chat-messages-container {
        max-height: 200px;
    }

    .chat-message {
        font-size: 0.8125rem;
    }

}

@media (max-width: 480px) {
    .chat-section {
        padding: 0.75rem;
    }

    .chat-messages-container {
        max-height: 180px;
        padding: 0.5rem;
    }

    .chat-message {
        font-size: 0.75rem;
    }

    .chat-input-field,
    .chat-send-button {
        font-size: 0.875rem;
    }

    .chat-send-button {
        padding: 0.5rem 0.75rem;
    }
}

/* 1-Tap Quick Chat Reaction Bar */
.quick-chat-bar,
.quick-chat-bar[role="group"] {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
    margin-bottom: 0.5rem;
    box-shadow: none;
}

.quick-chat-bar[role="group"] > button.quick-chat-chip,
.quick-chat-chip {
    flex: 1 1 0;
    min-width: 36px;
    min-height: 36px;
    padding: 0.25rem 0.25rem;
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 999px;
    color: var(--pwf-on-felt);
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(15, 23, 42, 0.45);
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.quick-chat-chip:hover,
.quick-chat-chip:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.65);
}

.quick-chat-chip:active {
    transform: scale(0.95);
}

/* Top Stretch-Zone Table Menu Dropdown */
.table-menu-dropdown {
    position: relative;
    margin: 0 auto 0 0;
}

.table-menu-dropdown > summary.table-menu-trigger {
    list-style: none;
    padding: 0.25rem 0.65rem;
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: auto;
}

.table-menu-dropdown > summary.table-menu-trigger::-webkit-details-marker {
    display: none;
}

.table-menu-popover,
.table-menu-popover[role="group"] {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 950;
    min-width: 210px;
    width: auto;
    margin-bottom: 0;
    padding: 0.5rem;
    border-radius: 8px;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.table-menu-popover[role="group"] > button.table-menu-item,
.table-menu-item {
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
    border-radius: 6px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Desktop (>= 1024px) 2-Column Poker Table + Right-Hand Chat Rail */
@media (min-width: 1024px) {
    #hand-state-section:has(#chat-section:not(.chat-collapsed)) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 310px;
        gap: 0.5rem 1rem;
        align-items: start;
    }

    #hand-state-section:has(#chat-section:not(.chat-collapsed)) > .live-status {
        grid-column: 1 / -1;
    }

    #hand-state-section:has(#chat-section:not(.chat-collapsed)) > #hand-state-content {
        grid-column: 1;
        min-width: 0;
    }

    #hand-state-section:has(#chat-section:not(.chat-collapsed)) > #chat-section {
        grid-column: 2;
        margin-top: 0;
        position: sticky;
        top: 0.75rem;
    }

    #hand-state-section:has(#chat-section:not(.chat-collapsed)) > #chat-section .chat-messages-container {
        max-height: 340px;
    }
}

