:root {
    --dm-panel-width: 380px;
    --dm-panel-bg: #1e2024;
    --dm-panel-border: rgba(255, 255, 255, 0.08);
    --dm-panel-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    --dm-header-height: 64px;
    --dm-header-bg: rgba(30, 32, 36, 0.95);
    --dm-header-border: rgba(255, 255, 255, 0.08);
    --dm-trigger-size: 56px;
    --dm-trigger-offset: 20px;
    --dm-trigger-bg: rgba(30, 32, 36, 0.95);
    --dm-trigger-border: rgba(255, 255, 255, 0.08);
    --dm-trigger-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    --dm-trigger-glow: 0 0 18px rgba(251, 191, 36, 0.25);
    --dm-message-bg: rgba(255, 255, 255, 0.04);
    --dm-message-sent-bg: rgba(251, 191, 36, 0.15);
    --dm-message-border: rgba(255, 255, 255, 0.08);
    --dm-message-radius: 16px;
    --dm-preset-bg: rgba(255, 255, 255, 0.04);
    --dm-preset-hover-bg: rgba(251, 191, 36, 0.12);
    --dm-preset-border: rgba(255, 255, 255, 0.08);
    --dm-preset-hover-border: rgba(251, 191, 36, 0.3);
    --dm-category-bg: rgba(255, 255, 255, 0.04);
    --dm-category-active-bg: rgba(251, 191, 36, 0.15);
    --dm-category-border: rgba(255, 255, 255, 0.08);
    --dm-category-active-border: rgba(251, 191, 36, 0.3);
    --dm-z: 997;
}

.dm-chat-trigger {
    position: fixed;
    left: var(--dm-trigger-offset);
    bottom: var(--dm-trigger-offset);
    width: var(--dm-trigger-size);
    height: var(--dm-trigger-size);
    border-radius: 50%;
    background: var(--dm-trigger-bg);
    border: 2px solid var(--dm-trigger-border);
    box-shadow: var(--dm-trigger-shadow);
    display: none !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: var(--dm-z);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font: inherit;
    appearance: none;
    outline: none;
}

.dm-chat-trigger svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
    color: rgba(255, 255, 255, 0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dm-chat-trigger:hover {
    box-shadow: var(--dm-trigger-shadow), var(--dm-trigger-glow);
    border-color: rgba(251, 191, 36, 0.4);
    transform: scale(1.05);
}

.dm-chat-trigger:active {
    transform: scale(0.95);
}

.dm-unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid #1e2024;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: dmBadgePulse 1.5s ease-in-out infinite;
}

@keyframes dmBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

.dm-chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 14, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.dm-chat-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.dm-chat-panel {
    position: relative;
    width: min(95vw, 1000px);
    height: 80vh;
    background: var(--dm-panel-bg);
    border: 1px solid var(--dm-panel-border);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 320px 1fr;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.dm-chat-overlay.active .dm-chat-panel {
    transform: scale(1);
}

.dm-chat-header {
    height: var(--dm-header-height);
    background: var(--dm-header-bg);
    border-bottom: 1px solid var(--dm-header-border);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    grid-column: 1 / -1;
}

.dm-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.dm-chat-title svg {
    width: 24px;
    height: 24px;
    color: #fbbf24;
}

.dm-chat-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font: inherit;
    appearance: none;
    outline: none;
}

.dm-chat-close svg {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.7);
}

.dm-chat-close:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
}

.dm-chat-close:hover svg {
    color: #ef4444;
}

.dm-sidebar {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    grid-row: 2;
    grid-column: 1;
}

.dm-chat-view {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    grid-row: 2;
    grid-column: 2;
}

.dm-conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.dm-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.dm-empty-state svg {
    width: 48px;
    height: 48px;
    opacity: 0.4;
}

.dm-empty-state p {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.dm-empty-state span {
    font-size: 13px;
}

.dm-conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.dm-conversation-item:hover {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.2);
    transform: translateX(4px);
}

.dm-conversation-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.dm-conversation-info {
    flex: 1;
    min-width: 0;
}

.dm-conversation-name {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    display: block;
    margin-bottom: 4px;
}

.dm-conversation-preview {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.dm-conversation-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
}

.dm-conversation-unread {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dm-chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dm-chat-user-header {
    height: 64px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.dm-back-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font: inherit;
    appearance: none;
    outline: none;
}

.dm-back-btn svg {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.7);
}

.dm-back-btn:hover {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.3);
}

.dm-back-btn:hover svg {
    color: #fbbf24;
}

.dm-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(251, 191, 36, 0.3);
}

.dm-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dm-user-name {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.dm-user-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dm-user-status.online {
    color: rgba(34, 197, 94, 0.9);
}

.dm-user-status.offline {
    color: rgba(255, 255, 255, 0.4);
}

.dm-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.dm-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dm-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.dm-message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.dm-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.dm-message-content {
    background: var(--dm-message-bg);
    border: 1px solid var(--dm-message-border);
    border-radius: var(--dm-message-radius);
    padding: 10px 14px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

.dm-message.sent .dm-message-content {
    background: var(--dm-message-sent-bg);
    border-color: rgba(251, 191, 36, 0.25);
}

.dm-message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
}

.dm-preset-selector {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(30, 32, 36, 0.95);
    flex-shrink: 0;
    max-height: 52px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.dm-preset-selector.expanded {
    max-height: 280px;
}

.dm-preset-categories {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
}

.dm-category-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--dm-category-bg);
    border: 1px solid var(--dm-category-border);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font: inherit;
    appearance: none;
    outline: none;
}

.dm-category-btn svg {
    width: 16px;
    height: 16px;
}

.dm-category-btn:hover:not(.disabled) {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.dm-category-btn.active {
    background: var(--dm-category-active-bg);
    border-color: var(--dm-category-active-border);
    color: #fbbf24;
}

.dm-category-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
}

.dm-coming-soon {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    color: #3b82f6;
}

.dm-preset-messages {
    padding: 8px 12px 12px 12px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dm-preset-selector.expanded .dm-preset-messages {
    opacity: 1;
}

.dm-preset-message {
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--dm-preset-bg);
    border: 1px solid var(--dm-preset-border);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font: inherit;
    appearance: none;
    outline: none;
}

.dm-preset-message:hover {
    background: var(--dm-preset-hover-bg);
    border-color: var(--dm-preset-hover-border);
    transform: translateX(4px);
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.15);
}

.dm-preset-message:active {
    transform: translateX(2px) scale(0.98);
}

@media (max-width: 767.98px) {
    .dm-chat-panel {
        width: 95vw;
        max-height: 90vh;
    }

    .dm-chat-trigger {
        bottom: 90px;
    }
}

@media (min-width: 768px) {
    .main_content {
        transition: margin-left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
}

.dm-search-bar {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(30, 32, 36, 0.95);
    flex-shrink: 0;
}

.dm-search-bar svg {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.dm-search-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.dm-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.dm-search-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(251, 191, 36, 0.3);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}

.dm-loading {
    padding: 40px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.dm-chat-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font: inherit;
    appearance: none;
    outline: none;
}

.dm-chat-close svg {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.7);
}

.dm-chat-close:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
}

.dm-chat-close:hover svg {
    color: #ef4444;
}

.dm-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.dm-chat-empty svg {
    width: 64px;
    height: 64px;
    opacity: 0.3;
}

.dm-chat-empty p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
}

.dm-preset-toggle {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s ease;
}

.dm-preset-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
}

.dm-preset-toggle-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.dm-preset-toggle-text svg {
    width: 16px;
    height: 16px;
}

.dm-preset-toggle-icon {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease;
}

.dm-preset-selector.expanded .dm-preset-toggle-icon {
    transform: rotate(180deg);
}

@media (max-width: 767.98px) {
    .dm-chat-panel {
        grid-template-columns: 1fr;
        width: 95vw;
        height: 90vh;
    }

    .dm-sidebar {
        display: none;
    }

    .dm-chat-view {
        grid-column: 1;
    }
}

.dm-active-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dm-chat-view {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
