/* ═══════════════════════════════════════════════════
   CHANNELS PAGE — Redesign v2
   KOC Profile & Social Channels Management
═══════════════════════════════════════════════════ */

@keyframes ch-fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
@keyframes ch-shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}

/* ── Hero Banner ── */
.ch-hero {
    background: linear-gradient(135deg, #1E2D6B 0%, #2D3A8C 55%, #3D4FC8 100%);
    border-radius: 1.25rem;
    padding: 1.8rem 2rem;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
    animation: ch-fadeUp .3s ease;
}
.ch-hero::before {
    content: '';
    position: absolute;
    right: -60px;
    top: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(249,115,22,.22) 0%, transparent 70%);
    pointer-events: none;
}
.ch-hero-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    z-index: 1;
}
.ch-hero h1 {
    font-weight: 900;
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    color: #fff;
    margin: 0;
    letter-spacing: -.3px;
    line-height: 1.2;
}
.ch-hero p {
    color: rgba(255,255,255,.7);
    font-size: .88rem;
    margin: .4rem 0 0;
}
.ch-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1rem;
}
.ch-hstat {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    backdrop-filter: blur(6px);
    border-radius: .7rem;
    padding: .5rem .85rem;
    min-width: 100px;
}
.ch-hstat strong {
    display: block;
    font-size: 1.15rem;
    font-weight: 900;
    color: #fff;
    line-height: 1.1;
}
.ch-hstat span {
    font-size: .68rem;
    color: rgba(255,255,255,.65);
}
.btn-ch-add {
    background: #F97316;
    color: #fff;
    border: none;
    border-radius: .7rem;
    padding: .6rem 1.2rem;
    font-size: .88rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    transition: all .15s;
    box-shadow: 0 4px 16px rgba(249, 115, 22, .35);
    white-space: nowrap;
}
.btn-ch-add:hover {
    background: #EA580C;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, .45);
}

/* ── Verify Alert Banner ── */
.verify-alert {
    display: none;
    align-items: center;
    gap: .75rem;
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border: 1.5px solid #FDE68A;
    border-radius: .85rem;
    padding: .9rem 1.1rem;
    margin-bottom: 1rem;
    color: #92400E;
    font-size: .85rem;
    font-weight: 600;
    animation: ch-fadeUp .3s ease;
}
.verify-alert.show { display: flex; }
.verify-alert i { font-size: 1.2rem; flex-shrink: 0; }
.verify-alert a {
    color: #F97316;
    font-weight: 700;
    margin-left: auto;
    white-space: nowrap;
}

/* ── Page Container ── */
.channels-page {
    overflow: visible;
    width: 100%;
}

/* ── Channels Grid ── */
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
    overflow: visible;
}

/* ── Channel Card ── */
.channel-card {
    background: #fff;
    border: 1.5px solid var(--border, #E5E7EB);
    border-radius: 1.1rem;
    overflow: visible;
    transition: all .2s;
    animation: ch-fadeUp .35s ease both;
}
.channel-card .ch-stripe {
    border-radius: 1.1rem 1.1rem 0 0;
}
.channel-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,.08);
    border-color: #FED7AA;
}
.channel-card.verified { border-color: #10B981; }
.channel-card.pending { border-color: #F59E0B; }
.channel-card.rejected { border-color: #EF4444; }

/* Platform stripe */
.ch-stripe {
    height: 4px;
}
.stripe-tiktok { background: linear-gradient(90deg, #FE2C55, #25F4EE); }
.stripe-facebook { background: linear-gradient(90deg, #1877F2, #42A5F5); }
.stripe-shopee { background: linear-gradient(90deg, #EE4D2D, #F97316); }
.stripe-instagram { background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF, #515BD4); }
.stripe-youtube { background: linear-gradient(90deg, #FF0000, #CC0000); }
.stripe-zalo { background: linear-gradient(90deg, #0068FF, #00A6FF); }

/* Card body */
.ch-body {
    padding: 1rem;
}
.ch-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .6rem;
    margin-bottom: .85rem;
}
.ch-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: .35rem;
    max-width: 55%;
    flex-shrink: 1;
}
.ch-info {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
}
.plat-logo {
    width: 44px;
    height: 44px;
    border-radius: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.plat-logo.tiktok { background: #000; color: #fff; }
.plat-logo.facebook { background: #1877F2; color: #fff; }
.plat-logo.shopee { background: #EE4D2D; color: #fff; }
.plat-logo.instagram { background: linear-gradient(45deg, #F58529, #DD2A7B); color: #fff; }
.plat-logo.youtube { background: #FF0000; color: #fff; }
.plat-logo.zalo { background: #0068FF; color: #fff; }

.ch-meta {
    min-width: 0;
}
.ch-platform-name {
    font-weight: 800;
    font-size: .95rem;
    color: #111827;
    margin-bottom: .15rem;
}
.ch-username {
    font-size: .78rem;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* Status badges */
.verify-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .25rem .65rem;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
}
.vb-verified { background: #D1FAE5; color: #065F46; }
.vb-pending { background: #FEF3C7; color: #92400E; }
.vb-rejected { background: #FEE2E2; color: #991B1B; }
.vb-unverified { background: #F3F4F6; color: #6B7280; }
.vb-primary { background: #FEF9C3; color: #854D0E; border: 1px solid #FCD34D; }
.channel-card.primary { border-color: #FCD34D; }

/* Stats row */
.ch-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
    margin-bottom: .9rem;
}
.ch-stat {
    background: #F9FAFB;
    border: 1px solid #F3F4F6;
    border-radius: .6rem;
    padding: .55rem .5rem;
    text-align: center;
}
.ch-stat .sv {
    font-size: .95rem;
    font-weight: 800;
    color: #111827;
    line-height: 1.2;
}
.ch-stat .sk {
    font-size: .65rem;
    color: #9CA3AF;
    margin-top: .1rem;
}

/* Actions */
.ch-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.btn-ch {
    border: none;
    border-radius: .55rem;
    padding: .5rem .75rem;
    font-size: .78rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}
.btn-ch-primary {
    background: #F97316;
    color: #fff;
    box-shadow: 0 2px 8px rgba(249,115,22,.25);
}
.btn-ch-primary:hover { background: #EA580C; }
.btn-ch-outline {
    background: #fff;
    border: 1.5px solid var(--border, #E5E7EB);
    color: #374151;
}
.btn-ch-outline:hover { border-color: #F97316; color: #F97316; }
.btn-ch-danger {
    background: #FEE2E2;
    color: #B91C1C;
}
.btn-ch-danger:hover { background: #FECACA; }

/* Add card */
.add-card {
    background: #fff;
    border: 2px dashed #D1D5DB;
    border-radius: 1.1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem 1rem;
    min-height: 220px;
    cursor: pointer;
    transition: all .2s;
}
.add-card:hover {
    border-color: #F97316;
    background: #FFF7ED;
}
.add-card .icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #FFF7ED;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #F97316;
    margin-bottom: .8rem;
}
.add-card h6 {
    font-weight: 800;
    font-size: .95rem;
    color: #111827;
    margin: 0 0 .3rem;
}
.add-card p {
    font-size: .8rem;
    color: #6B7280;
    margin: 0;
}

/* ── Verify Panel ── */
.verify-panel {
    background: #fff;
    border: 1.5px solid var(--border, #E5E7EB);
    border-radius: 1.1rem;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    display: none;
    animation: ch-fadeUp .3s ease;
}
.verify-panel.show { display: block; }

.verify-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}
.verify-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
    color: #111827;
}
.verify-sub {
    margin: .3rem 0 0;
    font-size: .82rem;
    color: #6B7280;
}

.verify-platform-switch {
    display: inline-flex;
    background: #F3F4F6;
    border-radius: 99px;
    padding: .2rem;
    gap: .15rem;
    margin-bottom: 1rem;
}
.verify-platform-btn {
    border: none;
    border-radius: 99px;
    background: transparent;
    color: #6B7280;
    font-size: .76rem;
    font-weight: 700;
    padding: .4rem .8rem;
    cursor: pointer;
    transition: all .15s;
}
.verify-platform-btn.active {
    background: #fff;
    color: #111827;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.verify-step-list {
    display: grid;
    gap: .75rem;
}
.verify-step {
    border: 1.5px solid #E5E7EB;
    border-radius: .9rem;
    padding: 1rem;
    background: #fff;
    transition: all .2s;
}
.verify-step.active {
    border-color: #F97316;
    background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
}
.verify-step.done {
    border-color: #10B981;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
}
.verify-step-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .6rem;
}
.verify-step-title {
    margin: 0;
    font-size: .9rem;
    font-weight: 800;
    color: #111827;
}
.verify-step-mark {
    font-size: .72rem;
    font-weight: 800;
    border-radius: 99px;
    padding: .2rem .6rem;
    background: #F3F4F6;
    color: #6B7280;
}
.verify-step.done .verify-step-mark { background: #D1FAE5; color: #065F46; }
.verify-step.active .verify-step-mark { background: #FFEDD5; color: #9A3412; }

.verify-input-label {
    display: block;
    font-size: .78rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: .4rem;
}
.verify-readonly-box {
    border: 1.5px solid #BBF7D0;
    background: #F0FDF4;
    color: #166534;
    border-radius: .65rem;
    padding: .6rem .75rem;
    font-size: .82rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.verify-code-box {
    border: 2px solid #3B82F6;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-radius: .8rem;
    padding: .85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-bottom: .5rem;
}
.verify-code-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: .1em;
    color: #1E3A8A;
}
.copy-btn {
    border: none;
    background: #3B82F6;
    color: #fff;
    border-radius: .55rem;
    padding: .45rem .8rem;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.copy-btn:hover { background: #2563EB; }

.verify-hint {
    font-size: .75rem;
    color: #6B7280;
    margin: 0;
}
.verify-target {
    border: 1px solid #E5E7EB;
    border-radius: .65rem;
    background: #F9FAFB;
    padding: .6rem .75rem;
    margin-top: .5rem;
    font-size: .8rem;
    color: #374151;
}
.verify-target a { color: #F97316; font-weight: 600; }

.verify-main-cta {
    width: 100%;
    border: none;
    border-radius: .7rem;
    background: #F97316;
    color: #fff;
    font-size: .88rem;
    font-weight: 800;
    padding: .7rem 1rem;
    margin-top: .75rem;
    cursor: pointer;
    transition: all .15s;
    box-shadow: 0 3px 12px rgba(249,115,22,.3);
}
.verify-main-cta:hover { background: #EA580C; }
.verify-main-cta:disabled { opacity: .6; cursor: not-allowed; }

.verify-note {
    margin-top: .85rem;
    font-size: .78rem;
    color: #92400E;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: .7rem;
    padding: .65rem .8rem;
}

/* Compact verified state */
.verify-panel.verified-compact {
    padding: 1rem;
}
.verify-panel.verified-compact .verify-head { margin-bottom: .25rem; }
.verify-panel.verified-compact .verify-sub { font-size: .78rem; }
.verify-panel.verified-compact .verify-step-list,
.verify-panel.verified-compact .verify-note,
.verify-panel.verified-compact #verifyMethodWrap { display: none !important; }

/* ── Chart Card ── */
.chart-card {
    background: #fff;
    border: 1.5px solid var(--border, #E5E7EB);
    border-radius: 1.1rem;
    padding: 1.1rem;
    margin-bottom: 1rem;
    animation: ch-fadeUp .35s ease both;
}
.chart-card h6 {
    font-weight: 800;
    font-size: .95rem;
    color: #111827;
}
.chart-tab {
    font-size: .76rem !important;
    font-weight: 600 !important;
    padding: .35rem .7rem !important;
}
.chart-tab.active {
    background: #F97316 !important;
    color: #fff !important;
    border-color: #F97316 !important;
}

.mini-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 80px;
    padding-top: .5rem;
}
.mini-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}
.mini-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    background: linear-gradient(180deg, #F97316 0%, #FB923C 100%);
    transition: height .3s ease;
}
.mini-bar-label {
    font-size: .65rem;
    color: #9CA3AF;
    white-space: nowrap;
}

/* Table */
.plat-table {
    width: 100%;
    border-collapse: collapse;
}
.plat-table th {
    background: #F9FAFB;
    font-size: .75rem;
    font-weight: 800;
    color: #6B7280;
    padding: .65rem .85rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.plat-table td {
    padding: .7rem .85rem;
    border-bottom: 1px solid #F3F4F6;
    font-size: .85rem;
}
.plat-table tr:hover td { background: #FAFAFA; }

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .5);
    backdrop-filter: blur(4px);
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal-box {
    background: #fff;
    border-radius: 1.1rem;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: ch-fadeUp .25s ease;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.2rem;
    border-bottom: 1px solid var(--border, #E5E7EB);
}
.modal-head h5 {
    font-weight: 800;
    font-size: 1rem;
}
.modal-body {
    padding: 1.1rem 1.2rem;
}
.modal-footer {
    display: flex;
    gap: .6rem;
    justify-content: flex-end;
    padding: .9rem 1.2rem;
    border-top: 1px solid var(--border, #E5E7EB);
}

.plat-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
}
.plat-option {
    border: 1.5px solid var(--border, #E5E7EB);
    border-radius: .7rem;
    padding: .7rem .5rem;
    text-align: center;
    cursor: pointer;
    font-weight: 700;
    font-size: .85rem;
    transition: all .15s;
}
.plat-option:hover { border-color: #FED7AA; background: #FFF7ED; }
.plat-option.selected { border-color: #F97316; background: #FFF7ED; }

/* Toast */
.toast-wrap {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1300;
}
.toast-item {
    background: #111827;
    color: #fff;
    border-radius: 99px;
    padding: .65rem 1.1rem;
    font-size: .84rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    animation: ch-fadeUp .25s ease;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */

@media (max-width: 992px) {
    .ch-hero-stats {
        gap: .5rem;
    }
    .ch-hstat {
        min-width: 90px;
        padding: .45rem .7rem;
    }
    .ch-badges {
        max-width: 50%;
    }
    .verify-badge {
        padding: .2rem .5rem;
        font-size: .68rem;
    }
}

@media (max-width: 768px) {
    .ch-hero {
        padding: 1.4rem 1.2rem;
        border-radius: 1rem;
    }
    .ch-hero h1 {
        font-size: 1.35rem;
    }
    .ch-hero-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .btn-ch-add {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }
    .channels-grid {
        grid-template-columns: 1fr;
    }
    .ch-badges {
        max-width: 60%;
    }
    .plat-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    .verify-panel {
        padding: 1rem;
    }
    .chart-card {
        padding: .9rem;
    }
}

@media (max-width: 540px) {
    .ch-hero {
        padding: 1.2rem 1rem;
    }
    .ch-hero h1 {
        font-size: 1.25rem;
    }
    .ch-hero p {
        font-size: .82rem;
    }
    .ch-hero-stats {
        width: 100%;
    }
    .ch-hstat {
        flex: 1;
        min-width: unset;
    }
    .ch-hstat strong {
        font-size: 1rem;
    }
    .ch-hstat span {
        font-size: .65rem;
    }
    .channel-card {
        border-radius: .9rem;
    }
    .ch-body {
        padding: .85rem;
    }
    .ch-stats {
        gap: .4rem;
    }
    .ch-stat {
        padding: .45rem .35rem;
    }
    .ch-stat .sv {
        font-size: .85rem;
    }
    .btn-ch {
        padding: .45rem .6rem;
        font-size: .75rem;
        min-height: 38px;
    }
    .verify-code-text {
        font-size: 1.1rem;
    }
    .verify-step {
        padding: .85rem;
    }
    .verify-step-title {
        font-size: .85rem;
    }
    .modal-head,
    .modal-body,
    .modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 379.98px) {
    .ch-hero {
        padding: 1rem .85rem;
    }
    .ch-hero h1 {
        font-size: 1.15rem;
    }
    .ch-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .ch-stat:last-child {
        grid-column: span 2;
    }
    .plat-logo {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
    .ch-platform-name {
        font-size: .88rem;
    }
}
