/**
 * Virtual Files - Analytics Dashboard Styles
 * Professional and modern analytics dashboard design
 */

/* ========================================
   Main Container
   ======================================== */
.vf-analytics-wrap {
    margin: 20px 20px 20px 0;
    max-width: 1400px;
}

.vf-analytics-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 23px;
    font-weight: 400;
    margin: 0 0 20px 0;
    padding: 9px 0;
    line-height: 1.3;
}

.vf-analytics-title .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: #2271b1;
}

/* ========================================
   Pro Upgrade Banner (Free Users)
   ======================================== */
.vf-pro-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 40px;
    border-radius: 8px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.vf-pro-banner-content {
    flex: 1;
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.vf-pro-banner-icon {
    flex-shrink: 0;
}

.vf-pro-banner-icon .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    opacity: 0.9;
}

.vf-pro-banner-text h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
    color: #fff;
}

.vf-pro-banner-text > p {
    margin: 0 0 20px 0;
    font-size: 16px;
    opacity: 0.95;
}

.vf-pro-features-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.vf-pro-features-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.vf-pro-features-list .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #a8ff78;
}

.vf-pro-banner-cta {
    flex-shrink: 0;
    text-align: center;
}

.vf-pro-banner-cta .button-hero {
    font-size: 18px;
    padding: 12px 36px;
    height: auto;
    background: #fff;
    border-color: #fff;
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    text-shadow: none;
}

.vf-pro-banner-cta .button-hero:hover {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.vf-pro-banner-cta .button-hero:focus {
    background: #fff;
    border-color: #fff;
    color: #667eea;
    box-shadow: 0 0 0 1px #fff, 0 0 2px 2px rgba(102, 126, 234, 0.5);
}

.vf-pro-banner-pricing {
    margin: 15px 0 0 0;
    font-size: 14px;
    opacity: 0.9;
}

/* ========================================
   Analytics Preview (Blurred for Free Users)
   ======================================== */
.vf-analytics-preview {
    position: relative;
    margin-bottom: 30px;
}

.vf-analytics-blur-overlay {
    position: relative;
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

.vf-analytics-blur-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    background: rgba(255, 255, 255, 0.98);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    filter: none;
    pointer-events: auto;
}

.vf-analytics-blur-message .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: #667eea;
    margin-bottom: 15px;
}

.vf-analytics-blur-message h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #1d2327;
}

.vf-analytics-blur-message p {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #50575e;
}

.vf-analytics-blur-message .button-primary {
    font-size: 16px;
    padding: 8px 24px;
    height: auto;
}

.vf-analytics-placeholder {
    opacity: 0.5;
}

/* ========================================
   Controls Bar
   ======================================== */
.vf-analytics-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 18px 24px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.vf-date-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vf-date-filter label {
    font-weight: 600;
    color: #1d2327;
}

.vf-date-range-select {
    min-width: 200px;
    height: 36px;
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.2s ease;
}

.vf-date-range-select:focus {
    border-color: #2271b1;
    outline: 2px solid transparent;
    box-shadow: 0 0 0 1px #2271b1;
}

.vf-analytics-refresh button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    height: 36px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.vf-analytics-refresh button:hover {
    background: #135e96;
    border-color: #135e96;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(34, 113, 177, 0.3);
}

.vf-analytics-refresh button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(34, 113, 177, 0.2);
}

.vf-analytics-refresh button:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: 2px solid transparent;
}

.vf-analytics-refresh .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 18px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.vf-analytics-refresh .dashicons::before {
    line-height: 18px;
    vertical-align: top;
    display: inline-block;
}

.vf-analytics-refresh .vf-button-text {
    display: inline-block;
    vertical-align: middle;
    line-height: 18px;
}

/* Loading state for refresh button */
.vf-analytics-refresh button.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.vf-analytics-refresh button.loading .dashicons {
    animation: spin 1s linear infinite;
}

.vf-analytics-refresh button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ========================================
   Stats Grid
   ======================================== */
.vf-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.vf-stat-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

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

.vf-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vf-stat-icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: #fff;
}

.vf-stat-icon-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.vf-stat-icon-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.vf-stat-icon-info {
    background: linear-gradient(135deg, #2196f3 0%, #21cbf3 100%);
}

.vf-stat-icon-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.vf-stat-content {
    flex: 1;
}

.vf-stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    color: #1d2327;
    margin-bottom: 4px;
}

.vf-stat-label {
    font-size: 14px;
    font-weight: 600;
    color: #50575e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.vf-stat-meta {
    font-size: 13px;
    color: #787c82;
}

.vf-trend-up {
    color: #10b981;
}

.vf-trend-down {
    color: #ef4444;
}

/* ========================================
   Chart Cards
   ======================================== */
.vf-chart-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.vf-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f1;
}

.vf-chart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.vf-chart-meta {
    font-size: 13px;
    color: #787c82;
}

.vf-chart-container {
    min-height: 350px;
    position: relative;
    padding-bottom: 10px;
}

.vf-chart-donut {
    min-height: 380px;
    max-height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
}

.vf-chart-placeholder {
    height: 350px;
    background: linear-gradient(90deg, #f0f0f1 0%, #f7f7f7 50%, #f0f0f1 100%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   Two Column Layout
   ======================================== */
.vf-analytics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.vf-chart-card-half {
    margin-bottom: 0;
}

/* ========================================
   Top Files Table
   ======================================== */
.vf-top-files-table {
    overflow-x: auto;
}

.vf-top-files-table table {
    margin: 0;
}

.vf-top-files-table thead th {
    background: #f6f7f7;
    font-weight: 600;
    padding: 12px;
}

.vf-top-files-table tbody td {
    padding: 12px;
}

.vf-rank {
    width: 60px;
}

.vf-rank-badge {
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    text-align: center;
    line-height: 32px;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
}

.vf-rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #1d2327;
}

.vf-rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e0e0e0 100%);
    color: #1d2327;
}

.vf-rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e69a5c 100%);
    color: #fff;
}

.vf-rank-badge:not(.vf-rank-1):not(.vf-rank-2):not(.vf-rank-3) {
    background: #50575e;
}

.vf-filename a {
    font-weight: 600;
    color: #2271b1;
    text-decoration: none;
}

.vf-filename a:hover {
    color: #135e96;
    text-decoration: underline;
}

.vf-file-meta {
    margin-top: 4px;
}

.vf-mime-type {
    display: inline-block;
    padding: 2px 8px;
    background: #f0f0f1;
    border-radius: 3px;
    font-size: 11px;
    color: #50575e;
    font-family: monospace;
}

.vf-views strong {
    color: #1d2327;
    font-size: 16px;
}

.vf-last-accessed {
    color: #787c82;
    font-size: 13px;
}

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

/* ========================================
   Responsive Design
   ======================================== */
@media screen and (max-width: 1280px) {
    .vf-analytics-row {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 960px) {
    .vf-pro-banner {
        flex-direction: column;
        text-align: center;
    }

    .vf-pro-banner-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .vf-pro-features-list {
        grid-template-columns: 1fr;
    }

    .vf-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media screen and (max-width: 600px) {
    .vf-analytics-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        padding: 16px;
    }

    .vf-date-filter {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .vf-date-filter label {
        font-size: 14px;
    }

    .vf-date-range-select {
        width: 100%;
    }

    .vf-analytics-refresh button {
        width: 100%;
        justify-content: center;
    }

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

    .vf-stat-card {
        padding: 20px;
    }

    .vf-stat-icon {
        width: 48px;
        height: 48px;
    }

    .vf-stat-icon .dashicons {
        font-size: 24px;
        width: 24px;
        height: 24px;
    }

    .vf-stat-value {
        font-size: 24px;
    }
}

/* ========================================
   Loading States
   ======================================== */
.vf-analytics-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.vf-analytics-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f0f0f1;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   ApexCharts Custom Styling
   ======================================== */
.apexcharts-tooltip {
    background: #1d2327 !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.apexcharts-tooltip-title {
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    font-weight: 600 !important;
    padding: 8px 12px 4px !important;
}

.apexcharts-tooltip-series-group {
    padding: 4px 12px 8px !important;
}

.apexcharts-tooltip-text {
    color: #f0f0f1 !important;
}

.apexcharts-legend {
    padding: 10px 0 !important;
}

.apexcharts-legend-text {
    color: #50575e !important;
    font-size: 13px !important;
    font-weight: 500 !important;
}

/* X-axis labels spacing */
.apexcharts-xaxis-label {
    dominant-baseline: auto !important;
}

.apexcharts-xaxis text {
    font-size: 11px !important;
}

/* Ensure chart has proper bottom padding for rotated labels */
.apexcharts-canvas {
    padding-bottom: 10px;
}

/* Donut chart improvements - remove any stroke/border */
.apexcharts-pie-series path {
    stroke: none !important;
    stroke-width: 0 !important;
}

/* Smooth edges for donut segments */
.apexcharts-donut-slice-0,
.apexcharts-donut-slice-1,
.apexcharts-donut-slice-2,
.apexcharts-donut-slice-3,
.apexcharts-donut-slice-4,
.apexcharts-donut-slice-5,
.apexcharts-donut-slice-6,
.apexcharts-donut-slice-7 {
    stroke: none !important;
}
