/* ========== TrustBuilding Design System ========== */

/* Help Page */
.help-sidebar { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; padding-right: 16px; border-right: 1px solid #e5e7eb; }
.help-nav-link { display: flex; align-items: center; gap: 6px; padding: 7px 14px; color: #6b7280; text-decoration: none; font-size: 13px; font-weight: 500; transition: all 150ms; border-right: 3px solid transparent; border-top: none; border-bottom: none; border-left: none; background: none; width: 100%; text-align: left; cursor: pointer; }
.help-nav-link:hover { color: #374151; background: #f3f4f6; }
.help-nav-link.active { color: #3b82f6; background: #eff6ff; font-weight: 600; border-right-color: #3b82f6; }
.help-nav-sub { padding-left: 12px; }
.help-nav-sub .help-nav-link { font-size: 12px; padding: 4px 14px 4px 24px; font-weight: 400; }
.help-section { scroll-margin-top: 80px; margin-bottom: 48px; padding-bottom: 36px; border-bottom: 1px solid #f3f4f6; }
.help-section:last-child { border-bottom: none; }
.help-section-title { font-size: 22px; font-weight: 700; color: #111827; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.help-section-desc { color: #6b7280; font-size: 14px; margin-bottom: 24px; line-height: 1.6; }
.help-subsection { margin: 28px 0; }
.help-subsection-title { font-size: 15px; font-weight: 700; color: #374151; margin-bottom: 10px; padding-left: 12px; border-left: 3px solid #3b82f6; }
.help-tip { display: flex; gap: 8px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 14px; margin: 10px 0; font-size: 13px; color: #92400e; line-height: 1.5; }
.help-warning { display: flex; gap: 8px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 10px 14px; margin: 10px 0; font-size: 13px; color: #991b1b; line-height: 1.5; }
.help-info { display: flex; gap: 8px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 10px 14px; margin: 10px 0; font-size: 13px; color: #1e40af; line-height: 1.5; }
.help-step { display: flex; gap: 10px; margin-bottom: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; }
.help-step-num { width: 24px; height: 24px; border-radius: 50%; background: #3b82f6; color: white; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.help-flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 16px 0; padding: 16px; background: #f9fafb; border-radius: 10px; }
.help-flow-step { background: white; border: 1.5px solid #d1d5db; border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 500; color: #374151; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.help-flow-step.highlight { border-color: #22c55e; color: #166534; background: #f0fdf4; }
.help-flow-arrow { color: #9ca3af; }
.help-search-input { width: 100%; padding: 7px 12px 7px 30px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.help-search-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.1); }
.help-search-wrap { position: relative; margin: 0 0 14px; }
.help-search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 13px; pointer-events: none; }
.help-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 14px 0; border-radius: 8px; overflow: hidden; border: 1px solid #e5e7eb; }
.help-table th { background: #f9fafb; padding: 9px 14px; text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; color: #6b7280; border-bottom: 1px solid #e5e7eb; }
.help-table td { padding: 9px 14px; border-bottom: 1px solid #f3f4f6; color: #374151; }
.help-table tr:last-child td { border-bottom: none; }
.help-faq-item { border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 10px; overflow: hidden; transition: border-color 150ms; }
.help-faq-item:hover { border-color: #d1d5db; }
.help-faq-question { padding: 14px 18px; font-weight: 600; font-size: 14px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: #fafafa; transition: background 150ms; }
.help-faq-question:hover { background: #f3f4f6; }
.help-faq-answer { padding: 14px 18px; font-size: 13px; color: #4b5563; border-top: 1px solid #e5e7eb; line-height: 1.6; }
.help-back-top { position: fixed; bottom: 24px; right: 24px; width: 40px; height: 40px; background: #3b82f6; color: white; border: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity 300ms; box-shadow: 0 2px 8px rgba(0,0,0,0.2); z-index: 100; font-size: 16px; }
.help-back-top.visible { opacity: 1; }

/* Navigation Loading Bar */
.nav-loading-bar {
    position: fixed; top: 0; left: 0; width: 0%; height: 3px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    z-index: 9999; border-radius: 0 2px 2px 0;
    transition: width 0.3s ease;
}
.nav-loading-bar.loading { animation: nav-progress 1.5s ease infinite; }
.nav-loading-bar.complete {
    width: 100% !important; opacity: 0;
    transition: opacity 0.3s ease, width 0.1s ease;
}
@keyframes nav-progress {
    0% { width: 0%; opacity: 1; }
    50% { width: 70%; opacity: 1; }
    100% { width: 90%; opacity: 1; }
}
.page-loading-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.15); z-index: 9998; cursor: wait;
}
.page-loading-overlay.active { display: block; }

/* Global loading bar driven by LoadingStateService — pages call LoadingState.Start/Stop.
   Slides across the viewport instead of growing in width so it looks like "ongoing work"
   with unknown duration. Separate from .nav-loading-bar (that one is JS-driven). */
.page-loading-bar {
    position: fixed; top: 0; left: 0;
    width: 40%; height: 3px;
    background: linear-gradient(90deg, transparent, #0d6efd, transparent);
    z-index: 10000;
    animation: page-loading-slide 1.1s linear infinite;
    pointer-events: none;
}
@keyframes page-loading-slide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* Sidebar nav-link loading feedback */
.nav-link-loading { opacity: 0.5; pointer-events: none; cursor: wait; }

/* Stats Cards */
.stats-row { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.stats-card {
    background: #fff; border-radius: 10px; padding: 16px 20px; flex: 1; min-width: 160px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #f0f0f0;
    display: flex; align-items: center; gap: 14px;
}
.stats-card .stats-icon {
    width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.stats-card .stats-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; color: #111827; }
.stats-card .stats-label { font-size: 0.72rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.3px; }

/* Modern Table */
.table-modern { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-modern thead th {
    background: #f8f9fa; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: #6b7280; padding: 10px 16px; border-bottom: 2px solid #e5e7eb;
    position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
.table-modern tbody td {
    padding: 12px 16px; border-bottom: 1px solid #f3f4f6; vertical-align: middle;
    font-size: 0.88rem; color: #374151;
}
.table-modern tbody tr { transition: background 150ms ease; }
.table-modern tbody tr:hover { background: #f0f7ff; }

/* Cell content helpers */
.cell-name { font-weight: 600; color: #111827; }
.cell-name a { color: #2563eb; text-decoration: none; }
.cell-name a:hover { color: #1d4ed8; text-decoration: underline; }
.cell-sub { font-size: 0.72rem; color: #9ca3af; margin-top: 2px; }
.cell-truncate { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Rating Display */
.rating-display { display: inline-flex; align-items: baseline; gap: 4px; }
.rating-stars { color: #f59e0b; font-size: 0.85rem; letter-spacing: -1px; }
.rating-value { font-weight: 700; font-size: 0.88rem; }
.rating-value.rating-low { color: #ef4444; }
.rating-value.rating-mid { color: #f97316; }
.rating-value.rating-high { color: #22c55e; }
.rating-reviews { font-size: 0.7rem; color: #9ca3af; }

/* Badge Pill */
.badge-pill {
    display: inline-flex; align-items: center; border-radius: 20px; padding: 3px 10px;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.2px;
}
.badge-pill-success { background: #dcfce7; color: #166534; }
.badge-pill-danger { background: #fee2e2; color: #991b1b; }
.badge-pill-warning { background: #fef3c7; color: #92400e; }
.badge-pill-info { background: #dbeafe; color: #1e40af; }
.badge-pill-secondary { background: #f3f4f6; color: #4b5563; }
.badge-pill-purple { background: #ede9fe; color: #5b21b6; }

/* Running animation */
.badge-pill-running { background: #dbeafe; color: #1e40af; animation: pulse-badge 2s infinite; }
@keyframes pulse-badge { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Action Buttons */
.action-btn-group { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; }
.action-btn {
    width: 30px; height: 30px; border-radius: 6px; border: 1px solid #e5e7eb;
    background: transparent; display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 150ms ease; font-size: 14px; color: #6b7280; padding: 0;
}
.action-btn:hover { opacity: 0.85; }
.action-btn-view { border-color: #3b82f6; color: #3b82f6; }
.action-btn-view:hover { background: rgba(59,130,246,0.1); }
.action-btn-edit { border-color: #6b7280; color: #6b7280; }
.action-btn-edit:hover { background: rgba(107,114,128,0.1); }
.action-btn-delete { border-color: #ef4444; color: #ef4444; }
.action-btn-delete:hover { background: rgba(239,68,68,0.1); }
.action-btn-success { border-color: #10b981; color: #10b981; }
.action-btn-success:hover { background: rgba(16,185,129,0.1); }
.action-btn-warning { border-color: #f59e0b; color: #f59e0b; }
.action-btn-warning:hover { background: rgba(245,158,11,0.1); }
.action-btn-purple { border-color: #8b5cf6; color: #8b5cf6; }
.action-btn-purple:hover { background: rgba(139,92,246,0.1); }

/* Activity delete button — hidden by default, shown on hover */
.activity-row .activity-delete-btn { opacity: 0; transition: opacity 150ms; }
.activity-row:hover .activity-delete-btn { opacity: 1; }

/* Zalo accounts — inline icon-button action row in the last td
   (replaces dropdown; reliable because no position magic is needed) */
.zalo-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #6b7280;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 120ms, color 120ms, border-color 120ms;
}
.zalo-icon-btn:hover:not(:disabled) { background: #f3f4f6; color: #111827; border-color: #d1d5db; }
.zalo-icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.zalo-icon-btn-primary { color: #2563eb; border-color: #bfdbfe; }
.zalo-icon-btn-primary:hover:not(:disabled) { background: #eff6ff; color: #1d4ed8; border-color: #60a5fa; }
.zalo-icon-btn-danger { color: #dc2626; border-color: #fecaca; }
.zalo-icon-btn-danger:hover:not(:disabled) { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }

/* Filter Bar */
.filter-bar {
    background: #fff; border-radius: 10px; padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #f0f0f0; margin-bottom: 16px;
}
.filter-bar .form-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; color: #6b7280; letter-spacing: 0.3px; margin-bottom: 4px; }
.filter-bar .form-control, .filter-bar .form-select {
    border-radius: 8px; font-size: 0.85rem; border-color: #e5e7eb;
}
.filter-bar .form-control:focus, .filter-bar .form-select:focus { border-color: #4f46e5; box-shadow: 0 0 0 2px rgba(79,70,229,0.1); }

/* Pagination Bar */
.pagination-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: #fff; border-top: 1px solid #f0f0f0;
}
.pagination-bar .pagination-info { font-size: 0.8rem; color: #6b7280; }
.pagination-bar .pagination { margin: 0; }
.pagination-bar .page-link {
    border-radius: 6px; margin: 0 2px; font-size: 0.8rem; min-width: 34px;
    text-align: center; border: 1px solid #e5e7eb; color: #374151;
}
.pagination-bar .page-item.active .page-link { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.pagination-bar .page-link:hover { background: #f3f4f6; }
.pagination-bar .page-size-select { width: 70px; font-size: 0.8rem; border-radius: 6px; }

/* Score Badge */
.score-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%; font-weight: 700; font-size: 0.8rem;
}
.score-hot { background: #fee2e2; color: #dc2626; }
.score-warm { background: #fef3c7; color: #d97706; }
.score-cold { background: #f3f4f6; color: #6b7280; }

/* Empty State */
.empty-state { text-align: center; padding: 48px 20px; color: #9ca3af; }
.empty-state i { font-size: 3rem; margin-bottom: 12px; display: block; }
.empty-state .empty-title { font-size: 1rem; font-weight: 600; color: #6b7280; margin-bottom: 4px; }
.empty-state .empty-hint { font-size: 0.85rem; }

/* Sentiment emoji */
.sentiment-positive { color: #16a34a; }
.sentiment-negative { color: #dc2626; }
.sentiment-neutral { color: #6b7280; }

/* Card wrapper for tables */
.table-card {
    background: #fff; border-radius: 10px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #f0f0f0;
}

/* DB-unreachable dev diagnostic banner (shown by MainLayout when Seed step caught SqlException) */
.db-unreachable-banner {
    position: sticky; top: 0; z-index: 1090;
    background: #fee2e2; border-bottom: 1px solid #fca5a5;
    color: #991b1b; font-size: 0.875rem; font-weight: 500;
    padding: 8px 16px; text-align: center; width: 100%;
}
