/* Chat Widget Styles for Plaza IT */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Unicode icons (no Font Awesome dependency) */
.chat-widget .fa-comments,
.chat-widget .fas.fa-comments {
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", serif !important;
    font-style: normal;
}

.chat-widget .fa-comments::before,
.chat-widget .fas.fa-comments::before {
    content: "💬";
}

.chat-widget .fa-paper-plane,
.chat-widget .fas.fa-paper-plane {
    font-family: "Segoe UI Symbol", "Symbola", serif !important;
    font-style: normal;
}

.chat-widget .fa-paper-plane::before,
.chat-widget .fas.fa-paper-plane::before {
    content: "➤";
}

.chat-widget .fa-times,
.chat-widget .fas.fa-times {
    font-family: "Segoe UI Symbol", "Symbola", serif !important;
    font-style: normal;
}

.chat-widget .fa-times::before,
.chat-widget .fas.fa-times::before {
    content: "✕";
}

.chat-widget .fa-user-circle,
.chat-widget .fas.fa-user-circle {
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", serif !important;
    font-style: normal;
}

.chat-widget .fa-user-circle::before,
.chat-widget .fas.fa-user-circle::before {
    content: "👤";
}

.chat-widget .fa-refresh,
.chat-widget .fa.fa-refresh {
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", serif !important;
    font-style: normal;
}

.chat-widget .fa-refresh::before,
.chat-widget .fa.fa-refresh::before {
    content: "🔄";
}

/* Fallback untuk browser yang tidak support emoji */
.no-emoji-support .chat-widget .fa-comments::before { 
    content: "💭";
    font-family: Arial, sans-serif;
}
.no-emoji-support .chat-widget .fa-paper-plane::before { 
    content: "➤";
    font-family: Arial, sans-serif;
}
.no-emoji-support .chat-widget .fa-times::before { 
    content: "✕";
    font-family: Arial, sans-serif;
    font-weight: bold;
}
.no-emoji-support .chat-widget .fa-user-circle::before { 
    content: "●";
    font-family: Arial, sans-serif;
}
.no-emoji-support .chat-widget .fa-refresh::before { 
    content: "↻";
    font-family: Arial, sans-serif;
}

/* Reset font families untuk konsistensi */
.chat-widget i[class*="fa-"] {
    font-style: normal !important;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.chat-widget-trigger {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: all 0.3s ease;
    position: relative;
}

.chat-widget-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.chat-widget-trigger .unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

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

.chat-widget-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-widget-window.show {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

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

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.chat-message.own {
    align-items: flex-end;
}

.chat-message.other {
    align-items: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.own .message-bubble {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.other .message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    padding: 0 4px;
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 4px;
    padding: 0 4px;
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid #e9ecef;
    background: white;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 80px;
    min-height: 40px;
}

.chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    background: #667eea;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
}

.chat-error {
    background: #fee;
    color: #c53030;
    padding: 12px 16px;
    margin: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid #fed7d7;
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.typing-dots {
    display: inline-flex;
    margin-left: 8px;
}

.typing-dots span {
    height: 4px;
    width: 4px;
    background: #666;
    border-radius: 50%;
    display: inline-block;
    margin: 0 1px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .chat-widget-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: -10px;
    }
}