/* PWA push alerts — chat-style bottom inbox */
.pwa-inbox-root {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9996;
    font-family: 'Roboto', 'Public Sans', system-ui, sans-serif;
    pointer-events: none;
}

.pwa-inbox-root * {
    box-sizing: border-box;
}

.pwa-inbox-root.is-active {
    pointer-events: auto;
}

.pwa-inbox-bar {
    pointer-events: auto;
    margin: 0 10px 78px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(135deg, #1a1d21 0%, #2d3238 100%);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.28);
    color: #fff;
    cursor: pointer;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.pwa-inbox-root.is-hidden .pwa-inbox-bar {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
}

.pwa-inbox-bar-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    min-height: 48px;
}

.pwa-inbox-bar-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #c62828;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.pwa-inbox-bar-text {
    flex: 1;
    min-width: 0;
}

.pwa-inbox-bar-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.pwa-inbox-bar-preview {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.pwa-inbox-bar-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #c62828;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-inbox-bar-chevron {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    transition: transform 0.25s ease;
}

.pwa-inbox-root.is-open .pwa-inbox-bar-chevron {
    transform: rotate(180deg);
}

.pwa-inbox-sheet {
    pointer-events: auto;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(72vh, 520px);
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
}

.pwa-inbox-root.is-open .pwa-inbox-sheet {
    transform: translateY(0);
}

.pwa-inbox-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.pwa-inbox-root.is-open .pwa-inbox-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.pwa-inbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
}

.pwa-inbox-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1a1d21;
}

.pwa-inbox-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pwa-inbox-btn-ghost {
    border: none;
    background: transparent;
    color: #c62828;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 8px;
    cursor: pointer;
}

.pwa-inbox-btn-close {
    border: none;
    background: #eee;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #444;
}

.pwa-inbox-categories {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    flex-shrink: 0;
    border-bottom: 1px solid #f0f0f0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.pwa-inbox-categories::-webkit-scrollbar {
    display: none;
}

.pwa-inbox-cat-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pwa-inbox-cat-chip.is-active {
    background: #c62828;
    border-color: #c62828;
    color: #fff;
}

.pwa-inbox-cat-chip .chip-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #eee;
    color: #333;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pwa-inbox-cat-chip.is-active .chip-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.pwa-inbox-cat-chip .chip-badge:not(:empty):not([data-count="0"]) {
    background: #ff5252;
    color: #fff;
}

.pwa-inbox-cat-chip.is-active .chip-badge:not(:empty):not([data-count="0"]) {
    background: rgba(255, 255, 255, 0.35);
}

.pwa-inbox-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #e8e8e8;
    padding: 12px;
}

.pwa-inbox-empty {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 14px;
}

.pwa-inbox-empty i {
    font-size: 36px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.4;
}

.pwa-inbox-msg {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    max-width: 92%;
    animation: pwaInboxFadeIn 0.25s ease;
}

@keyframes pwaInboxFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.pwa-inbox-msg.is-unread .pwa-inbox-bubble {
    border-left: 3px solid #c62828;
}

.pwa-inbox-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: #ddd;
}

.pwa-inbox-bubble {
    background: #fff;
    border-radius: 0 12px 12px 12px;
    padding: 10px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.pwa-inbox-bubble:hover {
    background: #f9f9f9;
}

.pwa-inbox-msg-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a1d21;
    margin: 0 0 4px;
    line-height: 1.3;
}

.pwa-inbox-msg-body {
    font-size: 12px;
    color: #555;
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
}

.pwa-inbox-msg-time {
    font-size: 10px;
    color: #999;
    margin-top: 6px;
    text-align: right;
}

.pwa-inbox-chats {
    display: none;
}

.pwa-inbox-view-chats .pwa-inbox-thread {
    display: none;
}

.pwa-inbox-view-chats .pwa-inbox-chats {
    display: block;
}

.pwa-inbox-view-thread .pwa-inbox-chats {
    display: none;
}

.pwa-inbox-view-thread .pwa-inbox-thread {
    display: block;
}

.pwa-inbox-chat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.pwa-inbox-chat-row:active {
    background: #f5f5f5;
}

.pwa-inbox-chat-row .pwa-inbox-avatar {
    width: 44px;
    height: 44px;
}

.pwa-inbox-chat-meta {
    flex: 1;
    min-width: 0;
}

.pwa-inbox-chat-name {
    font-size: 14px;
    font-weight: 700;
    color: #1a1d21;
    margin: 0 0 4px;
}

.pwa-inbox-chat-preview {
    font-size: 12px;
    color: #777;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-inbox-chat-side {
    text-align: right;
    flex-shrink: 0;
}

.pwa-inbox-chat-time {
    font-size: 10px;
    color: #999;
    display: block;
    margin-bottom: 6px;
}

.pwa-inbox-thread-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 10px;
    margin-bottom: 4px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: #c62828;
    cursor: pointer;
}

@media (min-width: 768px) {
    .pwa-inbox-sheet {
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(100%);
        width: min(420px, 100%);
        border-radius: 16px 16px 0 0;
    }

    .pwa-inbox-root.is-open .pwa-inbox-sheet {
        transform: translateX(-50%) translateY(0);
    }

    .pwa-inbox-bar {
        max-width: 420px;
    }
}
