/**
 * AlmaWeb AI Visitor Analytics - Admin Styles - ACTION-DRIVEN VERSION
 *
 * @package almaweb_ai_visitor_analytics
 * @since 1.0.0
 */

/* ====================
   Dashboard Général
   ==================== */
.almaweb-ai-visitor-analytics-dashboard,
.almaweb-ai-visitor-analytics-logs,
.almaweb-ai-visitor-analytics-settings,
.almaweb-ai-visitor-analytics-referrers {
    margin: 20px 20px 0 0;
}

/* ====================
   Header Principal
   ==================== */
.ava-main-header {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.header-icon {
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-icon .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
}

.header-text h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #1d2327;
}

.header-text .subtitle {
    font-size: 15px;
    color: #646970;
    margin: 0;
}


/* ====================
   Sélecteur de Période
   ==================== */
.period-selector {
    background: #fff;
    padding: 15px 20px;
    margin: 20px 0;
    border-left: 4px solid #2271b1;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.period-selector label {
    font-weight: 600;
    margin-right: 10px;
}

.period-selector select {
    min-width: 200px;
}

/* ====================
   HERO BAR - 4 KPIs Clés
   ==================== */
.hero-kpis-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.hero-kpi-card {
    background: #fff;
    padding: 24px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 2px solid transparent;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.hero-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: all 0.3s ease;
}

.hero-kpi-card.kpi-inference::before {
    background: linear-gradient(90deg, #10b981, #059669);
}

.hero-kpi-card.kpi-search::before {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

.hero-kpi-card.kpi-training::before {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.hero-kpi-card.kpi-scraping::before {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.hero-kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.hero-kpi-card .kpi-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-top: 6px;
}

.hero-kpi-card.kpi-inference {
    background-color: rgba(16, 185, 129, 0.05);
}
.hero-kpi-card.kpi-inference .kpi-icon {
    background-color: #10b981;
}

.hero-kpi-card.kpi-search {
    background-color: rgba(59, 130, 246, 0.05);
}
.hero-kpi-card.kpi-search .kpi-icon {
    background-color: #3b82f6;
}

.hero-kpi-card.kpi-training {
    background-color: rgba(245, 158, 11, 0.05);
}
.hero-kpi-card.kpi-training .kpi-icon {
    background-color: #f59e0b;
}

.hero-kpi-card.kpi-scraping {
    background-color: rgba(239, 68, 68, 0.05);
}
.hero-kpi-card.kpi-scraping .kpi-icon {
    background-color: #ef4444;
}

.hero-kpi-card .kpi-content {
    flex: 1;
}

.hero-kpi-card .kpi-value {
    font-size: 36px;
    font-weight: 700;
    color: #1d2327;
    line-height: 1.1;
    margin-bottom: 6px;
}

.hero-kpi-card .kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.hero-kpi-card .kpi-description {
    font-size: 13px;
    color: #787c82;
    line-height: 1.4;
}

/* Badge de pression */
.pressure-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pressure-badge.pressure-healthy {
    background: #d1fae5;
    color: #065f46;
}

.pressure-badge.pressure-moderate {
    background: #fef3c7;
    color: #92400e;
}

.pressure-badge.pressure-high {
    background: #fed7aa;
    color: #9a3412;
}

.pressure-badge.pressure-critical {
    background: #fee2e2;
    color: #991b1b;
}

/* ====================
   Score d'Autorité IA
   ==================== */
.ai-authority-score-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 32px 28px;
    margin: 30px 0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.ai-authority-score-card::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
}

.authority-score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.authority-score-header h2 {
    margin: 0;
    font-size: 22px;
    color: #fff;
}

.authority-score-badge {
    font-size: 32px;
    font-weight: 800;
    padding: 8px 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.authority-score-badge.grade-a,
.authority-score-badge.grade-a\+ {
    background: rgba(16, 185, 129, 0.3);
    border-color: rgba(16, 185, 129, 0.6);
}

.authority-score-badge.grade-b {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.6);
}

.authority-score-badge.grade-c {
    background: rgba(245, 158, 11, 0.3);
    border-color: rgba(245, 158, 11, 0.6);
}

.authority-score-badge.grade-d {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.6);
}

.authority-message {
    font-size: 15px;
    line-height: 1.6;
    margin: 12px 0 20px;
    position: relative;
    z-index: 1;
}

.authority-score-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.authority-score-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 20px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.authority-score-footer {
    font-size: 13px;
    margin-top: 12px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* ====================
   Dashboard Grids
   ==================== */
.dashboard-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 30px 0;
    align-items: start;
}

.secondary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin: 30px 0;
    align-items: start;
}

@media (max-width: 900px) {
    .dashboard-grid-2col,
    .secondary-grid {
        grid-template-columns: 1fr;
    }
}

/* ====================
   Sections Dashboard
   ==================== */
.dashboard-section {
    background: #fff;
    padding: 24px;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.dashboard-section h2 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #1d2327;
}

.dashboard-section > p {
    margin: 0 0 20px;
    font-size: 13px;
    color: #646970;
}

.chart-section {
    display: flex;
    flex-direction: column;
}

/* ====================
   Chart Containers
   ==================== */
.chart-container {
    position: relative;
    margin: 20px 0;
}

.chart-container.chart-pie {
    max-width: 400px;
    margin: 20px auto;
}

.chart-container.chart-stacked {
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

/* ====================
   Intention Legend (badges colorés)
   ==================== */
.intention-legend {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #646970;
}

.legend-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.legend-badge.badge-inference {
    background: #d1fae5;
    color: #065f46;
}

.legend-badge.badge-search {
    background: #dbeafe;
    color: #1e40af;
}

.legend-badge.badge-training {
    background: #fef3c7;
    color: #92400e;
}

.legend-badge.badge-scraping {
    background: #fee2e2;
    color: #991b1b;
}

/* ====================
   Top Topics Table
   ==================== */
.top-topics-table {
    margin-top: 20px;
    font-size: 13px;
}

.top-topics-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.top-topics-table a {
    color: #2271b1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.top-topics-table a:hover {
    color: #135e96;
    text-decoration: underline;
}

.visit-count-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
}

.intention-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mini-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.mini-badge.badge-inference {
    background: #d1fae5;
    color: #065f46;
}

.mini-badge.badge-search {
    background: #dbeafe;
    color: #1e40af;
}

.mini-badge.badge-training {
    background: #fef3c7;
    color: #92400e;
}

.mini-badge.badge-scraping {
    background: #fee2e2;
    color: #991b1b;
}

/* ====================
   Business Insights Grid
   ==================== */
.business-insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.insight-card {
    background: #fff;
    padding: 24px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #2271b1;
    transition: all 0.3s ease;
}

.insight-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.insight-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.insight-card h3 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.insight-value {
    font-size: 28px;
    font-weight: 700;
    color: #1d2327;
    margin-bottom: 8px;
    word-break: break-word;
}

.insight-value a {
    color: #2271b1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.insight-value a:hover {
    color: #135e96;
    text-decoration: underline;
}

.insight-detail {
    font-size: 13px;
    color: #787c82;
    margin: 0;
}

/* Tendance indicators */
.trend-positive {
    color: #10b981;
}

.trend-negative {
    color: #ef4444;
}

.trend-neutral {
    color: #6b7280;
}

/* ====================
   No Data Message
   ==================== */
.no-data-message {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
    font-size: 15px;
}

/* ====================
   AI Family Impact Grid (conservé pour Analytics)
   ==================== */
.ai-family-impact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    margin: 30px 0;
}

.family-impact-card {
    background: #fff;
    padding: 28px 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 160px;
    position: relative;
    overflow: hidden;
}

.family-impact-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2271b1, #135e96);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.family-impact-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-color: rgba(34, 113, 177, 0.2);
}

.family-impact-card:hover::before {
    transform: scaleX(1);
}

.family-impact-card h3 {
    margin: 0 0 20px;
    font-size: 15px;
    font-weight: 600;
    color: #50575e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.family-impact-card .impact-value {
    font-size: 42px;
    font-weight: 700;
    color: #1d2327;
    line-height: 1;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.family-impact-card .impact-change {
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.family-impact-card .impact-change.positive {
    color: #fff;
    background: linear-gradient(135deg, #00ba88, #00a32a);
    box-shadow: 0 2px 8px rgba(0, 163, 42, 0.3);
}

.family-impact-card .impact-change.negative {
    color: #fff;
    background: linear-gradient(135deg, #ff6b6b, #d63638);
    box-shadow: 0 2px 8px rgba(214, 54, 56, 0.3);
}

.family-impact-card .impact-change.new {
    color: #fff;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.3);
}

.family-impact-card .impact-description {
    margin: 0;
    font-size: 13px;
    color: #787c82;
    font-weight: 500;
}

.family-impact-card.global-impact {
    grid-column: span 2;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    min-height: 200px;
    padding: 36px 28px;
    position: relative;
    overflow: hidden;
}

.family-impact-card.global-impact::before {
    background: linear-gradient(90deg, rgba(255,255,255,0.3), rgba(255,255,255,0.1));
}

.family-impact-card.global-impact::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    top: -150px;
    right: -150px;
    border-radius: 50%;
}

.family-impact-card.global-impact h3,
.family-impact-card.global-impact .impact-value,
.family-impact-card.global-impact .impact-description {
    color: #fff;
    position: relative;
    z-index: 1;
}

.family-impact-card.global-impact h3 {
    font-size: 16px;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.family-impact-card.global-impact .impact-value {
    font-size: 64px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.family-impact-card.global-impact .impact-change {
    font-size: 16px;
    color: #fff;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.family-impact-card.global-impact .impact-change.positive {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.family-impact-card.global-impact .impact-change.negative {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.family-impact-card.global-impact .impact-description {
    font-size: 14px;
    opacity: 0.95;
}

@media (max-width: 960px) {
    .ai-family-impact-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }
    .family-impact-card.global-impact {
        grid-column: 1 / -1;
    }
    .family-impact-card {
        min-height: 140px;
        padding: 20px 16px;
    }
    .family-impact-card.global-impact {
        min-height: 180px;
    }
}

/* ====================
   Cartes de Statistiques (anciennes)
   ==================== */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stat-card.highlight {
    border-left: 4px solid #00a32a;
}

.stat-icon {
    font-size: 48px;
    line-height: 1;
}

.stat-content h3 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    color: #1d2327;
}

.stat-content p {
    margin: 5px 0 0;
    font-size: 14px;
    color: #646970;
}

/* ====================
   Badges (anciens, conservés)
   ==================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-ai_bot {
    background: #d63638;
    color: #fff;
}

.badge-scraper {
    background: #dba617;
    color: #fff;
}

.badge-search_engine {
    background: #2271b1;
    color: #fff;
}

.badge-human {
    background: #00a32a;
    color: #fff;
}

.badge-generic_bot {
    background: #8c8f94;
    color: #fff;
}

.badge-unknown {
    background: #646970;
    color: #fff;
}

.badge-no_user_agent {
    background: #000;
    color: #fff;
}

.badge-stealth {
    background: #8b0000;
    color: #fff;
}

.badge-stealth_ai_bot {
    background: #8b0000;
    color: #fff;
}

/* ====================
   Tables
   ==================== */
.wp-list-table {
    margin-top: 15px;
}

.wp-list-table th {
    font-weight: 600;
}

.wp-list-table code {
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* ====================
   Logs
   ==================== */
.logs-filters {
    background: #fff;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.logs-filters form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.logs-filters select,
.logs-filters input[type="text"] {
    min-width: 150px;
}

.results-info {
    font-weight: 600;
    color: #646970;
    margin: 10px 0;
}

.logs-table {
    font-size: 13px;
}

.logs-table .column-date {
    width: 140px;
}

.logs-table .column-ip {
    width: 130px;
}

.logs-table .column-bot {
    width: 150px;
}

.logs-table .column-type {
    width: 120px;
}

.logs-table .column-action {
    width: 120px;
    min-width: 80px;
}

.logs-table .column-details {
    width: 80px;
    text-align: center;
}

.ai-bot-row {
    background: #fff8e5 !important;
}

.ai-badge {
    font-size: 16px;
    margin-left: 5px;
}

.log-details td {
    background: #f6f7f7 !important;
    padding: 20px !important;
}

.details-content {
    max-width: 100%;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.detail-item {
    padding: 10px;
    background: #fff;
    border-radius: 4px;
}

.detail-item strong {
    display: block;
    margin-bottom: 5px;
    color: #1d2327;
}

.detail-item code {
    display: block;
    padding: 8px;
    background: #f0f0f1;
    border-radius: 3px;
    word-break: break-all;
    font-size: 12px;
}

.page-info {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-muted {
    color: #8c8f94;
}

.no-data {
    text-align: center;
    padding: 40px 20px !important;
    color: #8c8f94;
    font-style: italic;
}

/* ====================
   Settings
   ==================== */
.button-danger {
    color: #d63638 !important;
    border-color: #d63638 !important;
}

.button-danger:hover {
    background: #d63638 !important;
    color: #fff !important;
}

/* ====================
   Responsive
   ==================== */
@media (max-width: 782px) {
    .hero-kpis-bar {
        grid-template-columns: 1fr;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .business-insights-grid {
        grid-template-columns: 1fr;
    }

    .logs-filters form {
        flex-direction: column;
        align-items: stretch;
    }

    .logs-filters select,
    .logs-filters input[type="text"] {
        width: 100%;
    }
}

/* ====================
   Utilitaires
   ==================== */
.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* ====================
   Plugin Footer
   ==================== */
.ava-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.ava-footer p {
    margin: 0;
    font-size: 13px;
    color: #9ca3af;
}

.ava-footer a {
    color: #6b7280;
    font-weight: 600;
    text-decoration: none;
}

.ava-footer a:hover {
    color: #1d2327;
}

/* ====================
   Logs Page Filters
   ==================== */
.ava-filters-card {
    background: #fff;
    padding: 16px 24px;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.ava-filters-card form {
    display: block;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-group .filter-label {
    font-weight: 600;
    color: #1e293b;
    font-size: 13px;
    white-space: nowrap;
    min-width: 65px;
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    transition: all 0.2s ease;
    min-width: 180px;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.filter-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.filter-group input[type="text"]::placeholder {
    color: #9ca3af;
}

.filter-group .button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.filter-group .button-secondary {
    background: #2271b1;
    color: #fff;
    border: 1px solid #2271b1;
}

.filter-group .button-secondary:hover {
    background: #135e96;
    border-color: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(34, 113, 177, 0.2);
}

.filter-group.reset-group {
    margin-left: auto;
}

.filter-group .button-link {
    text-decoration: none;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.filter-group .button-link:hover {
    color: #374151;
    background: #f3f4f6;
}

.filter-row-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.filter-row-secondary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e5e7eb;
    width: 100%;
    clear: both;
}

/* ====================
   Table Legend
   ==================== */
.table-legend {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
}

/* ====================
   AI Referrer Tracking
   ==================== */
.ai-referrer-section {
    border-left: 4px solid #667eea; /* A violet-ish color */
}

.ai-referrer-section h2 .dashicons {
    color: #667eea;
}

.referrer-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.referrer-kpi-card {
    background: #fff;
    padding: 24px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.referrer-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2); /* Violet gradient */
    transition: all 0.3s ease;
}

.referrer-kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.referrer-kpi-card .kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.referrer-kpi-card .kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: #1d2327;
    line-height: 1.1;
}

.referrer-kpi-card .kpi-description {
    font-size: 13px;
    color: #787c82;
    line-height: 1.4;
}

.referrer-table {
    margin-top: 20px;
    font-size: 13px;
}

.referrer-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.referrer-table .family-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    background: #eef2ff; /* Light violet */
    color: #4f46e5; /* Darker violet */
}

.referrer-table td {
    vertical-align: middle;
}

.view-all-link {
    text-align: right;
    margin-top: 20px;
}

.almaweb-ai-visitor-analytics-referrers .hero-kpis-bar {
    margin-top: 0;
}

.almaweb-ai-visitor-analytics-referrers .hero-kpi-card {
    border-left: 4px solid #667eea;
}

.almaweb-ai-visitor-analytics-referrers .hero-kpi-card::before {
    display: none;
}

.almaweb-ai-visitor-analytics-referrers .kpi-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eef2ff;
    color: #667eea;
}
.almaweb-ai-visitor-analytics-referrers .kpi-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.almaweb-ai-visitor-analytics-referrers .hero-kpi-card.score-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    flex-direction: row;
    align-items: center;
}

.almaweb-ai-visitor-analytics-referrers .hero-kpi-card.score-card .kpi-label,
.almaweb-ai-visitor-analytics-referrers .hero-kpi-card.score-card .kpi-description {
    color: rgba(255,255,255,0.8);
}

.almaweb-ai-visitor-analytics-referrers .hero-kpi-card.score-card .kpi-value {
    color: #fff;
}

.almaweb-ai-visitor-analytics-referrers .hero-kpi-card.score-card .kpi-icon {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.almaweb-ai-visitor-analytics-referrers .kpi-acps-grade {
    font-size: 42px;
    font-weight: 800;
    display: block;
    margin-top: 5px;
}
.almaweb-ai-visitor-analytics-referrers .kpi-acps-score {
    font-size: 18px;
    font-weight: 600;
    display: block;
}
.almaweb-ai-visitor-analytics-referrers .kpi-acps-score small {
    font-size: 13px;
    opacity: 0.9;
}