/* ==========================================================================
 * Chats Minimizados (Estilo MSN)
 * Extraido de: protected/views/layouts/main.php
 * ========================================================================== */

/* Container que fica na parte inferior da tela */
.minimized-chats-container {
    position: fixed;
    bottom: 0;
    left: 270px;
    right: 100px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    z-index: 9990;
    padding: 0 10px;
    pointer-events: none;
}

/* Cada chat minimizado */
.minimized-chat {
    position: relative;
    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;
    max-width: 220px;
    min-width: 180px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.minimized-chat-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.minimized-chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.minimized-chat-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.minimized-chat-status {
    font-size: 11px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.minimized-chat-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background-color: #90EE90;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.minimized-chat-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;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

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

/* Badge de mensagens nao lidas */
.minimized-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    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;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Estados de inatividade */
.minimized-chat.inactivity-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.minimized-chat.inactivity-warning .minimized-chat-status::before {
    background-color: #fde68a;
}

.minimized-chat.inactivity-critical {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    animation: criticalPulse 1.5s ease-in-out infinite;
}

.minimized-chat.inactivity-critical .minimized-chat-status::before {
    background-color: #fca5a5;
}

@keyframes criticalPulse {
    0%, 100% { box-shadow: 0 -2px 10px rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 -2px 20px rgba(239, 68, 68, 0.6); }
}

/* Modal de aviso de inatividade */
.inactivity-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.inactivity-modal-backdrop.show {
    display: flex;
}

.inactivity-modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.inactivity-modal-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.inactivity-modal h3 {
    margin: 0 0 8px;
    color: #1f2937;
    font-size: 18px;
}

.inactivity-modal p {
    margin: 0 0 20px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

.inactivity-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.inactivity-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.inactivity-modal-btn-open {
    background: #25d366;
    color: white;
}

.inactivity-modal-btn-open:hover {
    background: #128c7e;
}

.inactivity-modal-btn-ok {
    background: #e5e7eb;
    color: #374151;
}

.inactivity-modal-btn-ok:hover {
    background: #d1d5db;
}

/* Animacao de pulso para novas mensagens */
.minimized-chat.has-new-message {
    animation: chatPulse 0.5s ease-in-out;
}

@keyframes chatPulse {
    0% { transform: scale(1); }
    25% { transform: scale(1.05); }
    50% { transform: scale(1); }
    75% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* Badge com animacao de bounce ao aparecer */
.minimized-chat-badge:not([style*="display: none"]) {
    animation: badgeBounce 0.3s ease-out;
}

@keyframes badgeBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Responsivo */
@media (max-width: 1024px) {
    .minimized-chats-container {
        left: 80px;
    }
}

@media (max-width: 768px) {
    .minimized-chats-container {
        left: 10px;
        right: 80px;
    }

    .minimized-chat {
        max-width: 180px;
        min-width: 140px;
        padding: 6px 10px;
    }

    .minimized-chat-photo {
        width: 30px;
        height: 30px;
    }

    .minimized-chat-name {
        font-size: 12px;
    }
}
