﻿/* =========================================================
   INBOX (Listado de conversaciones)
   ========================================================= */

/* Helpers */
.min-w-0 {
    min-width: 0;
}

/* =========================
   Loading / New highlight
   ========================= */
#inboxList.is-loading {
    opacity: .65;
    transition: opacity .15s ease;
}

.conv-new {
    outline: 2px solid rgba(25,135,84,.45);
    box-shadow: 0 0 0 6px rgba(25,135,84,.12);
    animation: pulseNew 1.2s ease-in-out infinite;
}

@keyframes pulseNew {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-1px);
    }

    100% {
        transform: translateY(0);
    }
}

/* Botón Tomar – versión natural */
.btn-take {
    border-radius: 10px; /* menos redondo */
    padding: 6px 14px; /* menos alto */
    font-weight: 600;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(13,110,253,.18);
}

    .btn-take:hover {
        box-shadow: 0 6px 18px rgba(13,110,253,.28);
    }

/* =========================
   Tabs (Pendientes / Mías / Cerradas)
   ========================= */
.inbox-tabs {
    display: inline-flex;
    gap: 12px;
    padding: 6px;
    background: #f5f7fa;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,.06);
}

.inbox-tab {
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 500;
    color: #0d6efd;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .inbox-tab:hover {
        background: rgba(13,110,253,.08);
    }

    .inbox-tab.active {
        background: #17a2b8;
        color: #fff;
    }

    .inbox-tab .count {
        background: #fff;
        color: #17a2b8;
        font-size: .75rem;
        font-weight: 700;
        padding: 2px 8px;
        border-radius: 999px;
    }

/* =========================
   Container + Grid
   ========================= */
.inbox-content {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
}

.inbox-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 900px) {
    .inbox-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* =========================
   Badges (status)
   ========================= */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: .35rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .2px;
    border: 1px solid transparent;
}

.badge-pending {
    background: rgba(255,193,7,.18);
    color: #8a5b00;
    border-color: rgba(255,193,7,.35);
}

.badge-assigned {
    background: rgba(13,110,253,.14);
    color: #0b3d91;
    border-color: rgba(13,110,253,.28);
}

.badge-closed {
    background: rgba(108,117,125,.16);
    color: #495057;
    border-color: rgba(108,117,125,.28);
}

.badge-other {
    background: rgba(25,135,84,.12);
    color: #0f5132;
    border-color: rgba(25,135,84,.25);
}

/* Extra badges */
.badge-neutral {
    background: rgba(108,117,125,.10);
    color: #495057;
    border: 1px solid rgba(108,117,125,.22);
}

.badge-mine {
    background: rgba(25,135,84,.10);
    color: #146c43;
    border: 1px solid rgba(25,135,84,.22);
}

.badge-locked {
    background: rgba(255,193,7,.14);
    color: #8a6d00;
    border: 1px solid rgba(255,193,7,.35);
}

/* =========================
   Conversation Cards
   ========================= */
.conv-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,.05);
    position: relative;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}

.conv-card__top {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
}

.conv-title {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}

.conv-name {
    font-weight: 850;
    font-size: 16px;
}

.conv-phone {
    font-weight: 700;
    color: #0d6efd;
    font-size: 13px;
    opacity: .95;
}

.conv-sub {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    color: rgba(0,0,0,.55);
    font-size: 12px;
}

.dot {
    opacity: .5;
}

.conv-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Preview */
.conv-preview {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0,0,0,.03);
    border: 1px solid rgba(0,0,0,.06);
    color: rgba(0,0,0,.70);
    font-size: 13px;
    line-height: 1.35;
    min-height: 44px;
}

/* Bottom */
.conv-card__bottom {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mini {
    font-size: 12px;
    color: rgba(0,0,0,.45);
    font-weight: 650;
}

/* Locked state */
.conv-card.is-locked {
    opacity: .78;
    cursor: not-allowed;
}

/* Hover (elegante) */
.conv-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 4px;
    border-radius: 999px;
    background: transparent;
    transition: background .15s ease;
}

.conv-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(0,0,0,.10);
    border-color: rgba(23,162,184,.45);
    background: linear-gradient(180deg, rgba(23,162,184,.04), #ffffff 60%);
}

    .conv-card:hover::before {
        background: rgba(23,162,184,.65);
    }

.conv-card.is-locked:hover {
    transform: none;
    box-shadow: 0 10px 24px rgba(0,0,0,.08);
    border-color: rgba(0,0,0,.12);
    background: #fff;
}

    .conv-card.is-locked:hover::before {
        background: rgba(255,193,7,.85);
    }

/* Mostrar botón solo en hover */
.conv-card__bottom .btn {
    opacity: 0;
    transform: translateY(4px);
    transition: all .15s ease;
}

.conv-card:hover .conv-card__bottom .btn {
    opacity: 1;
    transform: translateY(0);
}

/* =========================
   Inbox Toast
   ========================= */
.inbox-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(0,0,0,.82);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 14px 40px rgba(0,0,0,.22);
    max-width: min(720px, 92%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .inbox-toast.show {
        display: inline-flex !important;
        align-items: center;
        gap: 10px;
    }

    .inbox-toast .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(23,162,184,.95);
        flex: 0 0 auto;
    }

/* =========================================================
   CHAT DETAIL (Conversation page)
   ========================================================= */

.chat-shell {
    max-width: 1180px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0,0,0,.08);
    overflow: hidden;
    /* Layout alto tipo app */
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

/* ===== Header sticky ===== */
.chat-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,.08);
}

.chat-header-left {
    min-width: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(0,0,0,.55);
    text-decoration: none;
    margin-bottom: 8px;
}

    .back-link:hover {
        text-decoration: underline;
    }

.chat-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #0d6efd;
    background: rgba(13,110,253,.10);
    border: 1px solid rgba(13,110,253,.20);
    flex: 0 0 auto;
}

.chat-title {
    min-width: 0;
}

    .chat-title .name {
        font-weight: 900;
        font-size: 16px;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        align-items: baseline;
    }

    .chat-title .phone {
        font-weight: 700;
        color: #0d6efd;
        font-size: 13px;
        opacity: .95;
    }

    .chat-title .meta {
        margin-top: 6px;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

/* ===== Chips ===== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(0,0,0,.03);
    color: rgba(0,0,0,.70);
}

.chip-status.is-pending {
    background: rgba(255,193,7,.18);
    border-color: rgba(255,193,7,.35);
    color: #8a5b00;
}

.chip-status.is-assigned {
    background: rgba(13,110,253,.12);
    border-color: rgba(13,110,253,.25);
    color: #0b3d91;
}

.chip-status.is-closed {
    background: rgba(108,117,125,.14);
    border-color: rgba(108,117,125,.25);
    color: #495057;
}

/* ===== Quick actions toolbar ===== */
.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    max-width: 520px;
}

.qa {
    border: 1px solid rgba(0,0,0,.12);
    background: #fff;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0,0,0,.06);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

    .qa:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 32px rgba(0,0,0,.10);
        border-color: rgba(23,162,184,.45);
    }

/* ===== Body grid: messages + summary ===== */
.chat-body {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0;
    min-height: 0; /* important para que scroll funcione */
}

.chat-messages {
    min-height: 0;
    overflow: auto;
    padding: 16px;
    background: linear-gradient(180deg, rgba(23,162,184,.05), rgba(0,0,0,0) 40%);
    border-right: 1px solid rgba(0,0,0,.08);
}

/* ===== Summary ===== */
.chat-summary {
    min-height: 0;
    overflow: auto;
    padding: 16px;
    background: #fff;
}

    .chat-summary .card {
        position: sticky;
        top: 12px;
        border: 1px solid rgba(0,0,0,.08);
        border-radius: 16px;
        padding: 14px;
        box-shadow: 0 10px 24px rgba(0,0,0,.06);
    }

    .chat-summary h4 {
        font-size: 14px;
        font-weight: 900;
        margin: 0 0 10px 0;
    }

    .chat-summary hr {
        margin: 10px 0;
        opacity: .15;
    }

    .chat-summary b {
        color: rgba(0,0,0,.75);
    }

    .chat-summary span {
        color: rgba(0,0,0,.60);
        font-weight: 700;
    }

/* ===== Footer sticky ===== */
.chat-footer {
    border-top: 1px solid rgba(0,0,0,.08);
    background: #fff;
    padding: 12px 14px;
}

.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin: 0;
}

.chat-text {
    width: 100%;
    min-height: 44px;
    max-height: 140px;
    resize: vertical;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,.12);
    padding: 10px 12px;
    font-size: 14px;
    box-shadow: 0 8px 18px rgba(0,0,0,.05);
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,.10);
    background: rgba(0,0,0,.03);
}

.chat-hint {
    margin-top: 6px;
    font-size: 12px;
    color: rgba(0,0,0,.45);
    font-weight: 700;
}

/* ===== Toast ===== */
.chat-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(0,0,0,.82);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    box-shadow: 0 14px 40px rgba(0,0,0,.22);
    max-width: min(720px, 92%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .chat-body {
        grid-template-columns: 1fr; /* resumen debajo */
    }

    .chat-messages {
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,.08);
    }

    .quick-actions {
        max-width: none;
    }
}
