/**
 * WC B2B Messaging - Frontend Styles
 *
 * @package WC_B2B_Messaging
 */

/* === BADGES & STATUS === */
.wc-b2b-msg-badge {
    background: #d63638;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: top;
}

.wc-b2b-msg-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.wc-b2b-msg-status-nouveau {
    background: #fff3cd;
    color: #856404;
}

.wc-b2b-msg-status-en_cours {
    background: #cce5ff;
    color: #004085;
}

.wc-b2b-msg-status-resolu {
    background: #d4edda;
    color: #155724;
}

/* === CONTAINER === */
.wc-b2b-msg-container {
    max-width: 900px;
}

.wc-b2b-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.wc-b2b-msg-header h3 {
    margin: 0;
}

.wc-b2b-msg-back-link {
    display: inline-block;
    margin-bottom: 15px;
    color: #666;
    text-decoration: none;
}

.wc-b2b-msg-back-link:hover {
    color: #333;
}

.wc-b2b-msg-empty {
    color: #666;
    font-style: italic;
}

/* === TABLE LIST === */
.wc-b2b-msg-table .wc-b2b-msg-has-unread {
    background: #fff8e5 !important;
}

.wc-b2b-msg-unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #c9a227;
    border-radius: 50%;
    margin-right: 8px;
}

.wc-b2b-msg-meta {
    font-size: 12px;
    color: #666;
    margin-top: 3px;
}

/* === PAGINATION === */
.wc-b2b-msg-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.wc-b2b-msg-page-info {
    color: #666;
}

/* === CONVERSATION HEADER === */
.wc-b2b-msg-conv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.wc-b2b-msg-conv-header h3 {
    margin: 0;
}

.wc-b2b-msg-related-info {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* === MESSAGES THREAD === */
.wc-b2b-msg-thread {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #fafafa;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
}

.wc-b2b-msg-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.wc-b2b-msg-bubble.msg-customer {
    background: #007cba;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.wc-b2b-msg-bubble.msg-customer .wc-b2b-msg-date {
    color: rgba(255, 255, 255, 0.7);
}

.wc-b2b-msg-bubble.msg-admin {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #eaeaea;
}

.wc-b2b-msg-bubble-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
    opacity: 0.9;
}

.wc-b2b-msg-date {
    color: #666;
}

.wc-b2b-msg-content {
    line-height: 1.6;
}

/* === REPLY FORM === */
.wc-b2b-msg-reply-form textarea {
    width: 100%;
    margin-bottom: 10px;
}

.wc-b2b-msg-resolved-notice {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.wc-b2b-msg-resolved-notice p {
    margin-bottom: 15px;
}

/* === FORM === */
.wc-b2b-msg-form .required {
    color: #d63638;
}

/* === RESPONSIVE === */
@media screen and (max-width: 768px) {
    .wc-b2b-msg-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .wc-b2b-msg-bubble {
        max-width: 95%;
    }

    .wc-b2b-msg-bubble-header {
        flex-direction: column;
        gap: 5px;
    }

    .wc-b2b-msg-conv-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

/* === DARK MODE === */
html[data-theme='dark'] .wc-b2b-msg-thread {
    background: #111;
    border-color: #333;
}

html[data-theme='dark'] .wc-b2b-msg-bubble.msg-admin {
    background: #222;
    color: #e0e0e0;
    border-color: #444;
}

html[data-theme='dark'] .wc-b2b-msg-bubble.msg-customer {
    background: #0d5f8c; /* Slightly muted blue for dark mode */
}

html[data-theme='dark'] .wc-b2b-msg-related-info,
html[data-theme='dark'] .wc-b2b-msg-resolved-notice {
    background: #111;
    color: #e0e0e0;
}

html[data-theme='dark'] .wc-b2b-msg-header,
html[data-theme='dark'] .wc-b2b-msg-conv-header,
html[data-theme='dark'] .wc-b2b-msg-pagination {
    border-color: #333;
}

html[data-theme='dark'] .wc-b2b-msg-back-link,
html[data-theme='dark'] .wc-b2b-msg-empty,
html[data-theme='dark'] .wc-b2b-msg-page-info,
html[data-theme='dark'] .wc-b2b-msg-date,
html[data-theme='dark'] .wc-b2b-msg-meta {
    color: #aaa;
}

html[data-theme='dark'] .wc-b2b-msg-back-link:hover {
    color: #fff;
}

html[data-theme='dark'] .wc-b2b-msg-table .wc-b2b-msg-has-unread {
    background: #2b2512 !important; /* Dark mode unread highlight */
}

html[data-theme='dark'] .wc-b2b-msg-status-nouveau {
    background: #4a3c10;
    color: #ffd866;
}

html[data-theme='dark'] .wc-b2b-msg-status-en_cours {
    background: #16365a;
    color: #85c2ff;
}

html[data-theme='dark'] .wc-b2b-msg-status-resolu {
    background: #143e21;
    color: #8ce1a6;
}

/* Fix select2 in dark mode if needed */
html[data-theme='dark'] .select2-container--default .select2-selection--single {
    background-color: #222;
    border-color: #444;
}
html[data-theme='dark'] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #e0e0e0;
}
html[data-theme='dark'] .select2-dropdown {
    background-color: #222;
    border-color: #444;
}
html[data-theme='dark'] .select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #333;
}
html[data-theme='dark'] .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #007cba;
}
