/* Chat Popup Widget Styles */

/* Notification Badge */
.chat-unread-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #ff073a, #ff4757);
    color: white;
    font-size: 0.85rem;
    font-weight: 900;
    font-family: 'Exo 2', sans-serif;
    padding: 0.35rem 0.6rem;
    border-radius: 20px;
    min-width: 28px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(255,7,58,0.8), 0 0 0 3px rgba(255,255,255,0.5);
    border: 3px solid rgba(255,255,255,1);
    animation: badgePulse 1.5s ease-in-out infinite;
    z-index: 10;
}

.chat-unread-badge.hidden {
    display: none;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 6px 20px rgba(255,7,58,0.8), 0 0 0 3px rgba(255,255,255,0.5);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 8px 30px rgba(255,7,58,1), 0 0 0 4px rgba(255,255,255,0.8);
    }
}

/* Chat Popup */
.chat-popup {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 150px);
    background: linear-gradient(145deg, rgba(7,16,31,0.98), rgba(5,10,20,0.98));
    border: 2px solid rgba(179,0,255,0.4);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    display: none;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
}

.chat-popup.open {
    display: flex;
}

/* Prevent body scroll when popup is open */
body.chat-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100%;
    left: 0;
    right: 0;
}

.chat-popup-header {
    background: linear-gradient(135deg, #b300ff, #8a2be2);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

.chat-popup-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

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

.chat-popup-close:hover {
    background: rgba(255,255,255,0.2);
}

.chat-popup-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
}

.chat-msg.user {
    background: linear-gradient(135deg, rgba(0,243,255,0.25), rgba(0,243,255,0.15));
    border: 1px solid rgba(0,243,255,0.4);
    align-self: flex-end;
    text-align: right;
    margin-left: auto;
}

.chat-msg.staff {
    background: linear-gradient(135deg, rgba(179,0,255,0.25), rgba(138,43,226,0.15));
    border: 1px solid rgba(179,0,255,0.4);
    align-self: flex-start;
    text-align: left;
    margin-right: auto;
}

.chat-msg-sender {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-msg.user .chat-msg-sender {
    color: #00f3ff;
}

.chat-msg.staff .chat-msg-sender {
    color: #b300ff;
}

.chat-msg-text {
    color: white;
    font-size: 14px;
    line-height: 1.4;
}

.chat-msg-time {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    margin-top: 5px;
}

.chat-msg-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer;
    display: block;
}

.chat-msg-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 8px;
    color: #00f3ff;
    text-decoration: none;
    font-size: 13px;
}

.chat-msg-file:hover {
    background: rgba(0,243,255,0.1);
}

.chat-popup-input {
    padding: 12px;
    border-top: 1px solid rgba(179,0,255,0.3);
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(0,0,0,0.3);
    flex-wrap: nowrap;
}

.chat-image-btn, .chat-send-btn {
    background: linear-gradient(135deg, #b300ff, #8a2be2);
    border: none;
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 16px;
}

.chat-image-btn:hover, .chat-send-btn:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #d400ff, #b300ff);
}

.chat-popup-input input[type="text"] {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(179,0,255,0.3);
    border-radius: 20px;
    padding: 10px 12px;
    color: white;
    font-size: 16px;
    max-width: calc(100% - 90px); /* Leave room for both buttons */
}

.chat-popup-input input[type="text"]:focus {
    outline: none;
    border-color: #b300ff;
    font-size: 16px; /* Keep 16px on focus */
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-popup {
        width: 320px;
        max-width: calc(100vw - 40px);
        height: 400px;
        bottom: 80px;
        right: 20px;
        left: auto;
        margin: 0;
    }
    
    .chat-popup-header {
        padding: 12px;
    }
    
    .chat-popup-title {
        font-size: 0.9rem;
    }
    
    .chat-popup-messages {
        padding: 10px;
    }
    
    .chat-msg {
        font-size: 13px;
        max-width: 85%;
    }
    
    .chat-popup-input {
        padding: 8px 6px;
        gap: 4px;
    }
    
    .chat-popup-input input[type="text"] {
        padding: 8px 10px;
        font-size: 16px;
        min-width: 0;
        flex: 1 1 auto;
        max-width: calc(100% - 80px); /* Ensure buttons fit */
    }
    
    .chat-image-btn, .chat-send-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 14px;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .chat-popup {
        width: 300px;
        max-width: calc(100vw - 30px);
        height: 380px;
        right: 15px;
    }
    
    .chat-msg {
        max-width: 90%;
    }
    
    .chat-popup-input {
        padding: 6px 4px;
        gap: 3px;
    }
    
    .chat-popup-input input[type="text"] {
        padding: 7px 8px;
        max-width: calc(100% - 75px); /* Even tighter for phones */
    }
    
    .chat-image-btn, .chat-send-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
    }
}
