/* ==========================================================================
 * Popup Flutuante de Lista de Conversas
 * Extraido de: protected/views/layouts/main.php
 * ========================================================================== */

.chat-list-popup {
    position: fixed;
    top: 80px;
    right: 30px;
    width: 420px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9996;
    animation: chatListPopupSlideIn 0.3s ease;
    resize: both;
    min-width: 320px;
    min-height: 400px;
}

@keyframes chatListPopupSlideIn {
    from { transform: translateY(-20px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.chat-list-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: white;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.chat-list-popup-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.chat-list-popup-title i {
    font-size: 18px;
}

.chat-list-popup-actions {
    display: flex;
    gap: 6px;
}

.chat-list-popup-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-list-popup-btn:hover {
    background: rgba(255,255,255,0.3);
}

.chat-list-popup-btn-close:hover {
    background: #dc2626;
}

.chat-list-popup-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Icone MSN para lista minimizada */
.minimized-chat-list {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: white;
    padding: 8px 14px;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    pointer-events: auto;
    min-width: 200px;
    animation: slideUp 0.3s ease-out;
}

.minimized-chat-list:hover {
    transform: translateY(-4px);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.2);
}

.minimized-chat-list-icon {
    font-size: 20px;
}

.minimized-chat-list-text {
    font-weight: 600;
    font-size: 13px;
}

.minimized-chat-list-badge {
    background: #ff4444;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: auto;
}

.minimized-chat-list-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
    padding: 0;
    line-height: 1;
    margin-left: 8px;
}

.minimized-chat-list-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Tabs */
.chat-list-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.chat-list-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.chat-list-tab:hover {
    color: #111827;
    background: #f3f4f6;
}

.chat-list-tab.active {
    color: #25d366;
    border-bottom-color: #25d366;
    background: white;
}

.chat-list-tab .tab-badge {
    background: #e5e7eb;
    color: #4b5563;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.chat-list-tab.active .tab-badge {
    background: #dcfce7;
    color: #25d366;
}

/* Corpo */
.chat-list-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-list-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    z-index: 10;
}

.chat-list-loading.hidden {
    display: none;
}

.chat-list-search {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.chat-list-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.chat-list-search input:focus {
    border-color: #25d366;
}

.chat-list-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.chat-list-content.active {
    display: flex;
    flex-direction: column;
}

.chat-list-items {
    flex: 1;
}

.chat-list-empty {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* Items da lista */
.chat-list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.15s;
}

.chat-list-item:hover {
    background: #f9fafb;
}

.chat-list-item.pending {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
}

.chat-list-item.pending:hover {
    background: #fef3c7;
}

.chat-list-item-avatar {
    position: relative;
    margin-right: 12px;
    flex-shrink: 0;
}

.chat-list-item-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-list-item-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    background: #22c55e;
}

.chat-list-item-status.pending {
    background: #f59e0b;
}

.chat-list-item-status.inactive {
    background: #9ca3af;
}

.chat-list-item-info {
    flex: 1;
    min-width: 0;
}

.chat-list-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.chat-list-item-name {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-list-item-time {
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
    margin-left: 8px;
}

.chat-list-item-phone {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 2px;
}

.chat-list-item-preview {
    font-size: 13px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
