/* ====================================================================
   CSKH Module — Customer Care Styles
   ==================================================================== */

/* --- Tab Navigation --- */
.cskh-tab-bar {
    display: flex;
    gap: 4px;
    padding: 12px 16px 0;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.cskh-tab-bar::-webkit-scrollbar {
    display: none;
}

.cskh-tab-btn {
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted, #6b7280);
    font-size: 0.82rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.cskh-tab-btn:hover {
    color: var(--text-100, #111);
}

.cskh-tab-btn.active {
    color: var(--accent, #16a34a);
    border-bottom-color: var(--accent, #16a34a);
    font-weight: 600;
}

/* --- Summary KPI Row --- */
.cskh-kpi-row {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.cskh-kpi-row::-webkit-scrollbar {
    display: none;
}

.cskh-kpi-card {
    flex: 0 0 auto;
    min-width: 100px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e5e7eb);
    text-align: center;
}

.cskh-kpi-card .kpi-val {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-100, #111);
}

.cskh-kpi-card .kpi-label {
    font-size: 0.72rem;
    color: var(--text-muted, #6b7280);
    margin-top: 2px;
}

/* --- Filter Bar --- */
.cskh-date-filter-bar {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.cskh-date-chip {
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--card-bg, #fff);
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    transition: all 0.2s;
}

.cskh-date-chip:hover {
    background: #f3f4f6;
    color: var(--text-100, #111);
}

.cskh-date-chip.active {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
}

.cskh-filter-bar {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    align-items: center;
    flex-wrap: wrap;
}

.cskh-filter-bar select,
.cskh-filter-bar input {
    padding: 6px 10px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    font-size: 0.82rem;
    background: var(--card-bg, #fff);
    color: var(--text-100, #111);
}

.cskh-filter-bar select {
    min-width: 120px;
}

.cskh-filter-bar input[type="text"] {
    flex: 1;
    min-width: 140px;
}

/* --- Task Cards --- */
.cskh-task-list {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cskh-task-card {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 14px;
    background: var(--card-bg, #fff);
    transition: box-shadow 0.2s;
    border-left: 4px solid #ccc;
}

.cskh-task-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Priority border colors */
.cskh-task-card.priority-1 {
    border-left-color: #ef4444;
}

.cskh-task-card.priority-2 {
    border-left-color: #f59e0b;
}

.cskh-task-card.priority-3 {
    border-left-color: #3b82f6;
}

.cskh-task-card.priority-4 {
    border-left-color: #8b5cf6;
}

.cskh-task-card.priority-5 {
    border-left-color: #06b6d4;
}

.cskh-task-card.priority-6 {
    border-left-color: #6b7280;
}

/* Card header */
.cskh-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cskh-flow-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
}

.cskh-flow-badge.L1 {
    background: #f59e0b;
}

.cskh-flow-badge.L2 {
    background: #3b82f6;
}

.cskh-flow-badge.L3 {
    background: #ef4444;
}

.cskh-flow-badge.L4 {
    background: #06b6d4;
}

.cskh-flow-badge.L5 {
    background: #8b5cf6;
}

.cskh-flow-badge.L6 {
    background: #6b7280;
}

.cskh-status-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
}

.cskh-status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.cskh-status-badge.called {
    background: #d1fae5;
    color: #065f46;
}

.cskh-status-badge.no_answer {
    background: #fee2e2;
    color: #991b1b;
}

.cskh-status-badge.zalo_sent {
    background: #dbeafe;
    color: #1e40af;
}

.cskh-status-badge.rescheduled {
    background: #f3e8ff;
    color: #6b21a8;
}

.cskh-status-badge.closed {
    background: #e5e7eb;
    color: #374151;
}

.cskh-status-badge.issue {
    background: #fecaca;
    color: #dc2626;
}

/* Card body */
.cskh-card-customer {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-100, #111);
}

.cskh-card-phone {
    color: var(--accent, #16a34a);
    font-size: 0.85rem;
    cursor: pointer;
}

.cskh-card-phone:hover {
    text-decoration: underline;
}

.cskh-card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted, #6b7280);
    margin-top: 4px;
    flex-wrap: wrap;
}

.cskh-card-script {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-100, #f9fafb);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-200, #374151);
    line-height: 1.4;
    border-left: 3px solid var(--accent, #16a34a);
}

/* Card actions */
.cskh-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.cskh-action-btn {
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid var(--border, #e5e7eb);
    background: var(--card-bg, #fff);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
}

.cskh-action-btn:hover {
    background: var(--bg-100, #f3f4f6);
}

.cskh-action-btn.primary {
    background: var(--accent, #16a34a);
    color: #fff;
    border-color: var(--accent, #16a34a);
}

.cskh-action-btn.primary:hover {
    opacity: 0.9;
}

/* Segment badges */
.cskh-seg {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.cskh-seg.VIP {
    background: #fef3c7;
    color: #92400e;
}

.cskh-seg.Loyal {
    background: #dbeafe;
    color: #1e40af;
}

.cskh-seg.Regular {
    background: #e5e7eb;
    color: #374151;
}

.cskh-seg.New {
    background: #d1fae5;
    color: #065f46;
}

/* B21 Membership Tiers (chính thức) */
.cskh-seg.MEMBER {
    background: #f3f4f6;
    color: #6b7280;
}
.cskh-seg.VIP_SILVER {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
}
.cskh-seg.VIP_GOLD {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}
.cskh-seg.VIP_PLATINUM {
    background: linear-gradient(135deg, #f3f4f6, #d1d5db);
    color: #1f2937;
    border: 1px solid #9ca3af;
}
.cskh-seg.VIP_DIAMOND {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #0369a1;
    border: 1px solid #7dd3fc;
}

/* Member Benefits Block */
.member-benefits-block {
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 12px;
}
.member-benefits-block .mb-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #854d0e;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.member-benefits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.member-benefits-grid .mb-item {
    font-size: 0.78rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 4px;
}
.member-benefits-grid .mb-item .mb-val {
    font-weight: 700;
    color: #111827;
}
.mb-progress-wrap {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #fde68a;
}
.mb-progress-bar {
    height: 8px;
    background: #fef3c7;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
    margin-bottom: 4px;
}
.mb-progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #f59e0b, #eab308);
    transition: width 0.6s ease;
}
.mb-progress-text {
    font-size: 0.72rem;
    color: #92400e;
    display: flex;
    justify-content: space-between;
}

/* --- Modal overlay --- */
.cskh-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
}

.cskh-modal-backdrop.show {
    display: flex;
}

.cskh-modal {
    background: var(--card-bg, #fff);
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.cskh-modal h3 {
    margin: 0 0 16px;
    font-size: 1.1rem;
}

.cskh-modal label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 4px;
    margin-top: 12px;
}

.cskh-modal select,
.cskh-modal textarea,
.cskh-modal input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    font-size: 0.85rem;
}

.cskh-modal textarea {
    min-height: 60px;
    resize: vertical;
}

.cskh-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.cskh-modal-actions button {
    flex: 1;
}

/* --- Empty state --- */
.cskh-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #6b7280);
}

.cskh-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .cskh-tab-btn {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .cskh-kpi-card {
        min-width: 85px;
        padding: 8px 10px;
    }

    .cskh-kpi-card .kpi-val {
        font-size: 1.1rem;
    }

    .cskh-task-card {
        padding: 10px;
    }
}