/* =========================================================
   WONDER APP — VENDOR ANALYTICS
   File: vendor_app/assets/css/analytics.css
   Scope: Vendor Analytics Module
   ========================================================= */


/* =========================================================
   1. ANALYTICS VARIABLES
   ========================================================= */

.analytics-page {
    --analytics-primary: var(--primary-color, var(--primary, #2563eb));
    --analytics-primary-soft: var(--primary-light, #eff6ff);
    --analytics-primary-dark: var(--primary-dark, #1d4ed8);

    --analytics-success: var(--success-color, var(--success, #16a34a));
    --analytics-warning: var(--warning-color, var(--warning, #d97706));
    --analytics-danger: var(--danger-color, var(--danger, #dc2626));
    --analytics-info: var(--info-color, var(--info, #0284c7));

    --analytics-text: var(--text-primary, #111827);
    --analytics-text-secondary: var(--text-secondary, #4b5563);
    --analytics-text-muted: var(--text-muted, #6b7280);

    --analytics-bg: var(--bg-color, #f8fafc);
    --analytics-surface: var(--surface-color, #ffffff);
    --analytics-card: var(--card-bg, #ffffff);

    --analytics-border: var(--border-color, #e5e7eb);
    --analytics-border-light: #eef2f7;

    --analytics-radius-sm: var(--radius-sm, 6px);
    --analytics-radius-md: var(--radius-md, 10px);
    --analytics-radius-lg: var(--radius-lg, 14px);
    --analytics-radius-xl: var(--radius-xl, 18px);

    --analytics-shadow-sm: var(
        --shadow-sm,
        0 1px 3px rgba(15, 23, 42, 0.06)
    );

    --analytics-shadow-md: var(
        --shadow-md,
        0 5px 18px rgba(15, 23, 42, 0.08)
    );

    --analytics-shadow-lg: var(
        --shadow-lg,
        0 12px 35px rgba(15, 23, 42, 0.12)
    );

    --analytics-transition: var(
        --transition-normal,
        180ms ease
    );

    color: var(--analytics-text);
}


/* =========================================================
   2. PAGE HEADER
   ========================================================= */

.analytics-page .analytics-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.analytics-header-content {
    min-width: 0;
}

.analytics-title {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 2rem);
    line-height: 1.25;
    font-weight: 700;
    color: var(--analytics-text);
    letter-spacing: -0.02em;
}

.analytics-subtitle {
    margin: 7px 0 0;
    max-width: 760px;
    color: var(--analytics-text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
}

.analytics-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}


/* =========================================================
   3. DATE / RANGE FILTER
   ========================================================= */

.analytics-date-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.analytics-date-filter select,
.analytics-date-filter input {
    min-height: 40px;
}

.analytics-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.analytics-date-range-separator {
    color: var(--analytics-text-muted);
    font-size: 0.85rem;
}

.analytics-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--analytics-surface);
    border: 1px solid var(--analytics-border);
    border-radius: var(--analytics-radius-md);
}

.analytics-filter-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.analytics-filter-label {
    color: var(--analytics-text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
}

.analytics-filter {
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--analytics-border);
    border-radius: var(--analytics-radius-sm);
    background: var(--analytics-surface);
    color: var(--analytics-text);
    font-size: 0.86rem;
    outline: none;
    transition:
        border-color var(--analytics-transition),
        box-shadow var(--analytics-transition);
}

.analytics-filter:hover {
    border-color: #cbd5e1;
}

.analytics-filter:focus {
    border-color: var(--analytics-primary);
    box-shadow: 0 0 0 3px color-mix(
        in srgb,
        var(--analytics-primary) 12%,
        transparent
    );
}


/* =========================================================
   4. KPI / SUMMARY CARDS
   ========================================================= */

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.analytics-kpi {
    position: relative;
    min-width: 0;
    padding: 18px;
    background: var(--analytics-card);
    border: 1px solid var(--analytics-border);
    border-radius: var(--analytics-radius-lg);
    box-shadow: var(--analytics-shadow-sm);
    overflow: hidden;
    transition:
        transform var(--analytics-transition),
        box-shadow var(--analytics-transition),
        border-color var(--analytics-transition);
}

.analytics-kpi:hover {
    transform: translateY(-2px);
    box-shadow: var(--analytics-shadow-md);
    border-color: #d7dee8;
}

.analytics-kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.analytics-kpi-label {
    margin: 0;
    color: var(--analytics-text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
}

.analytics-kpi-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--analytics-primary-soft);
    color: var(--analytics-primary);
    font-size: 1.05rem;
}

.analytics-kpi-value {
    margin-top: 10px;
    color: var(--analytics-text);
    font-size: clamp(1.4rem, 2vw, 1.9rem);
    line-height: 1.15;
    font-weight: 750;
    letter-spacing: -0.025em;
}

.analytics-kpi-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 9px;
    color: var(--analytics-text-muted);
    font-size: 0.76rem;
}

.analytics-kpi-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
}

.analytics-kpi-change.is-up {
    color: var(--analytics-success);
}

.analytics-kpi-change.is-down {
    color: var(--analytics-danger);
}

.analytics-kpi-change.is-neutral {
    color: var(--analytics-text-muted);
}

.analytics-kpi-description {
    color: var(--analytics-text-muted);
}


/* =========================================================
   5. KPI COLOR STATES
   ========================================================= */

.analytics-kpi.is-success .analytics-kpi-icon {
    color: var(--analytics-success);
    background: color-mix(
        in srgb,
        var(--analytics-success) 10%,
        transparent
    );
}

.analytics-kpi.is-warning .analytics-kpi-icon {
    color: var(--analytics-warning);
    background: color-mix(
        in srgb,
        var(--analytics-warning) 10%,
        transparent
    );
}

.analytics-kpi.is-danger .analytics-kpi-icon {
    color: var(--analytics-danger);
    background: color-mix(
        in srgb,
        var(--analytics-danger) 10%,
        transparent
    );
}

.analytics-kpi.is-info .analytics-kpi-icon {
    color: var(--analytics-info);
    background: color-mix(
        in srgb,
        var(--analytics-info) 10%,
        transparent
    );
}


/* =========================================================
   6. ANALYTICS GRID
   ========================================================= */

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 18px;
}

.analytics-col-12 {
    grid-column: span 12;
}

.analytics-col-9 {
    grid-column: span 9;
}

.analytics-col-8 {
    grid-column: span 8;
}

.analytics-col-7 {
    grid-column: span 7;
}

.analytics-col-6 {
    grid-column: span 6;
}

.analytics-col-5 {
    grid-column: span 5;
}

.analytics-col-4 {
    grid-column: span 4;
}

.analytics-col-3 {
    grid-column: span 3;
}


/* =========================================================
   7. CHART CARD
   ========================================================= */

.analytics-card {
    min-width: 0;
    background: var(--analytics-card);
    border: 1px solid var(--analytics-border);
    border-radius: var(--analytics-radius-lg);
    box-shadow: var(--analytics-shadow-sm);
}

.analytics-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--analytics-border-light);
}

.analytics-card-title {
    margin: 0;
    color: var(--analytics-text);
    font-size: 0.98rem;
    font-weight: 700;
}

.analytics-card-subtitle {
    margin: 5px 0 0;
    color: var(--analytics-text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.analytics-card-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.analytics-card-body {
    min-width: 0;
    padding: 20px;
}

.analytics-card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--analytics-border-light);
    color: var(--analytics-text-muted);
    font-size: 0.78rem;
}


/* =========================================================
   8. CHART CONTAINERS
   ========================================================= */

.analytics-chart {
    position: relative;
    width: 100%;
    min-height: 300px;
}

.analytics-chart-sm {
    min-height: 220px;
}

.analytics-chart-md {
    min-height: 300px;
}

.analytics-chart-lg {
    min-height: 390px;
}

.analytics-chart canvas,
.analytics-chart svg {
    display: block;
    width: 100%;
    max-width: 100%;
}

.analytics-chart-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px 20px;
    margin-top: 14px;
}

.analytics-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--analytics-text-secondary);
    font-size: 0.76rem;
}

.analytics-legend-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: var(--analytics-primary);
}


/* =========================================================
   9. TREND INDICATOR
   ========================================================= */

.analytics-trend {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    font-weight: 700;
}

.analytics-trend.is-up {
    color: var(--analytics-success);
}

.analytics-trend.is-down {
    color: var(--analytics-danger);
}

.analytics-trend.is-neutral {
    color: var(--analytics-text-muted);
}

.analytics-trend-value {
    font-weight: 750;
}

.analytics-trend-label {
    font-weight: 500;
    color: var(--analytics-text-muted);
}


/* =========================================================
   10. PERFORMANCE METRICS
   ========================================================= */

.analytics-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.analytics-metric {
    padding: 14px;
    border: 1px solid var(--analytics-border-light);
    border-radius: var(--analytics-radius-md);
    background: #fbfcfe;
}

.analytics-metric-label {
    color: var(--analytics-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.analytics-metric-value {
    margin-top: 6px;
    color: var(--analytics-text);
    font-size: 1.2rem;
    font-weight: 750;
}

.analytics-metric-meta {
    margin-top: 5px;
    color: var(--analytics-text-muted);
    font-size: 0.72rem;
}


/* =========================================================
   11. PROGRESS METERS
   ========================================================= */

.analytics-progress-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.analytics-progress-item {
    min-width: 0;
}

.analytics-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.analytics-progress-label {
    min-width: 0;
    overflow: hidden;
    color: var(--analytics-text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analytics-progress-value {
    flex: 0 0 auto;
    color: var(--analytics-text);
    font-size: 0.78rem;
    font-weight: 700;
}

.analytics-progress-track {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f7;
}

.analytics-progress-bar {
    height: 100%;
    min-width: 2px;
    border-radius: inherit;
    background: var(--analytics-primary);
    transition: width 400ms ease;
}

.analytics-progress-bar.is-success {
    background: var(--analytics-success);
}

.analytics-progress-bar.is-warning {
    background: var(--analytics-warning);
}

.analytics-progress-bar.is-danger {
    background: var(--analytics-danger);
}


/* =========================================================
   12. FUNNEL
   ========================================================= */

.analytics-funnel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 8px 0;
}

.analytics-funnel-step {
    width: var(--funnel-width, 100%);
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--analytics-radius-sm);
    background: var(--analytics-primary-soft);
    border: 1px solid color-mix(
        in srgb,
        var(--analytics-primary) 10%,
        transparent
    );
}

.analytics-funnel-label {
    color: var(--analytics-text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.analytics-funnel-value {
    color: var(--analytics-text);
    font-size: 0.88rem;
    font-weight: 750;
}

.analytics-funnel-conversion {
    color: var(--analytics-text-muted);
    font-size: 0.7rem;
}


/* =========================================================
   13. CONVERSION ANALYTICS
   ========================================================= */

.analytics-conversion {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.analytics-conversion-card {
    padding: 15px;
    border: 1px solid var(--analytics-border);
    border-radius: var(--analytics-radius-md);
    background: var(--analytics-surface);
}

.analytics-conversion-label {
    color: var(--analytics-text-muted);
    font-size: 0.74rem;
    font-weight: 600;
}

.analytics-conversion-value {
    margin-top: 6px;
    font-size: 1.35rem;
    font-weight: 750;
    color: var(--analytics-text);
}

.analytics-conversion-rate {
    margin-top: 5px;
    font-size: 0.73rem;
    color: var(--analytics-success);
    font-weight: 700;
}


/* =========================================================
   14. REVENUE ANALYTICS
   ========================================================= */

.analytics-revenue {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.analytics-revenue-main {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.analytics-revenue-label {
    color: var(--analytics-text-muted);
    font-size: 0.78rem;
}

.analytics-revenue-value {
    margin-top: 5px;
    font-size: clamp(1.7rem, 3vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.analytics-revenue-change {
    text-align: right;
}


/* =========================================================
   15. REVENUE BREAKDOWN
   ========================================================= */

.analytics-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.analytics-breakdown-item {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(100px, 2fr) auto;
    align-items: center;
    gap: 12px;
}

.analytics-breakdown-label {
    min-width: 0;
    color: var(--analytics-text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
}

.analytics-breakdown-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f7;
}

.analytics-breakdown-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--analytics-primary);
}

.analytics-breakdown-value {
    color: var(--analytics-text);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}


/* =========================================================
   16. LEAD / ENQUIRY SOURCE
   ========================================================= */

.analytics-source-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.analytics-source-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--analytics-border-light);
    border-radius: var(--analytics-radius-sm);
}

.analytics-source-info {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.analytics-source-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--analytics-primary);
}

.analytics-source-name {
    min-width: 0;
    color: var(--analytics-text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.analytics-source-value {
    color: var(--analytics-text);
    font-size: 0.82rem;
    font-weight: 750;
}


/* =========================================================
   17. TOP PERFORMERS
   ========================================================= */

.analytics-ranking {
    display: flex;
    flex-direction: column;
}

.analytics-ranking-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--analytics-border-light);
}

.analytics-ranking-item:last-child {
    border-bottom: 0;
}

.analytics-ranking-position {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--analytics-text-secondary);
    font-size: 0.72rem;
    font-weight: 750;
}

.analytics-ranking-content {
    min-width: 0;
}

.analytics-ranking-title {
    overflow: hidden;
    color: var(--analytics-text);
    font-size: 0.8rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analytics-ranking-meta {
    margin-top: 3px;
    color: var(--analytics-text-muted);
    font-size: 0.7rem;
}

.analytics-ranking-value {
    color: var(--analytics-text);
    font-size: 0.8rem;
    font-weight: 750;
    white-space: nowrap;
}


/* =========================================================
   18. ANALYTICS TABLE
   ========================================================= */

.analytics-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.analytics-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.analytics-table th,
.analytics-table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--analytics-border-light);
}

.analytics-table th {
    background: #f8fafc;
    color: var(--analytics-text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.035em;
    white-space: nowrap;
}

.analytics-table td {
    color: var(--analytics-text);
    font-size: 0.79rem;
}

.analytics-table tbody tr {
    transition: background var(--analytics-transition);
}

.analytics-table tbody tr:hover {
    background: #fafcff;
}

.analytics-table .is-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.analytics-table .is-center {
    text-align: center;
}


/* =========================================================
   19. STATUS BADGES
   ========================================================= */

.analytics-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}

.analytics-status.is-success {
    color: #166534;
    background: #dcfce7;
}

.analytics-status.is-warning {
    color: #92400e;
    background: #fef3c7;
}

.analytics-status.is-danger {
    color: #991b1b;
    background: #fee2e2;
}

.analytics-status.is-info {
    color: #075985;
    background: #e0f2fe;
}

.analytics-status.is-neutral {
    color: #475569;
    background: #f1f5f9;
}


/* =========================================================
   20. REPORTS
   ========================================================= */

.analytics-reports {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.analytics-report-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 18px;
    background: var(--analytics-card);
    border: 1px solid var(--analytics-border);
    border-radius: var(--analytics-radius-lg);
    transition:
        transform var(--analytics-transition),
        box-shadow var(--analytics-transition);
}

.analytics-report-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--analytics-shadow-md);
}

.analytics-report-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--analytics-primary-soft);
    color: var(--analytics-primary);
    margin-bottom: 14px;
}

.analytics-report-title {
    margin: 0;
    color: var(--analytics-text);
    font-size: 0.92rem;
    font-weight: 700;
}

.analytics-report-description {
    margin: 6px 0 16px;
    color: var(--analytics-text-muted);
    font-size: 0.76rem;
    line-height: 1.55;
}

.analytics-report-actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}


/* =========================================================
   21. REPORT EXPORT
   ========================================================= */

.analytics-export {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.analytics-export-option {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid var(--analytics-border);
    border-radius: var(--analytics-radius-sm);
    background: var(--analytics-surface);
    color: var(--analytics-text-secondary);
    font-size: 0.75rem;
    font-weight: 650;
    cursor: pointer;
    transition:
        color var(--analytics-transition),
        border-color var(--analytics-transition),
        background var(--analytics-transition);
}

.analytics-export-option:hover {
    color: var(--analytics-primary);
    border-color: var(--analytics-primary);
    background: var(--analytics-primary-soft);
}


/* =========================================================
   22. EMPTY STATE
   ========================================================= */

.analytics-empty {
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.analytics-empty-icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border-radius: 14px;
    background: #f1f5f9;
    color: var(--analytics-text-muted);
    font-size: 1.3rem;
}

.analytics-empty-title {
    margin: 0;
    color: var(--analytics-text);
    font-size: 0.95rem;
    font-weight: 700;
}

.analytics-empty-description {
    max-width: 440px;
    margin: 7px 0 0;
    color: var(--analytics-text-muted);
    font-size: 0.78rem;
    line-height: 1.6;
}


/* =========================================================
   23. LOADING STATE
   ========================================================= */

.analytics-loading {
    position: relative;
    min-height: 180px;
}

.analytics-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(
        in srgb,
        var(--analytics-surface) 82%,
        transparent
    );
    backdrop-filter: blur(2px);
}

.analytics-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--analytics-primary);
    border-radius: 50%;
    animation: analytics-spin 700ms linear infinite;
}

@keyframes analytics-spin {
    to {
        transform: rotate(360deg);
    }
}


/* =========================================================
   24. SKELETON
   ========================================================= */

.analytics-skeleton {
    position: relative;
    overflow: hidden;
    background: #eef2f7;
    border-radius: 7px;
}

.analytics-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.65),
        transparent
    );
    animation: analytics-skeleton 1.4s infinite;
}

.analytics-skeleton-title {
    width: 42%;
    height: 14px;
}

.analytics-skeleton-value {
    width: 62%;
    height: 28px;
    margin-top: 12px;
}

.analytics-skeleton-chart {
    width: 100%;
    height: 250px;
    margin-top: 16px;
}

@keyframes analytics-skeleton {
    100% {
        transform: translateX(100%);
    }
}


/* =========================================================
   25. ERROR STATE
   ========================================================= */

.analytics-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 28px;
    text-align: center;
}

.analytics-error-content {
    max-width: 480px;
}

.analytics-error-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fee2e2;
    color: var(--analytics-danger);
}

.analytics-error-title {
    margin: 0;
    color: var(--analytics-text);
    font-size: 0.95rem;
    font-weight: 700;
}

.analytics-error-message {
    margin: 7px 0 16px;
    color: var(--analytics-text-muted);
    font-size: 0.78rem;
    line-height: 1.55;
}


/* =========================================================
   26. TOOLTIP
   ========================================================= */

.analytics-tooltip {
    position: absolute;
    z-index: 50;
    max-width: 240px;
    padding: 8px 10px;
    border-radius: 7px;
    background: #111827;
    color: #ffffff;
    font-size: 0.7rem;
    line-height: 1.4;
    box-shadow: var(--analytics-shadow-md);
    pointer-events: none;
}

.analytics-tooltip-title {
    margin-bottom: 3px;
    font-weight: 700;
}

.analytics-tooltip-value {
    opacity: 0.9;
}


/* =========================================================
   27. PAGINATION
   ========================================================= */

.analytics-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 16px;
}

.analytics-pagination-info {
    color: var(--analytics-text-muted);
    font-size: 0.74rem;
}

.analytics-pagination-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.analytics-pagination-button {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    border: 1px solid var(--analytics-border);
    border-radius: var(--analytics-radius-sm);
    background: var(--analytics-surface);
    color: var(--analytics-text-secondary);
    font-size: 0.75rem;
    font-weight: 650;
    cursor: pointer;
    transition:
        color var(--analytics-transition),
        background var(--analytics-transition),
        border-color var(--analytics-transition);
}

.analytics-pagination-button:hover:not(:disabled) {
    color: var(--analytics-primary);
    border-color: var(--analytics-primary);
    background: var(--analytics-primary-soft);
}

.analytics-pagination-button.is-active {
    color: #ffffff;
    border-color: var(--analytics-primary);
    background: var(--analytics-primary);
}

.analytics-pagination-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


/* =========================================================
   28. QUICK PERIOD TABS
   ========================================================= */

.analytics-period-tabs {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--analytics-border);
    border-radius: var(--analytics-radius-sm);
    background: #f8fafc;
}

.analytics-period-tab {
    min-height: 32px;
    padding: 6px 10px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--analytics-text-muted);
    font-size: 0.72rem;
    font-weight: 650;
    cursor: pointer;
}

.analytics-period-tab:hover {
    color: var(--analytics-text);
}

.analytics-period-tab.is-active {
    background: var(--analytics-surface);
    color: var(--analytics-primary);
    box-shadow: var(--analytics-shadow-sm);
}


/* =========================================================
   29. INSIGHT BOX
   ========================================================= */

.analytics-insight {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid color-mix(
        in srgb,
        var(--analytics-info) 18%,
        var(--analytics-border)
    );
    border-radius: var(--analytics-radius-md);
    background: color-mix(
        in srgb,
        var(--analytics-info) 5%,
        var(--analytics-surface)
    );
}

.analytics-insight-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(
        in srgb,
        var(--analytics-info) 12%,
        transparent
    );
    color: var(--analytics-info);
}

.analytics-insight-content {
    min-width: 0;
}

.analytics-insight-title {
    margin: 0;
    color: var(--analytics-text);
    font-size: 0.8rem;
    font-weight: 700;
}

.analytics-insight-text {
    margin: 4px 0 0;
    color: var(--analytics-text-secondary);
    font-size: 0.75rem;
    line-height: 1.55;
}


/* =========================================================
   30. COMPARISON VIEW
   ========================================================= */

.analytics-comparison {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.analytics-comparison-item {
    padding: 14px;
    border: 1px solid var(--analytics-border);
    border-radius: var(--analytics-radius-md);
}

.analytics-comparison-label {
    color: var(--analytics-text-muted);
    font-size: 0.72rem;
}

.analytics-comparison-value {
    margin-top: 6px;
    color: var(--analytics-text);
    font-size: 1.1rem;
    font-weight: 750;
}


/* =========================================================
   31. RESPONSIVE — 1200px
   ========================================================= */

@media (max-width: 1200px) {

    .analytics-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-col-9,
    .analytics-col-8 {
        grid-column: span 12;
    }

    .analytics-col-7,
    .analytics-col-6 {
        grid-column: span 6;
    }

    .analytics-reports {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* =========================================================
   32. RESPONSIVE — 992px
   ========================================================= */

@media (max-width: 992px) {

    .analytics-page .analytics-header {
        flex-direction: column;
        align-items: stretch;
    }

    .analytics-header-actions {
        justify-content: flex-start;
    }

    .analytics-col-7,
    .analytics-col-6,
    .analytics-col-5,
    .analytics-col-4 {
        grid-column: span 12;
    }

    .analytics-detail-grid {
        grid-template-columns: 1fr;
    }

    .analytics-conversion {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-breakdown-item {
        grid-template-columns: minmax(100px, 1fr) minmax(100px, 2fr) auto;
    }
}


/* =========================================================
   33. RESPONSIVE — 768px
   ========================================================= */

@media (max-width: 768px) {

    .analytics-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .analytics-kpi {
        padding: 15px;
    }

    .analytics-kpi-icon {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .analytics-filter-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .analytics-filter-group {
        width: 100%;
    }

    .analytics-filter {
        flex: 1 1 160px;
    }

    .analytics-date-range {
        width: 100%;
        flex-wrap: wrap;
    }

    .analytics-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .analytics-card-actions {
        justify-content: flex-start;
    }

    .analytics-card-body {
        padding: 16px;
    }

    .analytics-chart {
        min-height: 250px;
    }

    .analytics-chart-lg {
        min-height: 310px;
    }

    .analytics-revenue-main {
        align-items: flex-start;
        flex-direction: column;
    }

    .analytics-revenue-change {
        text-align: left;
    }

    .analytics-table-wrapper {
        margin-left: -16px;
        width: calc(100% + 32px);
    }

    .analytics-table {
        min-width: 650px;
    }

    .analytics-reports {
        grid-template-columns: 1fr;
    }

    .analytics-pagination {
        align-items: flex-start;
        flex-direction: column;
    }

    .analytics-pagination-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }
}


/* =========================================================
   34. RESPONSIVE — 576px
   ========================================================= */

@media (max-width: 576px) {

    .analytics-summary {
        grid-template-columns: 1fr;
    }

    .analytics-page .analytics-header {
        gap: 16px;
        margin-bottom: 18px;
    }

    .analytics-title {
        font-size: 1.35rem;
    }

    .analytics-subtitle {
        font-size: 0.82rem;
    }

    .analytics-header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .analytics-header-actions > * {
        width: 100%;
    }

    .analytics-filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .analytics-filter {
        width: 100%;
    }

    .analytics-date-range {
        display: grid;
        grid-template-columns: 1fr;
    }

    .analytics-date-range-separator {
        display: none;
    }

    .analytics-period-tabs {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
    }

    .analytics-period-tab {
        flex: 0 0 auto;
    }

    .analytics-card-header,
    .analytics-card-body {
        padding: 14px;
    }

    .analytics-metrics {
        grid-template-columns: 1fr;
    }

    .analytics-conversion {
        grid-template-columns: 1fr;
    }

    .analytics-comparison {
        grid-template-columns: 1fr;
    }

    .analytics-breakdown-item {
        grid-template-columns: 1fr auto;
    }

    .analytics-breakdown-track {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .analytics-breakdown-value {
        grid-column: 2;
        grid-row: 1;
    }

    .analytics-ranking-item {
        grid-template-columns: 30px minmax(0, 1fr) auto;
    }

    .analytics-chart {
        min-height: 220px;
    }

    .analytics-chart-lg {
        min-height: 270px;
    }

    .analytics-export {
        width: 100%;
    }

    .analytics-export-option {
        flex: 1 1 auto;
    }

    .analytics-insight {
        padding: 12px;
    }
}


/* =========================================================
   35. ACCESSIBILITY
   ========================================================= */

.analytics-page button:focus-visible,
.analytics-page a:focus-visible,
.analytics-page input:focus-visible,
.analytics-page select:focus-visible,
.analytics-page textarea:focus-visible {
    outline: 3px solid color-mix(
        in srgb,
        var(--analytics-primary) 30%,
        transparent
    );
    outline-offset: 2px;
}


/* =========================================================
   36. REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .analytics-page *,
    .analytics-page *::before,
    .analytics-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* =========================================================
   37. DARK MODE
   ========================================================= */

html[data-theme="dark"] .analytics-page,
.theme-dark .analytics-page {

    --analytics-text: #f1f5f9;
    --analytics-text-secondary: #cbd5e1;
    --analytics-text-muted: #94a3b8;

    --analytics-bg: #0f172a;
    --analytics-surface: #111827;
    --analytics-card: #111827;

    --analytics-border: #263244;
    --analytics-border-light: #1e293b;

    --analytics-primary-soft: rgba(37, 99, 235, 0.14);
}

html[data-theme="dark"] .analytics-page .analytics-filter,
.theme-dark .analytics-page .analytics-filter {
    background: #111827;
    color: var(--analytics-text);
    border-color: var(--analytics-border);
}

html[data-theme="dark"] .analytics-page .analytics-table th,
.theme-dark .analytics-page .analytics-table th {
    background: #0f172a;
    color: var(--analytics-text-secondary);
}

html[data-theme="dark"] .analytics-page .analytics-table tbody tr:hover,
.theme-dark .analytics-page .analytics-table tbody tr:hover {
    background: #172033;
}

html[data-theme="dark"] .analytics-page .analytics-metric,
.theme-dark .analytics-page .analytics-metric {
    background: #0f172a;
    border-color: var(--analytics-border);
}

html[data-theme="dark"] .analytics-page .analytics-progress-track,
.theme-dark .analytics-page .analytics-progress-track {
    background: #263244;
}

html[data-theme="dark"] .analytics-page .analytics-ranking-position,
.theme-dark .analytics-page .analytics-ranking-position {
    background: #1e293b;
}

html[data-theme="dark"] .analytics-page .analytics-period-tabs,
.theme-dark .analytics-page .analytics-period-tabs {
    background: #0f172a;
}

html[data-theme="dark"] .analytics-page .analytics-period-tab.is-active,
.theme-dark .analytics-page .analytics-period-tab.is-active {
    background: #1e293b;
}


/* =========================================================
   38. PRINT
   ========================================================= */

@media print {

    .analytics-page {
        --analytics-text: #000000;
        --analytics-text-secondary: #333333;
        --analytics-text-muted: #555555;
        --analytics-border: #cccccc;
        --analytics-card: #ffffff;
        --analytics-surface: #ffffff;
    }

    .analytics-page .analytics-header-actions,
    .analytics-page .analytics-filter-bar,
    .analytics-page .analytics-card-actions,
    .analytics-page .analytics-pagination,
    .analytics-page .analytics-export {
        display: none !important;
    }

    .analytics-page .analytics-grid {
        display: block;
    }

    .analytics-page .analytics-card,
    .analytics-page .analytics-kpi,
    .analytics-page .analytics-report-card {
        margin-bottom: 16px;
        box-shadow: none;
        break-inside: avoid;
    }

    .analytics-page .analytics-chart {
        break-inside: avoid;
    }

    .analytics-page a {
        color: inherit;
        text-decoration: none;
    }
}