/* ============================================================
   Direct Messaging — Global Styles (loaded in _Layout)
   Matches CLC dark theme with gold accents
   ============================================================ */

/* --- Navbar Badge --- */
.dm-badge {
    display: inline-block;
    background-color: rgb(172, 140, 71);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
    min-width: 18px;
    text-align: center;
    line-height: 1.3;
}

/* --- DM Inbox Panel (dropdown under Messages nav link) --- */
.dm-inbox-panel {
    display: none;
    position: fixed;
    top: 46px;
    right: 60px;
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
    background-color: rgba(30, 30, 30, 0.98);
    border: 1px solid #555;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    z-index: 2000;
}
.dm-inbox-panel.open {
    display: block;
}
.dm-inbox-header {
    padding: 10px 14px;
    border-bottom: 1px solid #444;
    color: rgb(224, 182, 90);
    font-weight: 700;
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dm-inbox-header a {
    color: #888;
    text-decoration: none;
    font-size: 1.1em;
    cursor: pointer;
}
.dm-inbox-header a:hover {
    color: #fff;
}
.dm-inbox-empty {
    padding: 30px 14px;
    text-align: center;
    color: #777;
    font-style: italic;
    font-size: 0.85em;
}

/* --- Conversation Item in Inbox --- */
.dm-conversation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.15s;
}
.dm-conversation-item:hover {
    background-color: rgba(100, 81, 41, 0.3);
}
.dm-conversation-item:last-child {
    border-bottom: none;
}
.dm-conv-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(100, 81, 41, 0.5);
    color: rgb(252, 217, 142);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85em;
    flex-shrink: 0;
}
.dm-conv-info {
    flex: 1;
    min-width: 0;
}
.dm-conv-name {
    color: #eee;
    font-weight: 600;
    font-size: 0.85em;
    margin-bottom: 2px;
}
.dm-conv-preview {
    color: #888;
    font-size: 0.75em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dm-conv-meta {
    text-align: right;
    flex-shrink: 0;
}
.dm-conv-time {
    color: #666;
    font-size: 0.7em;
    display: block;
    margin-bottom: 3px;
}
.dm-conv-unread {
    display: inline-block;
    background-color: rgb(172, 140, 71);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

/* --- DM Chat Popup (bottom-right floating window) --- */
.dm-chat-popup {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 360px;
    height: 480px;
    background-color: rgba(25, 25, 25, 0.98);
    border: 1px solid #555;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    z-index: 2001;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.dm-chat-popup.open {
    display: flex;
}

/* Chat Header */
.dm-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background-color: rgba(100, 81, 41, 0.4);
    border-bottom: 1px solid #444;
    flex-shrink: 0;
}
.dm-chat-header-name {
    color: rgb(252, 217, 142);
    font-weight: 700;
    font-size: 0.9em;
}
.dm-chat-close {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.dm-chat-close:hover {
    color: #fff;
}

/* Chat Messages Area */
.dm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-behavior: smooth;
}

/* Individual DM Bubble */
.dm-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    line-height: 1.4;
    word-wrap: break-word;
}
.dm-bubble.sent {
    align-self: flex-end;
    background-color: rgba(100, 81, 41, 0.5);
    color: rgb(252, 217, 142);
    border-bottom-right-radius: 4px;
}
.dm-bubble.received {
    align-self: flex-start;
    background-color: rgba(60, 60, 60, 0.8);
    color: #ddd;
    border-bottom-left-radius: 4px;
}
.dm-bubble-meta {
    font-size: 0.65em;
    color: #777;
    margin-top: 2px;
}
.dm-bubble.sent .dm-bubble-meta {
    text-align: right;
}

/* Chat Input Area */
.dm-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #444;
    background-color: rgba(30, 30, 30, 0.95);
    flex-shrink: 0;
}
.dm-chat-input-area input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #555;
    border-radius: 20px;
    background-color: #222;
    color: #eee;
    font-size: 0.85em;
    outline: none;
}
.dm-chat-input-area input::placeholder {
    color: #777;
}
.dm-chat-input-area input:focus {
    border-color: rgb(172, 140, 71);
}
.dm-chat-input-area button {
    padding: 8px 16px;
    background-color: rgb(172, 140, 71);
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
}
.dm-chat-input-area button:hover {
    background-color: rgb(119, 97, 48);
}

/* --- Loading indicator --- */
.dm-loading {
    text-align: center;
    padding: 20px;
    color: #777;
    font-style: italic;
    font-size: 0.8em;
}

/* --- Responsive: phone --- */
@media screen and (max-width: 600px) {
    .dm-inbox-panel {
        right: 0;
        left: 0;
        width: 100%;
        top: 46px;
        border-radius: 0;
    }
    .dm-chat-popup {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    .dm-chat-input-area input { font-size: 16px; } /* prevent iOS zoom */
}
/* --- Responsive: tablet --- */
@media screen and (min-width: 601px) and (max-width: 1000px) {
    .dm-inbox-panel {
        right: 10px;
        width: 320px;
    }
    .dm-chat-popup {
        width: 320px;
        height: 420px;
    }
}
