/*
 * De ce exista:
 * Acest fisier stilizeaza ecranul de chat pe job din frontendul V2.
 *
 * Responsabilitate:
 * Pastreaza istoricul si composer-ul lizibile pe mobil, fara sa afecteze alte
 * ecrane de jobs sau reviews.
 *
 * Ce NU face:
 * Nu stilizeaza mesaje pe oferta sau inbox general.
 *
 * Depinde de:
 * CSS-ul shared app-v2 si template-ul job-messages.
 */

.v2-screen--job-messages {
    display: grid;
    gap: 16px;
}

.v2-job-chat-context-card {
    display: grid;
    gap: 14px;
    background: linear-gradient(180deg, rgba(22, 163, 74, 0.05), rgba(255, 255, 255, 0.98));
}

.v2-job-chat-context-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.v2-job-chat-context-item {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(229, 231, 235, 0.95);
}

.v2-job-chat-context-item strong {
    color: #111827;
    font-size: 0.95rem;
}

.v2-job-chat-context-label {
    color: #6b7280;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.v2-job-chat-state-card {
    background: rgba(245, 158, 11, 0.08);
}

.v2-job-chat-state-card.is-muted {
    background: #f9fafb;
}

.v2-job-chat-thread,
.v2-job-chat-composer-card {
    display: grid;
    gap: 14px;
}

.v2-message-list {
    display: grid;
    gap: 12px;
}

.v2-message-bubble {
    border-radius: 20px;
    padding: 14px 16px;
    display: grid;
    gap: 8px;
    max-width: min(100%, 520px);
}

.v2-message-bubble.is-own {
    background: #dcfce7;
    justify-self: end;
}

.v2-message-bubble.is-other {
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

.v2-message-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: #4b5563;
}

.v2-message-body {
    margin: 0;
    color: #111827;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.v2-message-attachments {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.v2-message-attachment {
    border: 0;
    padding: 0;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 14px;
    background: #f3f4f6;
    cursor: pointer;
}

.v2-message-attachment img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.v2-message-attachment:focus-visible,
.v2-job-message-photo-remove:focus-visible {
    outline: 3px solid rgba(22, 163, 74, 0.3);
    outline-offset: 2px;
}

.v2-job-message-photo-tools {
    display: grid;
    gap: 8px;
}

.v2-job-message-photo-hint {
    margin: 0;
    color: #6b7280;
    font-size: 0.88rem;
    line-height: 1.45;
}

.v2-job-message-photo-preview {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(22, 163, 74, 0.16);
    border-radius: 18px;
    background: rgba(22, 163, 74, 0.05);
}

.v2-job-message-photo-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.v2-job-message-photo-preview-head strong {
    color: #111827;
}

.v2-job-message-photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.v2-job-message-photo-preview-item {
    position: relative;
    display: grid;
    gap: 6px;
    margin: 0;
    min-width: 0;
}

.v2-job-message-photo-preview-item img {
    width: 100%;
    aspect-ratio: 1;
    display: block;
    object-fit: cover;
    border-radius: 14px;
    background: #f3f4f6;
}

.v2-job-message-photo-preview-item figcaption {
    overflow: hidden;
    color: #4b5563;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-job-message-photo-remove {
    border: 1px solid rgba(17, 24, 39, 0.12);
    border-radius: 999px;
    padding: 6px 8px;
    background: #ffffff;
    color: #111827;
    font-weight: 800;
    font-size: 0.72rem;
    cursor: pointer;
}

@media (max-width: 420px) {
    .v2-job-chat-context-grid {
        grid-template-columns: 1fr;
    }

    .v2-message-attachments,
    .v2-job-message-photo-preview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
