/* ============================================
   Client Tracking Dashboard CSS
   ============================================ */

/* ===== Glassmorphism Cards ===== */
    .dash-card {
        background: rgba(255,255,255,0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255,255,255,0.3);
        border-radius: 16px;
        transition: transform 0.25s ease, box-shadow 0.25s ease;
        overflow: hidden;
        position: relative;
    }
    .dash-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    }
    .dash-card .accent-strip {
        position: absolute;
        top: 0; left: 0; right: 0;
        height: 4px;
    }
    .accent-blue    { background: linear-gradient(90deg, #667eea, #764ba2); }
    .accent-green   { background: linear-gradient(90deg, #43e97b, #38f9d7); }
    .accent-orange  { background: linear-gradient(90deg, #f6d365, #fda085); }
    .accent-purple  { background: linear-gradient(90deg, #a18cd1, #fbc2eb); }
    .accent-red     { background: linear-gradient(90deg, #f5576c, #ff6b6b); }

    /* ===== Metric Counter ===== */
    .metric-value {
        font-size: 2.2rem;
        font-weight: 800;
        line-height: 1;
        color: #1a1a2e;
        background: linear-gradient(135deg, #1a1a2e, #16213e);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    body.dark-mode .metric-value {
        color: #e0e0ff;
        background: linear-gradient(135deg, #c0c4d8, #e0e0ff);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    .metric-label {
        font-size: 0.82rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #6c757d;
    }

    /* ===== Section Headers ===== */
    .section-header {
        margin-top: 2.2rem;
        margin-bottom: 1.2rem;
        padding: 14px 20px;
        background: linear-gradient(135deg, rgba(102,126,234,0.08), rgba(118,75,162,0.05));
        border-left: 4px solid;
        border-image: linear-gradient(180deg, #667eea, #764ba2) 1;
        border-radius: 0 12px 12px 0;
    }
    .section-header:first-of-type {
        margin-top: 0;
    }
    .section-title {
        font-size: 1.1rem;
        font-weight: 800;
        color: #1a1a2e;
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0;
        letter-spacing: -0.2px;
    }
    .section-title i {
        font-size: 1.2rem;
        width: 32px;
        height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        -webkit-text-fill-color: white;
        flex-shrink: 0;
    }

    /* ===== Chart Card ===== */
    .chart-card {
        background: rgba(255,255,255,0.9);
        border: 1px solid rgba(255,255,255,0.3);
        border-radius: 16px;
        padding: 1.5rem;
    }

    /* ===== Tracking Table ===== */
    .tracking-table {
        border-collapse: separate;
        border-spacing: 0;
    }
    .tracking-table thead th {
        background: linear-gradient(135deg, #f8f9ff, #f0f1ff);
        font-size: 0.78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #6c757d;
        border-bottom: 2px solid #e9ecef;
        padding: 12px 16px;
    }
    .tracking-table tbody td {
        padding: 10px 16px;
        vertical-align: middle;
        border-bottom: 1px solid #f0f0f0;
        font-size: 0.88rem;
    }
    .tracking-table tbody tr:hover {
        background: rgba(102,126,234,0.04);
    }

    /* ===== Status installation ===== */
    .install-status {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 14px;
        border-radius: 20px;
        font-weight: 600;
        font-size: 0.85rem;
    }
    .install-status.active {
        background: rgba(40,167,69,0.12);
        color: #28a745;
    }
    .install-status.inactive {
        background: rgba(220,53,69,0.12);
        color: #dc3545;
    }
    .install-status.pending {
        background: rgba(255,193,7,0.12);
        color: #856404;
    }

    /* ===== Trend badges ===== */
    .trend-up {
        color: #28a745;
        font-size: 0.78rem;
        font-weight: 600;
    }
    .trend-down {
        color: #dc3545;
        font-size: 0.78rem;
        font-weight: 600;
    }

    /* ===== Status dots (legend) ===== */
    .status-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    /* ===== Status pills (table) ===== */
    .status-pill {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 10px;
        font-size: 0.9rem;
    }
    .status-high {
        background: rgba(40,167,69,0.12);
        color: #28a745;
    }
    .status-crawled {
        background: rgba(253,126,20,0.12);
        color: #fd7e14;
    }
    .status-cited {
        background: rgba(13,202,240,0.12);
        color: #0dcaf0;
    }
    .status-invisible {
        background: rgba(220,53,69,0.12);
        color: #dc3545;
    }
    .status-none {
        background: rgba(108,117,125,0.12);
        color: #6c757d;
    }

    /* ===== Inline bar charts ===== */
    .bar-track {
        height: 8px;
        border-radius: 4px;
        background: #e9ecef;
        overflow: hidden;
        min-width: 60px;
    }
    .bar-fill {
        height: 100%;
        border-radius: 4px;
        min-width: 2px;
        transition: width 0.4s ease;
    }
    .bar-crawls {
        background: linear-gradient(90deg, #667eea, #764ba2);
    }
    .bar-referrals {
        background: linear-gradient(90deg, #43e97b, #38f9d7);
    }
    .bar-value {
        font-size: 0.82rem;
        font-weight: 700;
        min-width: 28px;
        text-align: right;
        color: #333;
    }

    /* ===== Page URL code style ===== */
    .page-url {
        font-size: 0.82rem;
        color: #495057;
        background: rgba(102,126,234,0.06);
        padding: 3px 8px;
        border-radius: 6px;
        border: 1px solid rgba(102,126,234,0.1);
        max-width: 350px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
    }

    /* ===== Page card layout ===== */
    .page-card-layout {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
        min-height: 0;
    }
    .page-card-layout.has-1-chart {
        grid-template-columns: 1fr 180px;
    }
    .page-card-layout.has-2-charts {
        grid-template-columns: 1fr 180px 180px;
    }
    .page-card-layout.has-3-charts {
        grid-template-columns: 1fr 160px 160px 160px;
    }
    @media (max-width: 767.98px) {
        .page-card-layout.has-1-chart,
        .page-card-layout.has-2-charts,
        .page-card-layout.has-3-charts {
            grid-template-columns: 1fr;
        }
        .page-card-chart {
            border-left: none !important;
            border-top: 1px solid rgba(0,0,0,0.06);
            justify-content: center;
        }
    }
    .page-card-info {
        padding: 10px 14px;
        min-width: 0;
    }
    .page-card-chart {
        display: flex;
        align-items: center;
        justify-content: center;
        border-left: 1px solid rgba(0,0,0,0.06);
        padding: 6px;
    }
    body.dark-mode .page-card-chart {
        border-left-color: rgba(255,255,255,0.08);
        border-top-color: rgba(255,255,255,0.08);
    }
    .page-card-item .bot-line {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 1px 0;
        font-size: 0.78rem;
    }
    .page-card-item .bot-name {
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    .page-card-item .bot-provider {
        color: #888;
        font-size: 0.68rem;
    }
    .page-card-item .bot-count {
        font-size: 0.68rem;
        background: #f0f0f0;
        padding: 1px 5px;
        border-radius: 4px;
        font-weight: 600;
        flex-shrink: 0;
    }
    .page-card-item .bot-date {
        color: #999;
        font-size: 0.68rem;
        margin-left: auto;
        flex-shrink: 0;
    }
    body.dark-mode .page-card-item .bot-count {
        background: rgba(255,255,255,0.1);
        color: #c0c4d8;
    }
    .page-card-item .detail-section-label {
        font-size: 0.7rem;
        color: #888;
        font-weight: 600;
        margin-bottom: 2px;
        margin-top: 6px;
    }
    .page-card-item .detail-section-label:first-child {
        margin-top: 0;
    }

    /* ===== Metric Help Button (popovers) ===== */
    .metric-help {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: rgba(108, 117, 125, 0.08);
        color: #6c757d;
        font-size: 0.7rem;
        font-weight: 700;
        cursor: pointer;
        border: none;
        padding: 0;
        line-height: 1;
        vertical-align: middle;
        margin-left: 4px;
        flex-shrink: 0;
    }
    .metric-help:hover {
        background: rgba(102, 126, 234, 0.15);
        color: #667eea;
    }
    body.dark-mode .metric-help {
        background: rgba(255,255,255,0.08);
        color: #8a8fb5;
    }
    body.dark-mode .metric-help:hover {
        background: rgba(102, 126, 234, 0.25);
        color: #a0b0ff;
    }
    .metric-help-abs {
        position: absolute;
        top: 8px;
        right: 8px;
    }

    /* ===== Popover dark mode ===== */
    body.dark-mode .popover {
        background: #1a1f3e;
        border-color: #2d3561;
    }
    body.dark-mode .popover-header {
        background: #16213e;
        color: #e8e8e8;
        border-bottom-color: #2d3561;
    }
    body.dark-mode .popover-body {
        color: #c0c4d8;
    }
    body.dark-mode .bs-popover-top > .popover-arrow::before { border-top-color: #2d3561; }
    body.dark-mode .bs-popover-top > .popover-arrow::after { border-top-color: #1a1f3e; }
    body.dark-mode .bs-popover-bottom > .popover-arrow::before { border-bottom-color: #2d3561; }
    body.dark-mode .bs-popover-bottom > .popover-arrow::after { border-bottom-color: #16213e; }
    body.dark-mode .bs-popover-start > .popover-arrow::before { border-left-color: #2d3561; }
    body.dark-mode .bs-popover-start > .popover-arrow::after { border-left-color: #1a1f3e; }
    body.dark-mode .bs-popover-end > .popover-arrow::before { border-right-color: #2d3561; }
    body.dark-mode .bs-popover-end > .popover-arrow::after { border-right-color: #1a1f3e; }

    /* ===== AI Files section ===== */
    .ai-file-pre {
        background: #1a1a2e;
        color: #c0c4d8;
        font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
        font-size: 0.8rem;
        padding: 16px;
        border-radius: 10px;
        max-height: 300px;
        overflow: auto;
        white-space: pre-wrap;
        word-break: break-all;
        margin: 0;
    }
    .ai-bot-list {
        list-style: none;
        padding: 0;
        margin: 8px 0 0 0;
        font-size: 0.82rem;
    }
    .ai-bot-list li {
        padding: 2px 0;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    body.dark-mode .ai-file-pre {
        background: #0d1b2a;
        color: #b8c4e8;
    }
    .ai-file-pre.ai-file-full {
        max-height: none;
    }

    /* ===== Dark mode ===== */
    body.dark-mode .section-header {
        background: linear-gradient(135deg, rgba(102,126,234,0.12), rgba(118,75,162,0.08));
    }
    body.dark-mode .section-title {
        color: #e8e8e8;
    }
    body.dark-mode .dash-card {
        background: rgba(15,52,96,0.85);
        border-color: #2d3561;
    }
    body.dark-mode .dash-card:hover {
        box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    }
    body.dark-mode .metric-value {
        background: linear-gradient(135deg, #e8e8e8, #b8c4e8);
        -webkit-background-clip: text;
        background-clip: text;
    }
    body.dark-mode .metric-label {
        color: #888;
    }
    body.dark-mode .chart-card {
        background: rgba(15,52,96,0.9);
        border-color: #2d3561;
    }
    body.dark-mode .tracking-table thead th {
        background: linear-gradient(135deg, #16213e, #0f3460);
        color: #888;
        border-bottom-color: #2d3561;
    }
    body.dark-mode .tracking-table,
    body.dark-mode .tracking-table > :not(caption) > * > * {
        background-color: transparent;
        color: #e8e8e8;
        border-bottom-color: #2d3561;
    }
    body.dark-mode .tracking-table tbody tr:hover {
        background: rgba(102,126,234,0.08);
    }
    body.dark-mode .bar-track {
        background: #2d3561;
    }
    body.dark-mode .bar-value {
        color: #c0c4d8;
    }
    body.dark-mode .page-url {
        color: #b8c4e8;
        background: rgba(102,126,234,0.1);
        border-color: rgba(102,126,234,0.2);
    }
    body.dark-mode .status-high {
        background: rgba(40,167,69,0.2);
    }
    body.dark-mode .status-crawled {
        background: rgba(253,126,20,0.2);
    }
    body.dark-mode .status-cited {
        background: rgba(13,202,240,0.2);
    }
    body.dark-mode .status-invisible {
        background: rgba(220,53,69,0.2);
    }
    body.dark-mode .status-none {
        background: rgba(108,117,125,0.2);
    }
    body.dark-mode .install-status.active {
        background: rgba(40,167,69,0.2);
    }
    body.dark-mode .install-status.inactive {
        background: rgba(220,53,69,0.2);
    }
    body.dark-mode .install-status.pending {
        background: rgba(255,193,7,0.2);
    }

    /* ApexCharts dark mode */
    body.dark-mode .apexcharts-legend-text {
        color: #c0c4d8 !important;
    }
    body.dark-mode .apexcharts-tooltip,
    body.dark-mode .apexcharts-tooltip.apexcharts-theme-light {
        background: #1a1f3e !important;
        border-color: #2d3561 !important;
        color: #e8e8e8 !important;
    }
    body.dark-mode .apexcharts-tooltip .apexcharts-tooltip-title {
        background: #16213e !important;
        border-bottom-color: #2d3561 !important;
        color: #c0c4d8 !important;
    }
    body.dark-mode .apexcharts-tooltip .apexcharts-tooltip-text,
    body.dark-mode .apexcharts-tooltip .apexcharts-tooltip-text-y-value,
    body.dark-mode .apexcharts-tooltip .apexcharts-tooltip-text-y-label {
        color: #e8e8e8 !important;
    }
    body.dark-mode .apexcharts-xaxis-label,
    body.dark-mode .apexcharts-yaxis-label {
        fill: #888 !important;
    }
    body.dark-mode .apexcharts-grid line,
    body.dark-mode .apexcharts-gridline {
        stroke: #2d3561 !important;
    }
    /* ===== Guided Tour ===== */
    .tour-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5); z-index: 10000; display: none;
        pointer-events: none;
    }
    .tour-tooltip {
        position: absolute; z-index: 10002; max-width: 380px; width: 90vw;
        background: #fff; border: 1px solid #dee2e6; border-radius: 12px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.18); padding: 20px; display: none;
    }
    .tour-tooltip h5 { margin: 0 0 8px; font-size: 1rem; font-weight: 600; color: #333; }
    .tour-tooltip p { margin: 0 0 16px; font-size: 0.875rem; color: #666; line-height: 1.5; }
    .tour-tooltip .tour-footer { display: flex; justify-content: space-between; align-items: center; }
    .tour-tooltip .tour-steps { font-size: 0.8rem; color: #999; }
    .tour-tooltip .tour-btn {
        border: none; border-radius: 8px; padding: 6px 16px; font-size: 0.85rem;
        cursor: pointer; transition: opacity 0.2s;
    }
    .tour-tooltip .tour-btn:hover { opacity: 0.85; }
    .tour-tooltip .tour-btn-skip { background: #f1f3f5; color: #666; }
    .tour-tooltip .tour-btn-next { background: linear-gradient(135deg,#667eea,#764ba2); color: #fff; margin-left: 8px; }
    .tour-highlight {
        position: relative; z-index: 10001 !important;
        border-radius: 10px;
        box-shadow: 0 0 0 4px rgba(102,126,234,0.6), 0 0 0 9999px rgba(0,0,0,0.5), 0 0 30px rgba(102,126,234,0.5);
    }
    body.dark-mode .tour-tooltip { background: #1e2235; border-color: #2d3561; }
    body.dark-mode .tour-tooltip h5 { color: #e0e0e0; }
    body.dark-mode .tour-tooltip p { color: #aaa; }
    body.dark-mode .tour-tooltip .tour-steps { color: #777; }
    body.dark-mode .tour-tooltip .tour-btn-skip { background: #2d3561; color: #aaa; }

