﻿/* =========================================================
   SimpleWorkItemChat.css (chat-only, isolated classes)
   Prefix: swchat-
   ========================================================= */

.swchat-shell {
    --swchat-radius: .85rem;
    --swchat-border: var(--bs-border-color, #dee2e6);
    --swchat-bg: var(--bs-body-bg, #fff);
    --swchat-surface: var(--bs-tertiary-bg, #f8f9fa);
    --swchat-text: var(--bs-body-color, #212529);
    --swchat-muted: var(--bs-secondary-color, #6c757d);
    --swchat-shadow: 0 .35rem 1rem rgba(0, 0, 0, .08);
    --swchat-primary-rgb: var(--bs-primary-rgb, 13, 110, 253);
    --swchat-mine-bg: rgba(var(--swchat-primary-rgb), .12);
    --swchat-mine-border: rgba(var(--swchat-primary-rgb), .35);
    --swchat-theirs-bg: var(--swchat-surface);
    --swchat-theirs-border: rgba(0, 0, 0, .12);
    --swchat-header-h: 56px;
    --swchat-compose-h: 68px;
    width: 100%;
    height: 100%;
    min-height: 85vh;
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.swchat-root {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--swchat-bg);
    color: var(--swchat-text);
    border: 1px solid var(--swchat-border);
    border-radius: var(--swchat-radius);
    overflow: hidden;
    min-width: 0;
}

.swchat-header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .5rem .75rem;
    background: var(--swchat-surface);
    border-bottom: 1px solid var(--swchat-border);
    min-height: var(--swchat-header-h);
    transition: top .18s ease, max-height .18s ease, padding .18s ease, border .18s ease;
}

    .swchat-header.hidden {
        top: calc(-1 * var(--swchat-header-h));
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-bottom: 0;
        min-height: 0;
        overflow: hidden;
    }

.swchat-title {
    font-weight: 600;
    display: flex;
    align-items: baseline;
    gap: .5rem;
    line-height: 1.2;
}

.swchat-header-actions {
    display: inline-flex;
    gap: .5rem;
    align-items: center;
}

.swchat-icon-btn,
.swchat-send {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .75rem;
    border: 1px solid var(--swchat-border);
    background: var(--swchat-bg);
    color: var(--swchat-text);
    cursor: pointer;
    user-select: none;
    transition: background .12s ease, border-color .12s ease, transform .05s ease;
}

    .swchat-icon-btn:hover {
        background: var(--swchat-surface);
    }

    .swchat-icon-btn:active,
    .swchat-send:active {
        transform: translateY(1px);
    }

    .swchat-icon-btn .dx-icon,
    .swchat-send .dx-icon {
        font-size: 20px;
        line-height: 1;
    }

.swchat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: .75rem;
    background: var(--swchat-bg);
}

.swchat-empty {
    color: var(--swchat-muted);
    padding: .75rem;
    border: 1px dashed var(--swchat-border);
    border-radius: var(--swchat-radius);
    background: var(--swchat-surface);
}

.swchat-row {
    display: flex;
    margin: .35rem 0;
}

    .swchat-row.mine {
        justify-content: flex-end;
    }

    .swchat-row.theirs {
        justify-content: flex-start;
    }

.swchat-bubble {
    max-width: min(720px, 92%);
    border-radius: var(--swchat-radius);
    padding: .55rem .65rem;
    border: 1px solid var(--swchat-theirs-border);
    background: var(--swchat-theirs-bg);
    box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.swchat-row.mine .swchat-bubble {
    background: var(--swchat-mine-bg);
    border-color: var(--swchat-mine-border);
}

.swchat-meta {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .25rem;
}

.swchat-name {
    font-weight: 700;
    font-size: .9rem;
}

.swchat-time {
    font-size: .8rem;
    color: var(--swchat-muted);
    white-space: nowrap;
}

.swchat-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.35;
}

/* Images */
.swchat-image-grid {
    margin-top: .5rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
}

@media (min-width: 520px) {
    .swchat-image-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.swchat-image-tile {
    position: relative;
    border-radius: .75rem;
    overflow: hidden;
    border: 1px solid var(--swchat-border);
    background: var(--swchat-bg);
    cursor: pointer;
}

    .swchat-image-tile img {
        width: 100%;
        height: 120px;
        object-fit: cover;
        display: block;
    }

.swchat-image-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: .35rem .5rem;
    font-size: .75rem;
    color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0));
    opacity: 0;
    transition: opacity .12s ease;
}

.swchat-image-tile:hover .swchat-image-overlay {
    opacity: 1;
}

/* Lightbox */
.swchat-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

    .swchat-lightbox img {
        max-width: 96vw;
        max-height: 92vh;
        border-radius: var(--swchat-radius);
        border: 1px solid rgba(255,255,255,.18);
    }

/* Compose */
.swchat-compose {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: .5rem;
    align-items: end;
    padding: .6rem .75rem;
    background: var(--swchat-surface);
    border-top: 1px solid var(--swchat-border);
    min-height: var(--swchat-compose-h);
}

.swchat-input {
    resize: none;
    min-height: 44px;
    max-height: 160px;
    padding: .6rem .75rem;
    border-radius: .85rem;
    border: 1px solid var(--swchat-border);
    background: var(--swchat-bg);
    color: var(--swchat-text);
    outline: none;
    width: 100%;
    line-height: 1.25;
}

    .swchat-input:focus {
        border-color: rgba(var(--swchat-primary-rgb), .55);
        box-shadow: 0 0 0 .2rem rgba(var(--swchat-primary-rgb), .15);
    }

label.swchat-icon-btn {
    margin: 0;
}

.swchat-send {
    border-color: rgba(var(--swchat-primary-rgb), .35);
    background: rgba(var(--swchat-primary-rgb), .25);
}

    .swchat-send:hover {
        background: rgba(var(--swchat-primary-rgb), .32);
    }

    .swchat-send:disabled {
        opacity: .45;
        cursor: not-allowed;
        transform: none;
    }
