/* ============ MESSAGE POPUP ============ */
.message-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.message-popup-header {
    background: #007bff;
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.message-popup-header h4 {
    margin: 0;
    font-size: 16px;
}

.message-popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

.message-popup-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ============ LOGIN PROMPT ============ */
.login-prompt {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.login-message {
    margin-bottom: 20px;
    color: #555;
}

.login-message i {
    font-size: 24px;
    color: #ff9800;
    margin-bottom: 10px;
}

.login-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 250px;
}

.btn-login, .btn-register {
    flex: 1;
    padding: 8px 12px;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-login {
    background-color: #007bff;
    color: white;
}

.btn-register {
    background-color: #28a745;
    color: white;
}

.btn-login:hover, .btn-register:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ============ MESSAGE CONTENT ============ */
.message-popup-body {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.message-error {
    background: #ffebee;
    color: #c62828;
    padding: 10px 15px;
    margin: 10px;
    border-radius: 4px;
    border-left: 4px solid #c62828;
    display: none;
    font-size: 14px;
}


.message-bubble {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
}

.message-sent {
    background: #007bff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-received {
    background: #e9ebee;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message-time {
    display: block;
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

/* ============ MESSAGE INPUT ============ */
.message-input-container {
    padding: 15px;
    border-top: 1px solid #eee;
    background: white;
    /* Ensure it stays at bottom */
    position: sticky;
    bottom: 0;
}

.message-form {
    display: flex;
    gap: 8px;
}

.input-group {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.message-form textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    font-size: 14px;
}

.btn-send {
    width: 40px;
    height: 40px;
    min-width: 40px; /* Prevent shrinking */
    border-radius: 50%;
    background: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-send:hover {
    background: #0069d9;
}

.btn-send i {
    font-size: 16px;
}

.btn-send:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.message-counter-bottom {
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* ============ MESSAGE BUTTON ============ */
.message-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #007bff;
    color: white;
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 999;
    transition: all 0.3s;
}

.message-button:hover {
    background: #0069d9;
    transform: translateY(-2px);
}

/* ============ MESSAGE COUNTER ============ */
.message-counter {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
}

.message-counter.limit-reached {
    color: #ff6b6b;
    font-weight: bold;
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 500px) {
    .message-popup {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        bottom: 80px;
        height: 65vh;
    }
    
    .message-button {
        right: 20px;
        bottom: 20px;
    }
    
    .login-actions {
        flex-direction: column;
    }

    .message-history-container {
        padding-bottom: 90px;
        margin-bottom: -90px;
    }
}



/* ============ MESSAGE HISTORY ============ */
.message-history-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    /* Allow space for input container */
    padding-bottom: 80px;
    margin-bottom: -80px;
}



/* ============ OTHER STYLES (keep existing) ============ */
