/* ================================================================
   JogarAirsoft — Chat Panel
   ================================================================ */

.chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.chat-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.chat-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #111;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 24px rgba(0,0,0,0.6);
    overflow: hidden;
}
.chat-panel.open {
    transform: translateX(0);
}

/* ── Header ── */
.chat-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #161616;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
}
.chat-panel-back {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px;
    display: none;
    align-items: center;
    transition: color 0.2s;
    flex-shrink: 0;
}
.chat-panel-back:hover { color: #ee8a04; }
.chat-panel-title-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.chat-panel-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    font-family: 'Roboto', sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}
.chat-panel-subtitle {
    font-size: 11px;
    color: #888;
    font-family: 'Roboto', sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.chat-panel-subtitle.chat-status-online {
    color: #22c55e;
}
.chat-panel-close {
    background: none;
    border: none;
    color: #666;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    transition: color 0.2s;
}
.chat-panel-close:hover { color: #fff; }

/* ── Conversation list ── */
.chat-conv-list {
    flex: 1;
    overflow-y: auto;
    border-top: 2px solid #2a2a2a;
}
.chat-conv-list::-webkit-scrollbar { width: 4px; }
.chat-conv-list::-webkit-scrollbar-track { background: transparent; }
.chat-conv-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.chat-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #1a1a1a;
}
.chat-conv-item:hover { background: #1a1a1a; }

.chat-conv-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}
.chat-conv-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #222;
}
.chat-online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    margin-right: 5px;
    flex-shrink: 0;
    vertical-align: middle;
    position: relative;
    top: -1px;
}
.chat-conv-info {
    flex: 1;
    min-width: 0;
}
.chat-conv-name {
    font-size: 13px;
    font-weight: 600;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Roboto', sans-serif;
}
.chat-conv-team {
    font-size: 10px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
    font-style: italic;
}
.chat-conv-preview {
    font-size: 11px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.chat-conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.chat-conv-time {
    font-size: 10px;
    color: #555;
}
.chat-conv-unread {
    background: #ee8a04;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-sizing: border-box;
    line-height: 16px;
    font-family: 'Roboto', sans-serif;
}

.chat-empty {
    padding: 48px 24px;
    text-align: center;
    color: #555;
    font-size: 13px;
    line-height: 1.7;
    font-family: 'Roboto', sans-serif;
}
/* ── Anonymized / locked conversations ── */
.chat-conv-locked { cursor: pointer; }
.chat-conv-avatar-anon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.chat-conv-avatar-anon::after {
    content: '?';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #444;
}
.chat-anon-blur {
    filter: blur(5px);
    user-select: none;
    color: #888 !important;
}
.chat-premium-lock-banner {
    text-align: center;
    font-size: 12px;
    color: #888;
    padding: 14px 16px;
    border-top: 1px solid #1a1a1a;
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
}
.chat-premium-lock-banner a {
    color: #ee8a04;
    font-weight: 600;
    text-decoration: none;
}
.chat-premium-lock-banner a:hover { text-decoration: underline; }

.chat-30d-notice {
    text-align: center;
    font-size: 10px;
    color: #444;
    padding: 8px 16px 12px;
    font-family: 'Roboto', sans-serif;
    border-top: 1px solid #1a1a1a;
}

.chat-upgrade-banner {
    background: linear-gradient(135deg, #1a1200, #2a1800);
    border: 1px solid #ee8a04;
    border-radius: 8px;
    margin: 10px 12px;
    padding: 10px 12px;
    font-size: 12px;
    color: #ee8a04;
    text-align: center;
    font-family: 'Roboto', sans-serif;
    line-height: 1.5;
}

/* ── Search / Nova Conversa ── */
.chat-new-wrap {
    flex-shrink: 0;
}
.chat-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #161616;
}
.chat-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #ddd;
    font-size: 13px;
    font-family: 'Roboto', sans-serif;
}
.chat-search-input::placeholder { color: #555; }
.chat-search-results {
    max-height: 220px;
    overflow-y: auto;
}
.chat-search-label {
    font-size: 10px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 14px 4px;
}
.chat-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.chat-search-item:hover { background: #1a1a1a; }
.chat-search-empty {
    font-size: 12px;
    color: #555;
    padding: 10px 14px 12px;
    font-family: 'Roboto', sans-serif;
}

/* ── Thread messages ── */
.chat-thread-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 14px;
    display: none;
    flex-direction: column;
    gap: 6px;
}
.chat-thread-messages::-webkit-scrollbar { width: 4px; }
.chat-thread-messages::-webkit-scrollbar-track { background: transparent; }
.chat-thread-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.chat-msg {
    max-width: 80%;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
    font-family: 'Roboto', sans-serif;
}
.chat-msg-in {
    align-self: flex-start;
    background: #1e1e1e;
    color: #ddd;
    border-radius: 12px 12px 12px 2px;
}
.chat-msg-out {
    align-self: flex-end;
    background: #ee8a04;
    color: #fff;
    border-radius: 12px 12px 2px 12px;
    font-weight: 500;
}
.chat-msg-time {
    display: block;
    font-size: 9px;
    margin-top: 3px;
    opacity: 0.55;
    text-align: right;
    color: #fff;
}
.chat-msg-out .chat-msg-time {
    color: #000;
}

/* ── Input ── */
.chat-input-row {
    display: none;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid #1e1e1e;
    background: #111;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    width: 100%;
    box-sizing: border-box;
}
.chat-input {
    flex: 1;
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 18px;
    padding: 8px 14px;
    color: #ddd;
    font-size: 13px;
    font-family: 'Roboto', sans-serif;
    resize: none;
    max-height: 100px;
    min-height: 36px;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.4;
    box-sizing: border-box;
}
.chat-input:focus { border-color: #ee8a04; }
.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ee8a04;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
    color: #fff;
}
.chat-send-btn svg { stroke: #fff; }
.chat-send-btn:hover { background: #d67c04; }
.chat-send-btn:active { transform: scale(0.92); }
