/* Statistics Button Styles */
.mailpn-statistics-button-wrapper {
    display: inline-block;
    margin-left: 10px;
    float: right;
}


#mailpn-statistics-button i {
    margin-right: 5px;
    font-size: 18px;
}

/* Statistics Popup Styles */
.mailpn-statistics-popup {
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    display: none; /* Hidden by default */
}

.mailpn-statistics-popup.mailpn-popup-active {
    display: block !important;
}

.mailpn-statistics-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Summary Cards */
.mailpn-statistics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mailpn-stat-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mailpn-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mailpn-stat-card-icon {
    background: #0073aa;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mailpn-stat-card-icon i {
    font-size: 24px;
}

.mailpn-stat-card-content {
    flex: 1;
}

.mailpn-stat-card-number {
    font-size: 28px;
    font-weight: bold;
    color: #0073aa;
    line-height: 1;
    margin-bottom: 5px;
}

.mailpn-stat-card-label {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Charts Section */
.mailpn-statistics-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.mailpn-chart-container {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
}

.mailpn-chart-container h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.mailpn-chart-container canvas {
    max-width: 100%;
    height: auto;
}

/* Clicks Table */
.mailpn-clicks-table {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
}

.mailpn-clicks-table h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.mailpn-clicks-table table {
    width: 100%;
    border-collapse: collapse;
}

.mailpn-clicks-table th,
.mailpn-clicks-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.mailpn-clicks-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.mailpn-clicks-table tr:hover {
    background: #f9f9f9;
}

/* Loading State */
.mailpn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.mailpn-loading i {
    margin-right: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error State */
.mailpn-error {
    color: #d63638;
    text-align: center;
    padding: 40px;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mailpn-statistics-summary {
        grid-template-columns: 1fr;
    }
    
    .mailpn-statistics-charts {
        grid-template-columns: 1fr;
    }
    
    .mailpn-statistics-popup {
        max-width: 95vw;
        margin: 20px;
    }
    
    .mailpn-stat-card {
        padding: 15px;
    }
    
    .mailpn-stat-card-number {
        font-size: 24px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .mailpn-stat-card {
        background: #2c2c2c;
        border-color: #444;
        color: #fff;
    }
    
    .mailpn-stat-card-label {
        color: #ccc;
    }
    
    .mailpn-chart-container,
    .mailpn-clicks-table {
        background: #2c2c2c;
        border-color: #444;
        color: #fff;
    }
    
    .mailpn-clicks-table th {
        background: #444;
        color: #fff;
    }
    
    .mailpn-clicks-table tr:hover {
        background: #3c3c3c;
    }
}
