/* ServiceProxy.net - Chat System Styles */
/* Complete chat system with all functionality consolidated */

/* Chat Button - ULTIMATE RIGHT POSITIONING */
html body .chat-button,
html body #chatButton,
body .chat-button,
body #chatButton,
div .chat-button,
div #chatButton,
.chat-button,
#chatButton {
    position: fixed !important;
    right: 30px !important;
    bottom: 30px !important;
    left: unset !important;
    top: unset !important;
    width: 60px !important;
    height: 60px !important;
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 999999 !important;
    box-shadow: 0 8px 25px rgba(0, 102, 204, 0.3) !important;
    transition: all 0.3s ease !important;
    color: #ffffff !important;
    font-size: 24px !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    transform: translateZ(0) !important;
    float: none !important;
    clear: none !important;
    text-align: center !important;
    inset-inline-start: unset !important;
    inset-inline-end: 30px !important;
    margin-left: unset !important;
    margin-right: 30px !important;
}

/* Chat Button Hover State */
html body .chat-button:hover,
html body #chatButton:hover,
body .chat-button:hover,
body #chatButton:hover,
div .chat-button:hover,
div #chatButton:hover,
.chat-button:hover,
#chatButton:hover {
    transform: translateY(-3px) scale(1.05) translateZ(0) !important;
    box-shadow: 0 12px 30px rgba(0, 102, 204, 0.4) !important;
    right: 30px !important;
    left: unset !important;
    margin-left: unset !important;
    margin-right: 30px !important;
}

/* Chat Button Mobile Responsiveness */
@media (max-width: 768px) {
    html body .chat-button,
    html body #chatButton,
    body .chat-button,
    body #chatButton,
    div .chat-button,
    div #chatButton,
    .chat-button,
    #chatButton {
        right: 20px !important;
        bottom: 20px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
        inset-inline-end: 20px !important;
        margin-right: 20px !important;
        margin-left: unset !important;
    }
}

/* Chat Pulse Animation */
.chat-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #0066cc;
    animation: chatPulse 3s ease-in-out infinite;
}

@keyframes chatPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.3; }
}

/* Chat Notification Badge */
.chat-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #dc3545;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Chat Popup Styles */
.chat-popup {
    position: fixed !important;
    bottom: 100px !important;
    right: 30px !important;
    width: 380px !important;
    height: 500px !important;
    background: #ffffff !important;
    border-radius: 24px !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
    z-index: 9999 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(20px) scale(0.95) !important;
    transition: all 0.3s ease !important;
    overflow: hidden !important;
    border: 2px solid #f1f5f9 !important;
}

.chat-popup.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%) !important;
    padding: 20px 25px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    color: #ffffff !important;
    position: relative !important;
    overflow: hidden !important;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 70% 70%, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.chat-header-info {
    position: relative;
    z-index: 2;
}

.chat-header h4 {
    margin: 0 0 4px 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
}

.chat-status {
    font-size: 12px !important;
    opacity: 0.8 !important;
}

.close-chat {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: #ffffff !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    position: relative !important;
    z-index: 2 !important;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: rotate(90deg) !important;
}

/* Chat Messages */
.chat-messages {
    height: 320px !important;
    overflow-y: auto !important;
    padding: 20px !important;
    background: #f8fafc !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
}

.message {
    display: flex !important;
    gap: 10px !important;
    animation: messageSlideIn 0.4s ease-out !important;
}

.message.admin {
    justify-content: flex-start !important;
}

.message.user {
    justify-content: flex-end !important;
}

.avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #ffffff !important;
    font-size: 16px !important;
    flex-shrink: 0 !important;
}

.message-content {
    max-width: 70% !important;
    padding: 12px 16px !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    position: relative !important;
}

.message.admin .message-content {
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%) !important;
    color: #ffffff !important;
}

.message.user .message-content {
    background: #edf2f7 !important;
    color: #2d3748 !important;
}

.message-content p {
    margin: 0 0 8px 0 !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
}

.message-time {
    font-size: 11px !important;
    opacity: 0.7 !important;
}

/* Chat Input */
.chat-input {
    padding: 20px !important;
    background: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
    display: flex !important;
    gap: 12px !important;
}

.chat-input input {
    flex: 1 !important;
    padding: 12px 16px !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    outline: none !important;
    transition: all 0.3s ease !important;
}

.chat-input input:focus {
    border-color: #0066cc !important;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1) !important;
}

.chat-input button {
    width: 44px !important;
    height: 44px !important;
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%) !important;
    border: none !important;
    border-radius: 50% !important;
    color: #ffffff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    font-size: 16px !important;
}

.chat-input button:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 25px rgba(0, 102, 204, 0.3) !important;
}

/* Chat System Enhancements */
.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 10px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #718096;
    border-radius: 50%;
    animation: typingPulse 1.5s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* Chat Message Reactions */
.message-reactions {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.reaction-btn {
    background: rgba(0, 102, 204, 0.1);
    border: 1px solid rgba(0, 102, 204, 0.2);
    border-radius: 8px;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reaction-btn:hover {
    background: rgba(0, 102, 204, 0.2);
}

/* Chat Quick Actions */
.chat-quick-actions {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.quick-action-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: #edf2f7;
}

/* Chat File Upload */
.chat-file-upload {
    position: relative;
    display: inline-block;
}

.chat-file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.chat-file-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-file-btn:hover {
    background: #0066cc;
    color: #ffffff;
}

/* Chat Status Indicators */
.chat-user-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    position: absolute;
    bottom: 2px;
    right: 2px;
}

.chat-user-status.online {
    background: #28a745;
}

.chat-user-status.away {
    background: #ffc107;
}

.chat-user-status.offline {
    background: #718096;
}

/* Mobile Chat Popup */
@media (max-width: 768px) {
    .chat-popup {
        width: calc(100vw - 40px) !important;
        max-width: 350px !important;
        right: 20px !important;
        bottom: 80px !important;
        height: 450px !important;
    }
    
    .chat-messages {
        height: 280px !important;
    }
}

/* Chat Mobile Optimizations */
@media (max-width: 480px) {
    .chat-quick-actions {
        padding: 8px 15px !important;
    }

    .quick-action-btn {
        padding: 4px 8px !important;
        font-size: 11px !important;
    }

    .chat-file-btn {
        width: 28px !important;
        height: 28px !important;
    }
}

/* Ultimate Chat Button Position Enforcement */
.chat-button[style*="left"],
#chatButton[style*="left"] {
    left: unset !important;
    right: 30px !important;
    margin-left: unset !important;
    margin-right: 30px !important;
}

/* RTL Support Override */
[dir="rtl"] .chat-button,
[dir="rtl"] #chatButton {
    right: 30px !important;
    left: unset !important;
    inset-inline-start: unset !important;
    inset-inline-end: 30px !important;
    margin-left: unset !important;
    margin-right: 30px !important;
}

/* Final positioning enforcement - No exceptions */
.chat-button {
    right: 30px !important;
    left: unset !important;
    inset-inline-start: unset !important;
    inset-inline-end: 30px !important;
    margin-left: unset !important;
    margin-right: 30px !important;
}

#chatButton {
    right: 30px !important;
    left: unset !important;
    inset-inline-start: unset !important;
    inset-inline-end: 30px !important;
    margin-left: unset !important;
    margin-right: 30px !important;
}

/* Prevent any framework overrides */
.chat-button,
#chatButton {
    position: fixed !important;
    right: 30px !important;
    bottom: 30px !important;
    left: unset !important;
    top: unset !important;
    margin: 0 !important;
    float: none !important;
    display: flex !important;
    inset-inline-start: unset !important;
    inset-inline-end: 30px !important;
}

/* Animation for message slide in */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .chat-popup {
        background: #1a202c !important;
        border-color: #404040 !important;
    }

    .chat-messages {
        background: #2d2d2d !important;
    }

    .message.admin .message-content {
        background: linear-gradient(135deg, #0066cc 0%, #004499 100%) !important;
    }

    .message.user .message-content {
        background: #404040 !important;
        color: #ffffff !important;
    }

    .chat-input {
        background: #1a202c !important;
        border-color: #404040 !important;
    }

    .chat-input input {
        background: #2d2d2d !important;
        color: #ffffff !important;
        border-color: #404040 !important;
    }
}