/* Chat Widget Styles */
.rasika-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.rasika-chat-widget.collapsed .chat-body {
    display: none;
}

.rasika-chat-widget.collapsed {
    width: auto;
    min-width: 200px;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #e14d43 0%, #c13b32 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-icon {
    font-size: 20px;
}

.chat-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    font-size: 11px;
    opacity: 0.9;
}

.chat-status.online {
    color: #a5d6a5;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.chat-toggle-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Body */
.chat-body {
    display: block;
}

.chat-messages-container {
    height: 400px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-messages {
    padding: 15px;
    display: flex;
    flex-direction: column;
}

/* Message Bubbles */
.message-item {
    margin-bottom: 15px;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
}

.message-own {
    align-self: flex-end;
}

.message-own .message-bubble {
    background: linear-gradient(135deg, #e14d43 0%, #c13b32 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-other {
    align-self: flex-start;
}

.message-other .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-sender {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
    display: block;
}

.message-own .message-sender {
    color: #ffd4d0;
}

.message-other .message-sender {
    color: #e14d43;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-time {
    font-size: 10px;
    margin-top: 5px;
    display: block;
    opacity: 0.7;
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
}

.user-info-row {
    margin-bottom: 10px;
}

.chat-name-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.chat-name-input:focus {
    outline: none;
    border-color: #e14d43;
}

.message-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-message-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.3s;
}

.chat-message-input:focus {
    outline: none;
    border-color: #e14d43;
}

.send-message-btn {
    background: #e14d43;
    color: white;
    border: none;
    border-radius: 25px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    height: 38px;
    width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-message-btn:hover {
    background: #c13b32;
}

.send-message-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chat-info {
    margin-top: 8px;
    text-align: center;
}

.chat-info small {
    color: #999;
    font-size: 10px;
}

/* Loading and Empty States */
.loading-messages, .empty-messages {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-messages i {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
}

/* Typing Indicator */
.typing-indicator {
    padding: 10px 15px;
    background: white;
    border-radius: 18px;
    display: inline-block;
    margin-bottom: 15px;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Scrollbar Styling */
.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive */
@media (max-width: 480px) {
    .rasika-chat-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .chat-messages-container {
        height: 350px;
    }
    
    .message-bubble {
        max-width: 90%;
    }
}

/* Message Actions */
.message-actions {
    position: absolute;
    top: -20px;
    right: 0;
    display: none;
    background: white;
    border-radius: 4px;
    padding: 2px 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.message-item:hover .message-actions {
    display: block;
}

.message-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 5px;
    color: #999;
}

.message-actions button:hover {
    color: #e14d43;
}

/* Admin Controls in Chat */
.admin-controls {
    position: absolute;
    top: 5px;
    right: 5px;
    display: none;
}

.message-item:hover .admin-controls {
    display: block;
}

.delete-message-btn {
    background: rgba(220, 50, 50, 0.9);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 10px;
}

.delete-message-btn:hover {
    background: #dc3232;
}