/* /tiktok-shop/connection — Quản lý kết nối TikTok Shop.
 * Tông cam như trang chính /tiktok-shop. Danh sách kênh do tiktok-channels-manager.js vẽ (file dùng
 * chung, không sửa) ⇒ ở đây chỉ restyle markup nó sinh ra (.ttc-channel, .badge…) với selector gắn
 * #ttsChannelsList để không lan sang trang khác; phần thêm (avatar, nút Kết nối lại, dải tóm tắt) do
 * tiktok-shop-connection-channel-enhancer.js chèn. Nạp SAU tiktok-shop-mobile.css để thắng cascade. */

/* ─── Hero: không nằm trong danh sách của tiktok-shop-subpage-hero.css ⇒ tự tô cam.
   Áp cả trong app (subpage-hero.css chỉ nạp trên web). ─── */
.ttc-hero {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid #fed7aa;
    border-radius: 14px;
    padding: 20px 22px;
    margin-bottom: 14px;
    color: #111827;
}
.ttc-hero h1 { font-size: 1.3rem; font-weight: 800; margin: 0 0 4px; color: #111827; }
.ttc-hero h1 > .bi:first-child { color: #ea580c; }
.ttc-hero p { color: #6b7280; font-size: .88rem; margin: 0; }

/* ─── Thẻ chung ─── */
.ttc-card {
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .04);
}
.ttc-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ttc-card-icon {
    flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center;
    background: #fff7ed; color: #ea580c; font-size: 1.2rem;
}
.ttc-card-head h2 { font-size: 1rem; font-weight: 800; margin: 0; color: #111827; }
.ttc-card-head small { color: #6b7280; font-size: .8rem; display: block; line-height: 1.35; }
.ttc-card-head .badge { margin-left: auto; flex: 0 0 auto; }
.ttc-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Badge tổng ở đầu thẻ ("3 kênh" / "Chưa kết nối") — manager đặt class bg-success/bg-secondary. */
.ttc-card-head .badge { font-weight: 700; font-size: .72rem; padding: 5px 10px; border-radius: 999px; }
.ttc-card-head .badge.bg-success { background: #ecfdf5 !important; color: #047857; }
.ttc-card-head .badge.bg-secondary { background: #f3f4f6 !important; color: #6b7280; }

/* ─── Dải tóm tắt: N kênh · đang chạy · cần kết nối lại ─── */
.ttc-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ttc-summary:empty { display: none; }
.ttc-summary span {
    display: inline-flex; align-items: center; gap: 5px;
    border-radius: 999px; padding: 4px 10px; font-size: .76rem; font-weight: 700;
    background: #f9fafb; border: 1px solid #eef0f3; color: #374151;
}
.ttc-summary .is-ok { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.ttc-summary .is-bad { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* ─── Một kênh: thẻ nhỏ thay cho hàng kẻ border-bottom ─── */
#ttsChannelsList .ttc-channel {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 4px 12px;
    align-items: start !important; /* thắng .align-items-center của manager */
    padding: 12px !important;
    margin-bottom: 8px;
    border: 1px solid #eef0f3 !important;
    border-radius: 12px;
    background: #fff;
}
#ttsChannelsList .ttc-channel.is-broken { border-color: #fecaca !important; background: #fffafa; }
#ttsChannelsList .ttc-channel > .flex-grow-1 { min-width: 0; }
#ttsChannelsList .ttc-channel > .d-flex { grid-column: 2; }
#ttsChannelsList .ttc-avatar {
    grid-row: 1 / span 2; align-self: start;
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #fb923c, #ea580c); color: #fff;
    font-weight: 800; font-size: 1.05rem; text-transform: uppercase;
}
#ttsChannelsList .ttc-channel.is-broken .ttc-avatar { background: #d1d5db; }
#ttsChannelsList .ttc-channel .fw-semibold {
    color: #111827; font-weight: 800 !important; overflow-wrap: anywhere; line-height: 1.3;
}
#ttsChannelsList .ttc-channel .text-muted { color: #6b7280 !important; }

/* Badge trạng thái từng kênh: nền nhạt, chữ đậm — dễ đọc hơn khối màu đặc. */
#ttsChannelsList .badge { font-weight: 700; font-size: .7rem; padding: 4px 8px; border-radius: 999px; vertical-align: 1px; }
#ttsChannelsList .badge.bg-success { background: #ecfdf5 !important; color: #047857; }
#ttsChannelsList .badge.bg-warning { background: #fffbeb !important; color: #b45309 !important; }
#ttsChannelsList .badge.bg-danger { background: #fef2f2 !important; color: #b91c1c; }
#ttsChannelsList .badge.bg-dark { background: #fff7ed !important; color: #9a3412; border: 1px solid #fed7aa; }

/* Lời nhắc khi kênh mất/hết uỷ quyền (enhancer chèn). */
#ttsChannelsList .ttc-fix-hint { font-size: .78rem; color: #b91c1c; margin-top: 4px; line-height: 1.4; }

/* Nút trong hàng kênh: gọn, cùng cỡ. Nút đồng ý MCN của manager dài ⇒ cho xuống dòng. */
#ttsChannelsList .ttc-channel .btn { font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 5px 12px; }
#ttsChannelsList .ttc-channel .btn-rh-primary { white-space: normal; text-align: left; }
#ttsChannelsList .ttc-channel .btn-outline-secondary { border-color: #e5e7eb; color: #374151; }
#ttsChannelsList .ttc-channel .btn-outline-secondary:hover { background: #f9fafb; color: #111827; }
#ttsChannelsList .ttc-channel .btn-outline-danger { border-color: #fecaca; color: #b91c1c; }
#ttsChannelsList .ttc-channel .btn-outline-danger:hover { background: #fef2f2; color: #991b1b; }
#ttsChannelsList .ttc-reconnect { background: #ea580c; border: 1px solid #ea580c; color: #fff; }
#ttsChannelsList .ttc-reconnect:hover { background: #c2410c; border-color: #c2410c; color: #fff; }

/* Trạng thái rỗng (manager vẽ 1 thẻ <p>): khung nét đứt + biểu tượng. */
#ttsChannelsList > p {
    border: 1.5px dashed #fed7aa; background: #fff7ed; border-radius: 12px;
    padding: 18px 16px; text-align: center; color: #9a3412 !important; margin: 0 !important;
}
#ttsChannelsList > p::before {
    content: "\f6cc"; font-family: "bootstrap-icons"; display: block; font-size: 1.6rem; color: #ea580c; margin-bottom: 4px;
}

/* Ghi chú (cả ghi chú "cộng gộp tất cả kênh" manager chèn dưới danh sách). */
.ttc-note {
    background: #f9fafb; border: 1px solid #eef0f3; border-radius: 12px;
    padding: 12px 14px; font-size: .82rem; color: #4b5563; line-height: 1.5;
}
.ttc-note .text-warning { color: #ea580c !important; }

/* Seller: Open ID dài ⇒ cho ngắt dòng, không đẩy tràn ngang. */
#ttsSellerOpenId { overflow-wrap: anywhere; color: #9a3412; }

.toast-wrap { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1080; }
.toast-item { background: #111827; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: .85rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); transition: opacity .25s; }

@media (max-width: 575.98px) {
    .ttc-card { padding: 12px !important; }
    #ttsChannelsList .ttc-channel { grid-template-columns: 38px minmax(0, 1fr); padding: 10px !important; gap: 4px 10px; }
    #ttsChannelsList .ttc-avatar { width: 38px; height: 38px; font-size: .95rem; }
    #ttsChannelsList .ttc-channel > .d-flex { gap: 6px !important; grid-column: 1 / -1; margin-top: 4px; }
    #ttsChannelsList .ttc-channel > .d-flex .btn { font-size: .74rem; padding: 4px 10px; }
    .ttc-card-actions .btn { flex: 1 1 auto; }
    .toast-wrap { left: 12px; right: 12px; bottom: 12px; }
}
