/* Container */
.dx-livechat-container {
    border: 1px solid #d1d7db;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    width: 100%;
    height: 100%;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Header */
.dx-livechat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    color: #000;
}

.dx-livechat-user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dx-livechat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dx-livechat-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dx-livechat-header-avatar svg {
    width: 22px;
    height: 22px;
    color: #fff;
}

.dx-livechat-title-wrap {
    min-width: 0;
}

.dx-livechat-title {
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    display: inline-block;
    transition: opacity 0.2s;
}

.dx-livechat-title:hover {
    opacity: 0.85;
}

.dx-livechat-participants {
    font-size: 12px;
    color: rgb(87 87 87 / 85%);
    margin-top: 2px;
}

.dx-livechat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dx-livechat-actions button {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #000;
    transition: background 0.2s;
}

.dx-livechat-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dx-livechat-actions #dx-lc-mute .dx-bell-off {
    display: none;
}

.dx-livechat-actions #dx-lc-mute[data-muted="1"] .dx-bell {
    display: none;
}

.dx-livechat-actions #dx-lc-mute[data-muted="1"] .dx-bell-off {
    display: block;
}

.dx-livechat-actions button svg {
    width: 20px;
    height: 20px;
    display: block;
}

.dx-livechat-actions .dx-icon-settings {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Messages Area */
.dx-livechat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    box-sizing: border-box;
    background: #efefef;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    max-height: 55vh;
}

@media (max-width: 600px) {
    .dx-livechat-messages {
        max-height: 45vh;
    }
}

.dx-lc-item {
    display: flex;
    align-items: flex-end;
    margin: 8px 0;
    animation: fadeInMessage 0.3s ease-out;
    gap: 8px;
}

.dx-lc-item.mine {
    flex-direction: row-reverse;
}

.dx-lc-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #e9edef;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dx-lc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dx-lc-avatar svg {
    width: 18px;
    height: 18px;
    color: #8696a0;
}

.dx-lc-item.other .dx-lc-avatar {
    cursor: pointer;
}

.dx-lc-item.other .dx-lc-avatar:hover {
    opacity: 0.9;
}

.dx-lc-body {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.dx-lc-item.mine .dx-lc-body {
    align-items: flex-end;
}

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

.dx-lc-item.other {
    justify-content: flex-start;
}

.dx-lc-reply-to {
    font-size: 12px;
    color: #434343;
    margin-bottom: 4px;
    padding-left: 8px;
    border-left: 3px solid #ff0049;
    background: rgba(0, 0, 0, 0.04);
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.dx-lc-reply-to strong {
    color: #111b21;
}

.dx-lc-reply-to-clickable {
    cursor: pointer;
}

.dx-lc-reply-to-clickable:hover {
    background: rgba(255, 0, 73, 0.12);
}

.dx-lc-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    position: relative;
}

.dx-lc-bubble.dx-lc-bubble-sticker {
    background: transparent !important;
    box-shadow: none !important;
}

.dx-lc-item.mine .dx-lc-bubble {
    background: #fffbe7;
    border-radius: 8px 0 8px 8px;
    min-width: 80px; /* Minimal width to accommodate actions menu */
}

.dx-lc-item.other .dx-lc-bubble {
    background: #fff;
    border-radius: 0 8px 8px 8px;
}

.dx-lc-name {
    font-size: 13px;
    font-weight: 600;
    color: #000;
    margin-bottom: 4px;
}

.dx-lc-item.mine .dx-lc-name {
    display: none;
}

.dx-lc-text {
    font-size: 14px;
    color: #111b21;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.4;
}

.dx-lc-message-sticker-wrap {
    display: block;
    padding-right: 0;
    margin-bottom: 2px;
}

.dx-lc-message-sticker {
    display: block;
    max-width: 128px;
    max-height: 128px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

.dx-lc-time {
    font-size: 10px;
    color: #667781;
    line-height: 1;
    margin: 0 4px;
}

.dx-lc-actions-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
    width: 100%; /* Ensure row takes full width */
}

.dx-lc-like-btn {
    background: none;
    border: none;
    padding: 2px 6px;
    cursor: pointer;
    color: #667781;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.dx-lc-like-btn:hover {
    color: #00a884;
    background: rgba(0, 168, 132, 0.1);
}

.dx-lc-like-btn.liked {
    color: #e74c3c;
}

.dx-lc-like-btn svg {
    width: 14px;
    height: 14px;
}

.dx-lc-reply-btn {
    background: none;
    border: none;
    padding: 2px 4px; /* Reduced padding */
    cursor: pointer;
    color: #667781;
    font-size: 12px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dx-lc-reply-btn svg {
    width: 16px; /* Icon size */
    height: 16px;
    display: block;
}

.dx-lc-reply-btn:hover {
    color: #00a884;
    background: rgba(0, 168, 132, 0.1);
}

/* Reply preview above input - klik untuk scroll ke pesan yang dibalas */
.dx-livechat-reply-preview {
    padding: 8px 16px;
    background: #e7f5e9;
    border-left: 4px solid #00a884;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #111b21;
    cursor: pointer;
    transition: background 0.2s;
}

.dx-livechat-reply-preview.editing-mode {
    background: #e3f2fd;
    border-left-color: #2196f3;
}

.dx-livechat-reply-preview.editing-mode .dx-livechat-reply-label {
    color: #2196f3;
}

.dx-livechat-reply-preview:hover {
    background: #c8e6c9;
}

.dx-livechat-reply-label {
    font-weight: 600;
    color: #00a884;
}

.dx-livechat-reply-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dx-lc-reply-sticker-preview {
    height: 24px;
    width: auto;
    vertical-align: middle;
    display: inline-block;
    border-radius: 4px;
    margin-left: 4px;
}

.dx-livechat-reply-cancel {
    background: none;
    border: none;
    color: #667781;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.dx-livechat-reply-cancel:hover {
    color: #111b21;
}

.dx-livechat-reply-cancel {
    cursor: pointer;
}

/* Highlight singkat saat scroll ke pesan (klik dari preview balas) */
.dx-lc-item-highlight {
    animation: dx-highlight-pulse 1.5s ease-out;
}

@keyframes dx-highlight-pulse {
    0% {
        background: rgba(0, 168, 132, 0.25);
        border-radius: 8px;
    }
    100% {
        background: transparent;
    }
}

.dx-profile-hint {
    font-size: 12px;
    color: #667781;
    margin: -8px 0 16px 0;
}

/* Input Area */
.dx-livechat-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #d1d7db;
    align-items: flex-end;
    background: #f0f2f5;
    position: relative;
    flex-shrink: 0;
}

.dx-lc-sticker-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #8696a0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.dx-lc-sticker-btn:hover {
    color: #00a884;
    background: rgba(0, 168, 132, 0.1);
}

.dx-lc-sticker-btn svg {
    width: 24px;
    height: 24px;
}

.dx-livechat-sticker-panel {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    max-height: 320px;
    background: #ffffff !important;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #cccccc !important;
    overflow: hidden;
    z-index: 10;
}

.dx-livechat-sticker-panel.open {
    display: block;
}

.dx-livechat-sticker-loading {
    padding: 16px;
    text-align: center;
    color: #8696a0;
    font-size: 14px;
}

.dx-livechat-sticker-tabs {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    background: #ffffff !important;
    overflow-x: auto;
}

.dx-livechat-sticker-tabs .dx-lc-sticker-tab {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px;
    overflow: hidden;
    padding: 0;
    cursor: pointer;
    background: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.dx-livechat-sticker-tabs .dx-lc-sticker-tab img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dx-livechat-sticker-tabs .dx-lc-sticker-tab:hover {
    transform: scale(1.05);
}

.dx-livechat-sticker-tabs .dx-lc-sticker-tab.active {
    box-shadow: 0 0 0 2px #00000041;
    border-color: #000 !important;
    background: #ffffff !important;
}

.dx-livechat-sticker-content {
    padding: 12px 16px 16px;
    background: #ffffff !important;
}

.dx-lc-sticker-group-header {
    margin-bottom: 12px;
}

.dx-lc-sticker-group-title {
    font-size: 13px;
    font-weight: 600;
    color: #111b21;
    margin: 0 0 2px 0;
    line-height: 1.2;
}

.dx-lc-sticker-group-by {
    font-size: 11px;
    color: #8696a0;
    margin: 0;
    line-height: 1.2;
}

.dx-livechat-sticker-groups {
    overflow-y: auto;
    max-height: 220px;
}

.dx-lc-sticker-group {
    margin-bottom: 16px;
}

.dx-lc-sticker-group:last-child {
    margin-bottom: 0;
}

.dx-lc-sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
    gap: 24px;
    padding: 16px;
}

.dx-livechat-sticker-groups .dx-lc-sticker-item {
    width: 136px;
    height: 136px;
    padding: 4px;
    border: none !important;
    border-radius: 4px;
    background: #ffffff !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.dx-livechat-sticker-groups .dx-lc-sticker-item:hover {
    background: #ffffff !important;
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.dx-livechat-sticker-groups .dx-lc-sticker-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.dx-livechat-input-wrapper {
    flex: 1;
    position: relative;
    background: #fff;
    border-radius: 24px;
    border: 1px solid #d1d7db;
    transition: border-color 0.2s;
}

.dx-livechat-input-wrapper:focus-within {
    border-color: #000000;
}

.dx-livechat-input textarea {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 24px;
    resize: none;
    overflow-y: hidden;
    box-sizing: border-box;
    background: transparent;
    min-height: 42px;
    max-height: 120px;
    line-height: 22px;
    font-size: 15px;
    font-family: inherit;
}

.dx-livechat-input textarea:focus {
    outline: none;
}

.dx-livechat-input textarea::placeholder {
    color: #8696a0;
}

.dx-livechat-input button {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    flex-shrink: 0;
}

.dx-livechat-input button:hover {
    background: #ffd700;
    color: #000;
    box-shadow: 0 3px 8px rgba(168, 151, 0, 0.4);
}

.dx-livechat-input button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.dx-livechat-input .dx-loading-icon {
    display: none;
}

.dx-livechat-input .dx-send-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.dx-livechat-input .dx-loading-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.dx-livechat-input .dx-rotate {
    animation: dx-spin 1s linear infinite;
}

@keyframes dx-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Footer */
.dx-livechat-footer {
    padding: 8px 0;
    text-align: center;
    font-size: 11px;
    color: #8696a0;
    background: transparent;
    border: none;
    margin-top: 4px;
}

.dx-livechat-footer a {
    color: #000;
    text-decoration: none;
}

.dx-livechat-footer a:hover {
    text-decoration: underline;
}

/* Info Message */
.dx-livechat-info {
    padding: 12px 16px;
    font-size: 13px;
    color: #667781;
    background: #f0f2f5;
    text-align: center;
    border-top: 1px solid #d1d7db;
}

/* Profile Modal */
/* Preview profil user lain */
.dx-user-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.dx-user-preview-modal.active {
    display: flex;
}

.dx-user-preview-content {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    min-width: 200px;
}

.dx-user-preview-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f2f5;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #667781;
}

.dx-user-preview-close:hover {
    background: #e9edef;
    color: #111b21;
}

.dx-user-preview-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 12px;
    background: #e9edef;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dx-user-preview-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dx-user-preview-avatar svg {
    width: 48px;
    height: 48px;
    color: #8696a0;
}

.dx-user-preview-name {
    font-size: 16px;
    font-weight: 600;
    color: #111b21;
}

.dx-profile-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.dx-profile-modal.active {
    display: flex;
}

.dx-profile-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.dx-profile-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e9edef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.dx-profile-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.dx-profile-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.dx-profile-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.dx-profile-body {
    padding: 24px 20px;
}

.dx-profile-avatar {
    text-align: center;
    margin-bottom: 24px;
}

.dx-profile-avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 16px;
    background: #e9edef;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid #000;
}

.dx-profile-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dx-profile-avatar-preview svg {
    width: 60px;
    height: 60px;
    color: #8696a0;
}

.dx-profile-avatar-upload {
    display: inline-block;
    padding: 8px 16px;
    background: #000;
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.dx-profile-avatar-upload:hover {
    background: #ffd700;
        color: #000;
}

.dx-profile-avatar-upload input {
    display: none;
}

.dx-profile-form-group {
    margin-bottom: 20px;
}

.dx-profile-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #111b21;
}

.dx-profile-form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d7db;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.dx-profile-form-group input:focus {
    outline: none;
    border-color: #ffd700;
}

.dx-profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.dx-profile-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.dx-profile-btn-primary {
    background: #000;
    color: #fff;
}

.dx-profile-btn-primary:hover {
    background: #ffd700;
        color: #000;
}

.dx-profile-btn-secondary {
    background: #f0f2f5;
    color: #111b21;
}

.dx-profile-btn-secondary:hover {
    background: #e9edef;
}

/* Scrollbar */
.dx-livechat-messages::-webkit-scrollbar {
    width: 6px;
}

.dx-livechat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.dx-livechat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.dx-livechat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Message Actions Menu */
.dx-lc-actions-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #8696a0;
    padding: 2px;
    display: inline-block;
    opacity: 1;
    margin-left: 4px;
}

.dx-lc-item:hover .dx-lc-actions-menu-btn,
.dx-lc-bubble:hover .dx-lc-actions-menu-btn {
    display: inline-block;
}

.dx-lc-actions-menu-btn:hover {
    color: #000;
}

.dx-lc-actions-menu-btn svg {
    width: 16px;
    height: 16px;
}

.dx-lc-actions-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 100;
    min-width: 120px;
    padding: 4px 0;
    display: none;
    border: 1px solid #e0e0e0;
}

.dx-lc-actions-menu.active {
    display: block;
}

.dx-lc-actions-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: #111b21;
}

.dx-lc-actions-menu button:hover {
    background: #f0f2f5;
}

.dx-lc-actions-menu button.delete-btn {
    color: #ea0038;
}

/* Edit Form */
.dx-lc-edit-form {
    width: 100%;
    min-width: 200px;
}

.dx-lc-edit-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 60px;
    margin-bottom: 4px;
}

.dx-lc-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.dx-lc-edit-btn {
    padding: 4px 8px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.dx-lc-edit-save {
    background: #00a884;
    color: #fff;
}

.dx-lc-edit-cancel {
    background: #e9edef;
    color: #111b21;
}

/* Deleted Message */
.dx-lc-message-deleted {
    font-style: italic;
    color: #8696a0;
    font-size: 13px;
}
