/* ========================================
   LEADS
======================================== */

.leads-summary{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:18px;
    margin-bottom:28px;
}

.lead-summary-card{

    background:#fff;

    border-radius:22px;

    padding:24px;

    display:flex;

    align-items:center;

    gap:18px;

    border:1px solid rgba(15,23,42,.05);

    box-shadow:0 15px 35px rgba(15,23,42,.08);

    transition:.25s;
}

.lead-summary-card:hover{

    transform:translateY(-4px);
}

.lead-summary-card p{

    margin:0;

    color:#64748b;

    font-size:14px;

    font-weight:600;
}

.lead-summary-card strong{

    display:block;

    margin-top:6px;

    font-size:34px;

    color:#0f172a;
}

/* ========================================
   TOOLBAR
======================================== */

.leads-toolbar{

    display:flex;

    gap:16px;

    margin-bottom:25px;

    padding:22px;
}

.leads-toolbar input{

    flex:1;

    height:48px;

    border:1px solid #dbe3ee;

    border-radius:14px;

    padding:0 18px;

    font-size:15px;

    outline:none;

    transition:.2s;
}

.leads-toolbar input:focus{

    border-color:#22c55e;
}

.leads-toolbar select{

    width:220px;

    border:1px solid #dbe3ee;

    border-radius:14px;

    padding:0 16px;

    font-size:15px;

    background:#fff;
}

/* ========================================
   LISTA
======================================== */

.leads-list{

    display:flex;

    flex-direction:column;

    gap:16px;
}

/* ========================================
   CARD
======================================== */

.lead-card{

    display:grid;

    grid-template-columns:70px 90px 1fr auto;

    gap:18px;

    align-items:center;

    background:#fff;

    border-radius:18px;

    border:1px solid #e8eef5;

    padding:16px 20px;

    transition:.25s;

    cursor:pointer;
}

.lead-card:hover{

    border-color:#22c55e;

    box-shadow:0 12px 35px rgba(0,0,0,.08);

    transform:translateY(-2px);
}

/* ========================================
   AVATAR
======================================== */

.lead-avatar{

    width:56px;

    height:56px;

    border-radius:50%;

    background:linear-gradient(135deg,#2563eb,#14b8a6);

    color:#fff;

    font-size:18px;

    font-weight:700;

    display:flex;

    align-items:center;

    justify-content:center;

    position:relative;
}

.unread-dot{

    position:absolute;

    right:-2px;

    top:-2px;

    width:14px;

    height:14px;

    border-radius:50%;

    background:#ef4444;

    border:3px solid #fff;
}

/* ========================================
   FOTO DO VEÍCULO
======================================== */

.lead-vehicle-photo{

    width:82px;

    height:62px;

    border-radius:12px;

    object-fit:cover;

    background:#f3f4f6;
}

/* ========================================
   TEXTO
======================================== */

.lead-info h3{

    font-size:18px;

    margin-bottom:4px;

    color:#111827;
}

.lead-vehicle{

    color:#64748b;

    font-size:14px;

    margin-bottom:6px;
}

.lead-message{

    color:#334155;

    font-size:14px;

    overflow:hidden;

    text-overflow:ellipsis;

    white-space:nowrap;
}

/* ========================================
   LADO DIREITO
======================================== */

.lead-right{

    display:flex;

    flex-direction:column;

    align-items:flex-end;

    gap:8px;
}

.lead-time{

    color:#64748b;

    font-size:13px;

    font-weight:600;
}

.lead-status{

    padding:6px 12px;

    border-radius:999px;

    font-size:12px;

    font-weight:700;
}

.lead-status.pending{

    background:#fee2e2;

    color:#dc2626;
}

.lead-status.answered{

    background:#dcfce7;

    color:#15803d;
}

/* ========================================
   EMPTY
======================================== */

.empty-state{

    padding:70px;

    text-align:center;
}

.empty-icon{

    width:82px;

    height:82px;

    margin:auto;

    margin-bottom:20px;

    border-radius:22px;

    background:linear-gradient(135deg,#2563eb,#14b8a6);

    display:flex;

    align-items:center;

    justify-content:center;

    color:#fff;

    font-size:34px;
}

.empty-state h3{

    font-size:26px;

    color:#0f172a;
}

.empty-state p{

    margin-top:10px;

    color:#64748b;
}

/* ========================================
   CHAT INTEGRADO
======================================== */

.leads-chat-layout{
    display:grid;
    grid-template-columns:430px 1fr;
    gap:0;
    padding:0;
    overflow:hidden;
    min-height:620px;
}

.leads-chat-layout .leads-list{
    padding:18px;
    border-right:1px solid #e8eef5;
    max-height:620px;
    overflow:auto;
}

.lead-card.active{
    border-color:#22c55e;
    background:#f0fdf4;
}

.chat-area{
    min-height:620px;
    background:#f8fafc;
    display:flex;
    flex-direction:column;
}

.chat-empty{
    height:620px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    text-align:center;
    color:#64748b;
}

#chatContainer{
    height:620px;
    display:flex;
    flex-direction:column;
}

.chat-header{
    height:78px;
    background:#fff;
    border-bottom:1px solid #e8eef5;
    padding:16px 20px;
}

.chat-user{
    display:flex;
    align-items:center;
    gap:14px;
}

.chat-avatar{
    width:46px;
    height:46px;
    border-radius:50%;
    background:linear-gradient(135deg,#2563eb,#16a34a);
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:800;
}

.chat-user strong{
    display:block;
    font-size:16px;
    color:#0f172a;
}

.chat-user small{
    color:#64748b;
    font-size:13px;
}

.chat-messages{
    flex:1;
    padding:22px;
    overflow:auto;
    display:flex;
    flex-direction:column;
    gap:12px;
}

.chat-bubble{
    max-width:70%;
    padding:12px 14px;
    border-radius:16px;
    font-size:14px;
}

.chat-bubble p{
    margin:0;
    line-height:1.45;
}

.chat-bubble span{
    display:block;
    margin-top:6px;
    font-size:11px;
    opacity:.7;
}

.chat-bubble.self{
    align-self:flex-end;
    background:#16a34a;
    color:#fff;
    border-bottom-right-radius:4px;
}

.chat-bubble.other{
    align-self:flex-start;
    background:#fff;
    color:#0f172a;
    border:1px solid #e8eef5;
    border-bottom-left-radius:4px;
}

.chat-send{
    height:74px;
    background:#fff;
    border-top:1px solid #e8eef5;
    padding:14px;
    display:flex;
    gap:12px;
}

.chat-send input{
    flex:1;
    border:1px solid #dbe3ee;
    border-radius:14px;
    padding:0 16px;
    font-size:14px;
    outline:none;
}

.chat-send button{
    width:120px;
    border:none;
    border-radius:14px;
    background:#16a34a;
    color:#fff;
    font-weight:800;
    cursor:pointer;
}

.chat-empty-message,
.chat-error{
    text-align:center;
    color:#64748b;
    margin:auto;
}

/* ========================================
   RESPONSIVO
======================================== */

@media(max-width:1100px){

.leads-summary{

grid-template-columns:repeat(2,1fr);

}

.lead-card{

grid-template-columns:70px 1fr;

}

.lead-vehicle-photo{

display:none;

}

.lead-right{

grid-column:2;

align-items:flex-start;

margin-top:10px;

}

}

.leads-chat-layout{
    grid-template-columns:1fr;
}

.leads-chat-layout .leads-list{
    max-height:none;
    border-right:0;
    border-bottom:1px solid #e8eef5;
}

.chat-area,
#chatContainer,
.chat-empty{
    min-height:520px;
    height:520px;
}

@media(max-width:768px){

.leads-summary{

grid-template-columns:1fr;

}

.leads-toolbar{

flex-direction:column;

}

.leads-toolbar select{

width:100%;

}

.lead-card{

grid-template-columns:1fr;

text-align:left;

}

.lead-avatar{

margin:auto;

}

.lead-right{

align-items:flex-start;

}

}