/* =========================
   VAPMA Member Dashboard
   Messages
   ========================= */

.vapma-md-message-row {
    display: flex;
    flex-direction: column;
    margin: 10px 0 14px;
}

.vapma-md-message-row.is-mine {
    align-items: flex-end;
    padding-left: 56px;
}

.vapma-md-message-row.is-theirs {
    align-items: flex-start;
    padding-right: 56px;
}

.vapma-md-message-bubble {
    max-width: 62%;
    padding: 12px 14px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.018) 0%, rgba(0,0,0,0.92) 100%);
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow:
        0 8px 22px rgba(0,0,0,0.22),
        inset 0 1px 0 rgba(255,255,255,0.025);
}

.vapma-md-message-row.is-mine .vapma-md-message-bubble {
    background:
        radial-gradient(circle at top right, rgba(207,46,46,0.08) 0%, transparent 52%),
        linear-gradient(180deg, rgba(255,255,255,0.022) 0%, rgba(0,0,0,0.94) 100%);
    border: 1px solid rgba(207,46,46,0.18);
}

.vapma-md-message-bubble p {
    margin: 0;
    color: #f2f2f2;
    font-size: 14px;
    line-height: 1.5;
}

.vapma-md-message-bubble .vapma-md-message-media-link {
    display: inline-block;
    margin: 0;
    color: #f2f2f2;
    font-size: 14px;
    line-height: 1.5;
    text-decoration: none;
}

.vapma-md-message-bubble .vapma-md-message-media-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.vapma-md-message-media-embed {
    margin: 0;
}

.vapma-md-message-media-embed a {
    display: block;
    text-decoration: none;
}

.vapma-md-message-media-preview {
    display: block;
    width: 100%;
    max-width: 260px;
    height: auto;
    border-radius: 10px;
    background: #000;
}

.vapma-md-message-time {
    margin-top: 4px;
    font-size: 9px;
    line-height: 1.2;
    color: #6a6a6a;
    text-align: right;
    opacity: 0.75;
}

.vapma-md-message-row.is-theirs .vapma-md-message-time {
    text-align: left;
}

.vapma-md-message-compose { 
    flex: 0 0 auto;
    background: #0b0b0b;
    padding: 14px 0 0;
    margin-top: 4px;
    border-top: 1px solid #1a1a1a;
}

.vapma-md-message-compose input[type="text"],
.vapma-md-message-compose textarea {
    width: 100%;
    background: #111;
    border: 1px solid #242424;
    color: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.vapma-md-message-compose textarea {
    min-height: 96px;
    resize: vertical;
}

.vapma-md-message-compose button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border: 1px solid #2a2a2a;
    background: #151515;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    white-space: normal;
    text-align: center;
}

.vapma-md-message-compose button:hover {
    border-color: #cf2e2e;
    color: #ffffff;
    background: #181818;
}

/* =========================
   Messages Layout
   ========================= */

.vapma-md-messages-layout {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.vapma-md-messages-main {
    flex: 1 1 auto;
    min-width: 0;
}

.vapma-md-messages-sidebar {
    width: 280px;
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 768px) {
    .vapma-md-messages-layout {
        display: block;
    }

    .vapma-md-messages-main,
    .vapma-md-messages-sidebar {
        width: 100%;
        max-width: 100%;
    }

    .vapma-md-messages-sidebar {
        margin-top: 16px;
    }
   
   .vapma-md-message-bubble {
        max-width: 100%;
    }

    .vapma-md-message-you,
    .vapma-md-message-them {
        margin-left: 0;
        margin-right: 0;
    }
}

.vapma-md-messages-thread-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vapma-md-back-to-messages {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 12px;
    color: #7a7a7a;
    text-decoration: none;
    letter-spacing: 0.04em;
}

.vapma-md-back-to-messages:hover {
    color: #ffffff;
}

.vapma-md-message-send-status {
    margin-top: 8px;
    font-size: 12px;
    color: #b8b8b8;
}

.vapma-md-message-tools {
    margin-bottom: 8px;
}

.vapma-md-message-library-picker {
    margin: 0 0 10px;
    padding: 10px;
    border: 1px solid #242424;
    border-radius: 10px;
    background: #101010;
}

.vapma-md-message-library-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

[data-card="recent-media"] .vapma-md-message-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.vapma-md-message-library-item {
    width: 100%;
    text-align: left;
    font-size: 12px;
    line-height: 1.35;
    padding: 8px;
}

.vapma-md-message-library-thumb-wrap {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.vapma-md-message-library-thumb {
    display: block;
    width: 100%;
    height: 110px;
    object-fit: cover;
    background: #000;
    border-radius: 8px;
}

[data-card="recent-media"] .vapma-md-message-library-thumb-wrap {
    margin-bottom: 0;
    border-radius: 6px;
}

[data-card="recent-media"] .vapma-md-message-library-thumb,
[data-card="recent-media"] video {
    width: 100%;
    height: 88px;
    object-fit: cover;
    display: block;
    border-radius: 6px;
}

.vapma-md-message-library-label {
    display: block;
    font-size: 12px;
    line-height: 1.3;
    color: #d0d0d0;
    word-break: break-word;
}

.vapma-md-message-library-selection {
    margin: 0 0 8px;
}

.vapma-md-message-library-selected {
    display: inline-block;
    padding: 6px 10px;
    border: 1px solid #2a2a2a;
    border-radius: 999px;
    background: #141414;
    color: #e5e5e5;
    font-size: 12px;
    line-height: 1.2;
}

/* Message Center recipient search (flat style) */
.vapma-md-search-result-item {
    display: block;
    width: 100%;
    padding: 6px 8px;
    margin: 2px 0;
    border: 0;
    border-radius: 0;
    background: #0a0a0a;
    color: #dcdcdc;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

/* Message Center recipient dropdown positioning */
#vapma-recipient-results {
    margin-top: -5px;
    margin-bottom: 8px;
    border: 1px solid #202020;
    background: #080808;
    overflow: hidden;
}

#vapma-recipient-results:empty {
    display: none;
}

#vapma-recipient-results .vapma-md-search-result-item {
    margin: 0;
    padding: 7px 9px;
    border: 0;
    border-bottom: 1px solid #181818;
    border-radius: 0;
    background: transparent;
    color: #e5e5e5;
}

#vapma-recipient-results .vapma-md-search-result-item:last-child {
    border-bottom: 0;
}

#vapma-recipient-results .vapma-md-search-result-item:hover {
    background: #141414;
}

/* =========================
   Conversation
   ========================= */

.vapma-md-conversation {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 8px;
    height: auto;
    min-height: 0;
}

.vapma-md-conversation-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;

    -ms-overflow-style: none;
    scrollbar-width: none;
}

.vapma-md-conversation-body::-webkit-scrollbar {
    display: none;
}

.vapma-md-conversation-header {
    margin-bottom: 6px;
}

.vapma-md-conversation-kicker {
    margin: 0 0 4px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a8a8a;
}

.vapma-md-conversation-header h3 {
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
    color: #fff;
}

/* =========================
   Dashboard Thread
   ========================= */

.vapma-member-dashboard .vapma-md-thread-search input[type="text"] {
    width: 100%;
    height: 34px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    color: #cfcfcf;
    padding: 0 12px;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 12px;
    opacity: 0.75;
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.vapma-member-dashboard .vapma-md-thread-search input[type="text"]::placeholder {
    color: #555;
}

.vapma-member-dashboard .vapma-md-thread-search input[type="text"]:hover {
    opacity: 0.9;
}

.vapma-member-dashboard .vapma-md-thread-search input[type="text"]:focus {
    border-color: #cf2e2e;
    background: #101010;
    color: #ffffff;
    opacity: 1;
}

.vapma-md-thread-search input::placeholder {
    color: #7f7f7f;
}

.vapma-md-box[data-thread-id] {
    cursor: pointer;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #1f1f1f;
    background: #0d0d0d;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.vapma-md-box[data-thread-id]:hover {
    background: #141414;
    border-color: #2a2a2a;
}

.vapma-md-thread-card.is-active {
    border-color: rgba(207,46,46,0.55);
    background: #141414;
    box-shadow: inset 0 0 0 1px rgba(207,46,46,0.18);
}

.vapma-md-thread-card.is-unread:not(.is-active) {
    border-color: #2c2c2c;
    background: #121212;
}

.vapma-md-thread-card.is-unread:not(.is-active) .vapma-md-thread-name {
    color: #ffffff;
    font-weight: 700;
}

.vapma-md-thread-card.is-unread:not(.is-active) .vapma-md-thread-preview {
    color: #cfcfcf;
}

.vapma-md-thread-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.vapma-md-thread-name {
    min-width: 0;
    font-size: 14px;
    line-height: 1.2;
    color: #f2f2f2;
    font-weight: 600;
}

.vapma-md-thread-time {
    flex: 0 0 auto;
    font-size: 10px;
    line-height: 1.2;
    color: #7f7f7f;
    white-space: nowrap;
}

.vapma-md-thread-preview {
    font-size: 12px;
    line-height: 1.4;
    color: #9a9a9a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}