/* Buyer conversations — mobile/web only (< xl / 1200px). PC layout largely unchanged. */

@media (max-width: 1199.98px) {
    section.py-5:has(.fw-conversations) {
        padding-top: 0 !important;
        padding-bottom: 16px !important;
    }

    .aiz-main-wrapper:has(.fw-conversations) .fw-mobile-footer {
        margin-top: 0;
    }

    section.py-5:has(.fw-conversations) .container {
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    section.py-5:has(.fw-conversations) .aiz-user-panel {
        padding-left: 0;
        padding-right: 0;
    }

    .fw-conversations {
        padding: 12px 12px 0;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .fw-conv__titlebar-pc {
        display: none !important;
    }

    /* List page header */
    .fw-conv__hero {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 4px 4px 0;
    }

    .fw-conv__hero-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: linear-gradient(135deg, var(--primary, #e62d04), #ff6b35);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        flex-shrink: 0;
        box-shadow: 0 4px 12px rgba(230, 45, 4, 0.25);
    }

    .fw-conv__hero-title {
        margin: 0;
        font-size: 20px;
        font-weight: 700;
        color: #1a1a2e;
    }

    /* Conversation list */
    .fw-conv__list-card {
        border: none;
        border-radius: 14px;
        box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
        margin: 0 !important;
        overflow: hidden;
    }

    .fw-conv__list-card .card-body {
        padding: 0;
    }

    .fw-conv__list {
        margin: 0;
    }

    .fw-conv__item {
        border: none !important;
        border-bottom: 1px solid #f0f2f5 !important;
        padding: 0 !important;
        margin: 0;
        overflow: hidden;
        max-width: 100%;
    }

    .fw-conv__item:last-child {
        border-bottom: none !important;
    }

    .fw-conv__item-link {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        padding: 14px 16px;
        color: inherit;
        text-decoration: none;
        transition: background 0.15s ease;
        box-sizing: border-box;
    }

    .fw-conv__item-link:active {
        background: #f8f9fb;
    }

    .fw-conv__avatar {
        flex-shrink: 0;
    }

    .fw-conv__avatar img {
        width: 48px;
        height: 48px;
        object-fit: cover;
    }

    .fw-conv__content {
        flex: 1 1 0;
        width: 0;
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .fw-conv__row-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        min-width: 0;
    }

    .fw-conv__name {
        flex: 1;
        min-width: 0;
        font-size: 15px;
        color: #1e293b;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .fw-conv__time {
        font-size: 11px;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .fw-conv__row-title {
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
    }

    .fw-conv__subject {
        flex: 1 1 0;
        min-width: 0;
        display: block;
        max-width: 100%;
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .fw-conv__row-title .badge {
        flex-shrink: 0;
    }

    .fw-conv__preview {
        font-size: 13px;
        line-height: 1.4;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .fw-conv__empty {
        text-align: center;
        color: #94a3b8;
        padding: 32px 16px;
        font-size: 14px;
    }

    .fw-conv__pagination {
        padding: 0 0 8px;
        margin: 0;
        justify-content: center;
    }

    .fw-conv__pagination .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    /* Chat detail page — full screen (mobile) */
    body.fw-body-conv-chat {
        overflow: hidden;
    }

    body.fw-body-conv-chat .top-navbar,
    body.fw-body-conv-chat header.z-1020,
    body.fw-body-conv-chat .fw-mobile-footer,
    body.fw-body-conv-chat .aiz-mobile-bottom-nav {
        display: none !important;
    }

    body.fw-body-conv-chat section.py-5 {
        padding: 0 !important;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    body.fw-body-conv-chat section.py-5 .container,
    body.fw-body-conv-chat section.py-5 .d-flex.align-items-start {
        max-width: 100%;
        padding: 0;
        margin: 0;
        min-height: 0;
        height: 100%;
    }

    body.fw-body-conv-chat .aiz-user-sidenav-wrap {
        display: none !important;
    }

    body.fw-body-conv-chat .aiz-user-panel {
        width: 100%;
        padding: 0 !important;
        min-height: 0;
        height: 100%;
    }

    body.fw-body-conv-chat .aiz-main-wrapper {
        min-height: 100dvh;
        height: 100dvh;
        overflow: hidden;
    }

    .fw-conversations--detail.fw-conversations--fullpage {
        gap: 0;
        padding: 0;
        height: 100dvh;
        min-height: 100dvh;
        max-height: 100dvh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .fw-conv__chat-head {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        background: #fff;
        border-bottom: 1px solid #eef1f5;
        flex-shrink: 0;
        z-index: 10;
    }

    .fw-conversations--detail {
        gap: 0;
        padding: 0;
        min-height: calc(100dvh - 56px);
    }

    .fw-conv__mobile-head {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 12px 10px;
        background: #fff;
        border-bottom: 1px solid #eef1f5;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .fw-conv__back {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: #f3f4f6;
        color: #333;
        font-size: 20px;
        text-decoration: none;
        flex-shrink: 0;
    }

    .fw-conv__back:active {
        background: #e8eaed;
    }

    .fw-conv__head-meta {
        min-width: 0;
        flex: 1;
    }

    .fw-conv__head-name {
        margin: 0;
        font-size: 16px;
        font-weight: 700;
        color: #1e293b;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .fw-conv__head-sub {
        margin: 2px 0 0;
        font-size: 12px;
        color: #64748b;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .fw-conversations--detail .fw-conv__panel {
        flex: 1;
        display: flex;
        flex-direction: column;
        border: none;
        border-radius: 0;
        box-shadow: none;
        margin: 0 !important;
        min-height: 0;
    }

    .fw-conv__panel-head-pc {
        display: none !important;
    }

    .fw-conversations--detail .fw-conv__body {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 0 !important;
        min-height: 0;
    }

    .fw-conv__messages {
        flex: 1;
        overflow-y: auto;
        padding: 12px;
        background: #f5f6f8;
        min-height: 0;
        max-height: none;
        -webkit-overflow-scrolling: touch;
    }

    body.fw-body-conv-chat .fw-conversations--detail .fw-conv__messages {
        min-height: 0;
        max-height: none;
    }

    /* Message bubbles */
    .fw-conv__msg {
        display: flex;
        align-items: flex-end;
        gap: 8px;
        margin-bottom: 14px;
        max-width: 100%;
    }

    .fw-conv__msg--mine {
        flex-direction: row-reverse;
    }

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

    .fw-conv__msg-body {
        max-width: calc(100% - 44px);
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .fw-conv__msg--mine .fw-conv__msg-body {
        align-items: flex-end;
    }

    .fw-conv__msg-name {
        font-size: 11px;
        font-weight: 600;
        color: #64748b;
        padding-left: 4px;
    }

    .fw-conv__bubble {
        display: inline-block;
        padding: 10px 14px;
        border-radius: 16px;
        font-size: 14px;
        line-height: 1.45;
        word-break: break-word;
        white-space: pre-wrap;
    }

    .fw-conv__msg--theirs .fw-conv__bubble {
        background: #fff;
        color: #1e293b;
        border: 1px solid #e8eaed;
        border-bottom-left-radius: 4px;
    }

    .fw-conv__msg--mine .fw-conv__bubble {
        background: linear-gradient(135deg, var(--primary, #e62d04), #ff6b35);
        color: #fff;
        border-bottom-right-radius: 4px;
    }

    .fw-conv__msg-time {
        font-size: 10px;
        color: #94a3b8;
        padding: 0 4px;
    }

    .fw-conv__msg--mine .fw-conv__msg-time {
        text-align: right;
    }

    .fw-conv__msg-image-link {
        display: block;
        max-width: min(220px, 70vw);
        border-radius: 12px;
        overflow: hidden;
        line-height: 0;
    }

    .fw-conv__msg-image {
        display: block;
        width: 100%;
        height: auto;
        max-height: 220px;
        object-fit: cover;
        border-radius: 12px;
        border: 1px solid rgba(0, 0, 0, 0.06);
    }

    .fw-conv__msg--mine .fw-conv__msg-image-link {
        margin-left: auto;
    }

    /* Compose bar */
    .fw-conv__compose {
        flex-shrink: 0;
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-top: 1px solid #eef1f5;
        margin: 0;
    }

    .fw-conv__image-preview {
        position: relative;
        display: inline-block;
        margin-bottom: 8px;
    }

    .fw-conv__image-preview img {
        width: 72px;
        height: 72px;
        object-fit: cover;
        border-radius: 10px;
        border: 1px solid #e2e8f0;
    }

    .fw-conv__image-remove {
        position: absolute;
        top: -6px;
        right: -6px;
        width: 22px;
        height: 22px;
        border: none;
        border-radius: 50%;
        background: #ef4444;
        color: #fff;
        font-size: 14px;
        line-height: 1;
        padding: 0;
        cursor: pointer;
    }

    .fw-conv__compose-inner {
        display: flex;
        align-items: flex-end;
        gap: 8px;
    }

    .fw-conv__attach {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: #f3f4f6;
        color: #64748b;
        font-size: 22px;
        margin: 0;
        flex-shrink: 0;
        cursor: pointer;
    }

    .fw-conv__attach:active {
        background: #e8eaed;
    }

    .fw-conv__input {
        flex: 1;
        border-radius: 12px !important;
        border-color: #e2e8f0 !important;
        resize: none;
        min-height: 44px;
        max-height: 120px;
        font-size: 14px;
        padding: 10px 14px;
    }

    .fw-conv__send {
        flex-shrink: 0;
        min-width: 72px;
        min-height: 44px;
        border-radius: 12px !important;
        font-weight: 600;
        padding: 0 16px;
    }
}

/* PC: bubble chat in detail view (uses shared partial) */
@media (min-width: 1200px) {
    .fw-conv__mobile-head {
        display: none !important;
    }

    .fw-conversations--detail .fw-conv__messages {
        max-height: 520px;
        overflow-y: auto;
        padding: 16px;
        background: #f8f9fb;
        border-radius: 8px;
        margin-bottom: 16px;
    }

    .fw-conv__msg {
        display: flex;
        align-items: flex-end;
        gap: 10px;
        margin-bottom: 16px;
    }

    .fw-conv__msg--mine {
        flex-direction: row-reverse;
    }

    .fw-conv__msg-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        object-fit: cover;
    }

    .fw-conv__msg-body {
        max-width: 70%;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .fw-conv__msg--mine .fw-conv__msg-body {
        align-items: flex-end;
    }

    .fw-conv__msg-name {
        font-size: 12px;
        font-weight: 600;
        color: #64748b;
    }

    .fw-conv__bubble {
        display: inline-block;
        padding: 10px 14px;
        border-radius: 14px;
        line-height: 1.45;
        word-break: break-word;
        white-space: pre-wrap;
    }

    .fw-conv__msg--theirs .fw-conv__bubble {
        background: #fff;
        border: 1px solid #e8eaed;
    }

    .fw-conv__msg--mine .fw-conv__bubble {
        background: var(--soft-primary, rgba(230, 45, 4, 0.12));
        color: #1e293b;
    }

    .fw-conv__msg-time {
        font-size: 11px;
        color: #94a3b8;
    }

    .fw-conv__compose-inner {
        display: block;
    }

    .fw-conv__send {
        margin-top: 0;
    }

    .fw-conv__item-link {
        display: flex;
        align-items: flex-start;
        gap: 14px;
        padding: 12px 0;
        color: inherit;
        text-decoration: none;
    }

    .fw-conv__item-link:hover {
        color: inherit;
        text-decoration: none;
    }

    .fw-conv__content {
        flex: 1;
        min-width: 0;
    }

    .fw-conv__row-top {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        margin-bottom: 4px;
        min-width: 0;
    }

    .fw-conv__name {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .fw-conv__row-title {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 4px;
        min-width: 0;
        width: 100%;
    }

    .fw-conv__subject {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
