/* ══════════════════════════════════════════════
   cdc/css/atendimento.css — Painel SaaS (modelo Chatoindo)
   ══════════════════════════════════════════════ */

/* ── Layout 3 colunas ── */
.atend-layout {
    display: grid;
    grid-template-columns: 320px 1fr 280px;
    height: calc(100vh - 56px);
    overflow: hidden;
    background: var(--bg, #f8fafc);
}

/* ── COLUNA ESQUERDA ── */
.atend-sidebar {
    border-right: 1px solid var(--border, #e2e8f0);
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

.atend-sidebar-header {
    flex-shrink: 0;
}

.atend-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Tabs de status */
.atend-tab-btn {
    flex: 1;
    padding: 8px 4px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted, #64748b);
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.atend-tab-btn.active {
    color: var(--orange, #f59e0b);
    border-bottom-color: var(--orange, #f59e0b);
}
.atend-tab-badge {
    display: inline-block;
    background: var(--navy, #1e3a5f);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 0 5px;
    border-radius: 10px;
    margin-left: 3px;
    line-height: 16px;
}
.atend-tab-badge.pendente { background: var(--orange, #f59e0b); }
.atend-tab-badge.fechado  { background: #94a3b8; }

/* Item da lista */
.atend-item {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border, #f1f5f9);
    cursor: pointer;
    transition: background .12s;
    position: relative;
}
.atend-item:hover  { background: rgba(0,0,0,.02); }
.atend-item.active {
    background: rgba(245,158,11,.07);
    border-left: 3px solid var(--orange, #f59e0b);
    padding-left: 11px;
}

.atend-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.atend-item-body { flex: 1; min-width: 0; }

.atend-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2px;
}
.atend-item-name {
    font-weight: 700; font-size: 13px; color: var(--navy);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 170px;
}
.atend-item-time { font-size: 10px; color: #94a3b8; flex-shrink: 0; }
.atend-item-id   { font-size: 10px; color: #94a3b8; margin-bottom: 3px; }
.atend-item-preview {
    font-size: 12px; color: #64748b;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.atend-tag {
    display: inline-block;
    background: rgba(0,0,0,.06);
    color: var(--navy);
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 3px;
    font-weight: 600;
}

/* ── COLUNA CENTRAL — chat ── */
.atend-chat-col {
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    overflow: hidden;
}

.atend-empty-state {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--muted);
}

.atend-chat-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 1;
}

/* Área de mensagens */
.atend-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    scrollbar-width: thin;
}

.msg-row {
    display: flex;
    margin-bottom: 6px;
}
.msg-row-in  { justify-content: flex-start; }
.msg-row-out { justify-content: flex-end; }

.msg-bubble {
    max-width: 68%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.msg-in  {
    background: #fff;
    border-top-left-radius: 2px;
    color: var(--navy);
}
.msg-out {
    background: #dcf8c6;
    border-top-right-radius: 2px;
    color: #1a3c2a;
}
.msg-text  { }
.msg-time  { font-size: 10px; color: #94a3b8; text-align: right; margin-top: 3px; }

/* Input bar */
.atend-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.atend-input-textarea {
    flex: 1;
    min-height: 40px; max-height: 120px;
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: 22px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    background: var(--bg2, #f8fafc);
    color: var(--navy);
    overflow-y: auto;
    line-height: 1.5;
    transition: border .15s;
}
.atend-input-textarea:focus {
    border-color: var(--orange, #f59e0b);
}

/* ── COLUNA DIREITA — info ── */
.atend-info-col {
    border-left: 1px solid var(--border);
    background: #fff;
    overflow-y: auto;
    scrollbar-width: thin;
}

.atend-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.atend-info-row span:first-child { color: var(--muted); }
.atend-info-row span:last-child  { font-weight: 600; color: var(--navy); }

.atend-status-aberto   { color: #16a34a; font-weight: 700; }
.atend-status-pendente { color: var(--orange); font-weight: 700; }
.atend-status-fechado  { color: #94a3b8; font-weight: 700; }

/* ── Helpers ── */
.atend-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 32px 16px;
    color: var(--muted);
    gap: 6px;
    text-align: center;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Responsivo ── */
@media (max-width: 1200px) {
    .atend-layout { grid-template-columns: 300px 1fr; }
    .atend-info-col { display: none; }
}
@media (max-width: 768px) {
    .atend-layout { grid-template-columns: 1fr; height: auto; }
    .atend-sidebar { height: 40vh; }
    .atend-chat-col { height: 60vh; }
}

/* ── Etiquetas e Notas ── */
.etiqueta-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 3px;
    vertical-align: middle;
}
.etiqueta-suporte { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.etiqueta-vendas  { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.etiqueta-urgente { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.atend-nota-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    background: #fffbea;
    color: var(--navy);
    resize: vertical;
    outline: none;
    transition: border .15s;
    margin-top: 8px;
}
.atend-nota-textarea:focus { border-color: var(--orange); }
